您具有1个特征的许多样本,因此可以使用numpy的reshape将数组重塑为(13,876,1):
from sklearn.cluster import KMeansimport numpy as npx = np.random.random(13876)km = KMeans()km.fit(x.reshape(-1,1)) # -1 will be calculated to be 13876 here

您具有1个特征的许多样本,因此可以使用numpy的reshape将数组重塑为(13,876,1):
from sklearn.cluster import KMeansimport numpy as npx = np.random.random(13876)km = KMeans()km.fit(x.reshape(-1,1)) # -1 will be calculated to be 13876 here