hypertools.tools.gensim_models.Doc2VecVectorizer¶
- class hypertools.tools.gensim_models.Doc2VecVectorizer(vector_size=100, window=5, min_count=1, epochs=10, seed=0, workers=None)[source]¶
Vectorizer-stage model: a document’s vector is either its trained gensim Doc2Vec tag vector (for documents seen during fit) or an inferred vector (Doc2Vec.infer_vector) for new documents at transform time. To keep transform consistent regardless of whether a document was part of the training corpus, this wrapper always uses infer_vector.
Note that while two identically-seeded fits produce identical transform outputs, repeated transform() calls on the SAME fitted instance are not bitwise-identical: gensim’s infer_vector advances the model’s internal random-number state on every call.
- Parameters:
- vector_sizeint
Dimensionality of the 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 (also used as the number of inference steps in infer_vector). Default: 10.
- seedint or None
Random seed for reproducible training/inference. Default: 0. See Word2VecVectorizer for the single-worker determinism note.
- workersint or None
Number of worker threads used during training. Default: None (resolves per _effective_workers).
- Attributes:
- model_gensim.models.doc2vec.Doc2Vec
The trained Doc2Vec model (set by fit).
Methods
fit(X[, y])Train a Doc2Vec 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)Infer document vectors for the given documents.
Methods
__init__([vector_size, window, min_count, ...])fit(X[, y])Train a Doc2Vec 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)Infer document vectors for the given documents.