1
$\begingroup$

I used TSNE method to cluster my DataSet.

X_embedded = TSNE(n_components=2, verbose=1, perplexity=10, n_iter=600).fit_transform(binary)
kmeans = KMeans(init="k-means++", n_clusters=6, n_init=4)
kmeans.fit(X_embedded) 
  1. Why it just clusters my DataSet into 2 clusters?
  2. What is The best method for clustering that?
  3. How to determine Number Of Clusters ?

Here is my clusters's dispersion :

import seaborn as sns

sns.scatterplot(data = X_embedded)

Clustered DataSet

$\endgroup$
3
  • $\begingroup$ 0. Welcome to CV.SE. 1. I think you have a little programming mistake in your plotting. There are a few methodologies that might be relevant to your questions. Please see my answer below for more details. $\endgroup$
    – usεr11852
    Jul 1, 2021 at 9:25
  • $\begingroup$ @usεr11852 Thanks..Yes It has some problems...I used import plotly.express as px. And draw scatterPlot with that...And alsodata["x_component"]=X_embedded[:,0] data["y_component"]=X_embedded[:,1]...Is It true? $\endgroup$ Jul 1, 2021 at 14:50
  • $\begingroup$ Yes, but please note that the order of components in t-SNE is arbitrary. (i.e. x_component do not have to be the first column of the transformed output) $\endgroup$
    – usεr11852
    Jul 1, 2021 at 23:37

1 Answer 1

0
$\begingroup$
  1. There are not only two clusters. What happens is that when plotting the data we do not define how the dots should be coloured, something like: plt.scatter(x = ..., y = ..., c = kmeans.predict(...)) should give you what you are after. (Side-note: the scatter-plot shown appears quite unstructured so I would not be very optimistic about a clustering algorithm doing well here)
  2. There is never a best method to cluster. As clustering is a unsupervised learning procedure, the good of a particular clustering in related to the relevance of the "structure discovery" we gain out of it. e.g. Clustering customer behaviour and finding that female and male costumers have different spending patterns might be very relevant ("so clustering was good") or might be something everyone in the business knew already ("so clustering is bad").
  3. Determining the exact number of cluster is usually not a clear-cut question. That said, we have multiple threads within CV.SE discussing this question in detail. For example see the threads:

In the absence of any other context using something like the Gap statistic (see: Gap Statistic in plain English?) or the Elbow method (Elbow criteria to determine number of cluster - same above) is probably OK as a first step. After getting an idea of what these heuristics do and why they give their respective answers, more involved metrics might be relevant.

$\endgroup$
3
  • $\begingroup$ Thank you so much..They are great link...I am checking out them now $\endgroup$ Jul 1, 2021 at 14:52
  • $\begingroup$ I am glad I could help. If this answer is helpful please consider upvoting it and if it resolves your question marking it as the accepted answer. $\endgroup$
    – usεr11852
    Jul 1, 2021 at 23:33
  • $\begingroup$ I marked it thank you...If i have any question about them i will ask here $\endgroup$ Jul 2, 2021 at 6:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.