python - sci-kit learn crashing on certain amounts of data -
I am trying to process 71,000 rows of more than 200 columns with a lower array and two science-kit models I learn I'm trying to give both different error when I tried to remove the problem line more than 5853 rows, but it failed. Can not science-kit learn to handle this much data, or is it something else? A list of XLists is a narrow array.
KNN:
nbrs = Nearest navy (n_neighbors = 2, algorithm = 'ball_tree'). Fit (x)
Error:
File "knn.py", line 48,
Value error: data type is not understood
K-mean:
kmeans_model = KMines (n_clusters = 2, random_state = 1). (X)
Error:
Traceback (last call final): File "knn.py", line 48,
Please check then it Take a look to see if all the rows are of the same length, using In more than one numbers, your line length is different, eg. From line 5853, probably not at all times. Numbers data arrays are useful only when all lines have the same length (they continue to work, but do not do what you expect.) You should check to see why this is the reason, fix it, and then return to Here is an example, what would happen if the line length is not equal: dtype
of your matrix X By typing
X.dtype
, if it is object
or dtype ('o')
, then in an array
length = [for line in x] [lane (line)]
np.unique (length)
knn
.
np rng = np.random.RandomState (42) x = rng.randn ( 100, 20) Import samples as # Now remove an element from the 56th line X = list (X) X [55] = x [55] [: - 1] # back it ndarray x = np Change in .array (X) # Change dtype from X.dtype # sklearn.neighbors Returns dtype ('O') nearest young nbrs =
Comments
Post a Comment