whatlies.transformers.Umap
¶
This transformer transformers all vectors in an EmbeddingSet by means of umap. We're using the implementation in umap-learn.
Parameters
Name | Type | Description | Default |
---|---|---|---|
n_components |
the number of compoments to create/add | 2 |
|
**kwargs |
keyword arguments passed to the UMAP algorithm | {} |
Usage:
from whatlies.language import SpacyLanguage
from whatlies.transformers import Umap
words = ["prince", "princess", "nurse", "doctor", "banker", "man", "woman",
"cousin", "neice", "king", "queen", "dude", "guy", "gal", "fire",
"dog", "cat", "mouse", "red", "blue", "green", "yellow", "water",
"person", "family", "brother", "sister"]
lang = SpacyLanguage("en_core_web_md")
emb = lang[words]
emb.transform(Umap(3)).plot_interactive_matrix(0, 1, 2)