sklearn_api.atmodel – Scikit learn wrapper for Author-topic model¶Scikit learn interface for gensim for easy use of gensim with scikit-learn Follows scikit-learn API conventions
gensim.sklearn_api.atmodel.AuthorTopicTransformer(num_topics=100, id2word=None, author2doc=None, doc2author=None, chunksize=2000, passes=1, iterations=50, decay=0.5, offset=1.0, alpha='symmetric', eta='symmetric', update_every=1, eval_every=10, gamma_threshold=0.001, serialized=False, serialization_path=None, minimum_probability=0.01, random_state=None)¶Bases: sklearn.base.TransformerMixin, sklearn.base.BaseEstimator
Base AuthorTopic module
Sklearn wrapper for AuthorTopic model. See gensim.models.AuthorTopicModel for parameter details.
fit(X, y=None)¶Fit the model according to the given training data. Calls gensim.models.AuthorTopicModel
fit_transform(X, y=None, **fit_params)¶Fit to data, then transform it.
Fits transformer to X and y with optional parameters fit_params and returns a transformed version of X.
| Parameters: |
|
|---|---|
| Returns: | X_new – Transformed array. |
| Return type: | numpy array of shape [n_samples, n_features_new] |
get_params(deep=True)¶Get parameters for this estimator.
| Parameters: | deep (boolean, optional) – If True, will return the parameters for this estimator and contained subobjects that are estimators. |
|---|---|
| Returns: | params – Parameter names mapped to their values. |
| Return type: | mapping of string to any |
partial_fit(X, author2doc=None, doc2author=None)¶Train model over X.
set_params(**params)¶Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects
(such as pipelines). The latter have parameters of the form
<component>__<parameter> so that it’s possible to update each
component of a nested object.
| Returns: | |
|---|---|
| Return type: | self |
transform(author_names)¶Return topic distribution for input authors as a list of (topic_id, topic_probabiity) 2-tuples.