'T-SNE for multiple clusters

I have a data that consists of (850500 rows, 10 categorical columns)

(After clustering > 10 categorical columns and Cluster column)

I used T-SNE to visualize my clusters, they do not seem well separated, how can I do this visualization better for categorical data? Change coordinate type

l = df['Cluster']
d = df.drop("Cluster", axis = 1)
dummies = pd.get_dummies(d)
standardized_data = StandardScaler().fit_transform(dummies)

data_points = standardized_data[0:100000, :]
labels_data = l[0:100000]
model = TSNE(n_components = 2, random_state = 0)
tsne_data = model.fit_transform(data_points)
tsne_data = np.vstack((tsne_data.T, labels_data)).T
tsne_df = pd.DataFrame(data = tsne_data,
     columns =("Dimension1", "Dimension2", "Clusters"))

sns.FacetGrid(tsne_df, hue ="Clusters", size = 6).map(
       plt.scatter, 'Dimension1', 'Dimension2').add_legend()
 
plt.show()

enter image description here

Looking for a solution like this dataset: enter image description here



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source