i m try to apply k-means with Python 3 to my dataset (Amazon review) for classify similar user (from review).
I m starting with sklearn from this sketch
but in my case i don't have label or category, and i don't understand how k-means can cluster different items from this matrix TD-IDF.
- How can I group similar words from my dataset, from the matrix without having any information?
- How do I show these n-clusters in the chart?
- And how do I show the similar words of this cluster, if I do not have any information (like label or category)?
For now this is my code :
k = 5 km = KMeans(n_clusters=k, init='k-means++', max_iter=100, n_init=5) km.fit(Y) ##Y is my TD-IDF matrix original_centroids = svd.inverse_transform(km.cluster_centers_) print(original_centroids.shape) for i in range(original_centroids.shape): original_centroids[i] = np.array([x for x in original_centroids[i]]) svd_centroids = original_centroids.argsort()[:, ::-1]
i would like have a set like this(with similar word near)
I m very lost, because i m new in this word.