hypertools.tools.gensim_models.LdaVectorizer¶
- class hypertools.tools.gensim_models.LdaVectorizer(num_topics=20, passes=1, seed=0)[source]¶
Semantic-stage model: gensim’s LdaModel (Latent Dirichlet Allocation) trained over a bag-of-words corpus built internally from a dense document-term matrix (e.g. the output of a vectorizer-stage model). transform returns dense (n_docs, num_topics) topic proportions – each row sums to (approximately) 1, mirroring sklearn.decomposition.LatentDirichletAllocation.
- Parameters:
- num_topicsint
Number of latent topics. Default: 20 (matches hypertools’ scikit-learn LDA/NMF default).
- passesint
Number of passes through the corpus during training. Default: 1.
- seedint or None
Random state for reproducible training (gensim’s random_state). Default: 0.
- Attributes:
- model_gensim.models.LdaModel
The trained LDA model (set by fit).
- n_features_int
Vocabulary size (number of document-term matrix columns) seen during fit; transform requires the same width.
Methods
fit(X[, y])Fit an LDA model to a dense document-term matrix.
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)Compute topic proportions for a dense document-term matrix.
Methods
__init__([num_topics, passes, seed])fit(X[, y])Fit an LDA model to a dense document-term matrix.
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)Compute topic proportions for a dense document-term matrix.