hypertools.tools.gensim_models.FastTextVectorizer¶
- class hypertools.tools.gensim_models.FastTextVectorizer(vector_size=100, window=5, min_count=1, epochs=10, seed=0, workers=None)[source]¶
Vectorizer-stage model: a document’s vector is the mean of its tokens’ trained gensim FastText word vectors. Unlike Word2VecVectorizer, out-of-vocabulary tokens are subword-safe: FastText represents every word (seen or unseen) as the sum of its character n-gram vectors, so transform can produce meaningful vectors for words never seen during fit.
- Parameters:
- vector_sizeint
Dimensionality of the word (and document) vectors. Default: 100.
- windowint
Maximum distance between the current and predicted word within a sentence. Default: 5.
- min_countint
Ignores all words with total frequency lower than this. Default: 1.
- epochsint
Number of training epochs. Default: 10.
- seedint or None
Random seed for reproducible training. Default: 0. See Word2VecVectorizer for the single-worker determinism note.
- workersint or None
Number of worker threads. Default: None (resolves per _effective_workers).
- Attributes:
- model_gensim.models.FastText
The trained FastText model (set by fit).
Methods
fit(X[, y])Train a FastText model on the given documents.
fit_transform(X[, y])Fit to data, then transform it.
get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
set_output(*[, transform])Set output container.
set_params(**params)Set the parameters of this estimator.
transform(X)Embed documents as the mean of their (subword-safe) word vectors.
Methods
__init__([vector_size, window, min_count, ...])fit(X[, y])Train a FastText model on the given documents.
fit_transform(X[, y])Fit to data, then transform it.
get_metadata_routing()Get metadata routing of this object.
get_params([deep])Get parameters for this estimator.
set_output(*[, transform])Set output container.
set_params(**params)Set the parameters of this estimator.
transform(X)Embed documents as the mean of their (subword-safe) word vectors.