Kmeans Algorithms with Python

preview_player
Показать описание
This is how you create K means algorithms for clusters. For this example, you can Import a simple database and then select the two variables you want to work with. For this example, create your own dataset and run your own model :) . You can create random numbers in excel and generate large datasets. Good luck !
Рекомендации по теме
Комментарии
Автор

i am getting an error

ValueError Traceback (most recent call last)
in <module>
14 kmeans = KMeans(n_clusters = 2)
15
---> 16 y_kmeans = kmeans.fit_predict(X)

in fit_predict(self, X, y, sample_weight)
1006 Index of the cluster each sample belongs to.
1007 """
-> 1008 return self.fit(X,
1009
1010 def fit_transform(self, X, y=None, sample_weight=None):

in fit(self, X, y, sample_weight)
857 order = "C" if self.copy_x else None
858 X = check_array(X, accept_sparse='csr', dtype=[np.float64, np.float32],
--> 859 order=order, copy=self.copy_x)
860 # verify that the number of samples given is larger than k
861 if _num_samples(X) < self.n_clusters:

in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)
529 array = array.astype(dtype, casting="unsafe", copy=False)
530 else:
--> 531 array = np.asarray(array, order=order, dtype=dtype)
532 except ComplexWarning:
533 raise ValueError("Complex data not supported\n"

in asarray(a, dtype, order)
83
84 """
---> 85 return array(a, dtype, copy=False, order=order)
86
87

ValueError: could not convert string to float: 'TOTAL'





What should i do now?

poojashelar
welcome to shbcf.ru