Skip to content

Instantly share code, notes, and snippets.

@ikatsov
Created March 15, 2020 16:28
Show Gist options
  • Save ikatsov/6add8a91b68603826d96d5d5cfdc2f01 to your computer and use it in GitHub Desktop.
Save ikatsov/6add8a91b68603826d96d5d5cfdc2f01 to your computer and use it in GitHub Desktop.
from sklearn.metrics import silhouette_samples, silhouette_score
for space_name, space in {'t-SNE': tsne_results,
'original': model.wv.vectors}.items():
for entity in ['department', 'aisle']:
s = silhouette_score(space, df_semantic_item[entity], metric="cosine")
print(f"Score on {space_name} space for {entity}s is {s:.4}")
--------------
#> Score on t-SNE space for departments is -0.4912
#> Score on t-SNE space for aisles is -0.7124
#> Score on original space for departments is -0.05162
#> Score on original space for aisles is : -0.1148
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment