# Create an instance of AgglomerativeClustering content = df_emotions['sentiment'] agglomerative_vec = tfidf.fit_transform(content) agg_clustering = AgglomerativeClustering(n_clusters=13, metric='euclidean', linkage='ward') # Create labels from the Agglomerative Clustering above labels = np.array(agg_clustering.fit_predict(agglomerative_vec.toarray())) print(labels)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter