2
$\begingroup$

I am currently working in Python with a dataset with both categorical and continuous variables. The main objective is to do clustering and find how different features help to create the clusters.

This is done with a Hierarchical Clustering that uses a Gower pre-computed distance matrix (this distance allows to use both categorical and continuous features).

The clustering is done as follows:

import gower
model = AgglomerativeClustering(n_clusters=6, affinity="precomputed", linkage="average")
distance_matrix=gower.gower_matrix(dataframe)
model = model.fit(distance_matrix)

After the clustering, I would like to use t-SNE to get a graphical view that helps me to check how is the clustering performing. In order to do this, I used again the distance matrix as an input parameter for t-SNE:

tsne = TSNE(n_components=2, perplexity=35, metric="precomputed")
df_tsne = tsne.fit_transform(distance_matrix)

In the graph shown below, we can see how each cluster is distributed in a 2-D representation (made by t-SNE):

Result of the t-SNE

My question: Is this a reliable way of checking the goodness of the clustering? Thank you in advance!

$\endgroup$

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.