Skip to content

Instantly share code, notes, and snippets.

@andrea-dagostino
Created October 3, 2022 22:52
Show Gist options
  • Select an option

  • Save andrea-dagostino/f2f579e68604f14f327b1d338bc7d8d7 to your computer and use it in GitHub Desktop.

Select an option

Save andrea-dagostino/f2f579e68604f14f327b1d338bc7d8d7 to your computer and use it in GitHub Desktop.
text_sim_tfidf
top = similarity_df[similarity_df > 0.4] # change this
mask = np.triu(np.ones_like(top))
# let's create the viz
plt.figure(figsize=(12, 12))
sns.heatmap(
top,
square=True,
annot=True,
robust=True,
fmt='.2f',
annot_kws={'size': 7, 'fontweight': 'bold'},
yticklabels=top.columns
xticklabels=top.columns,
cmap="YlGnBu",
mask=mask
)
plt.title('Similarity heatmap', fontdict={'fontsize': 24})
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment