i m try to apply k-means with Python 3 to my dataset (Amazon review) for classify similar user (from review).
I just have a TF and TF-IDF matrix (and i have a row(user) and columns(words) value, row is user and columns is word of review in distinct csv file) and i wish cluster the user.
I m starting with sklearn from this sketch
but in my case i don't have label or category.
For now, and i applydon't understand how k-means and make some analysis on thecan cluster and on the variancedifferent items from this matrix TD-IDF. After i wish calculate a centroid and make a plot of
- 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 clustering, but i can't, because i don't have a label like in exampleis my code :
labelsk = dataset5
km = KMeans(n_clusters=k, init='k-means++', max_iter=100, n_init=5)
km.targetfit(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[0]):
original_centroids[i] = np.array([x for x in original_centroids[i]])
svd_centroids = original_centroids.argsort()[:, ::-1]
In this example , maybe the label will be compute before.
I m findingi would like have a set like this example too:
but don't help me so much.(with similar word near)
So, the question is: Can i apply k-means without label?
I m very lost, because i m new in this word.