sklearn_api.d2vmodel – Scikit learn wrapper for paragraph2vec model¶Scikit learn interface for gensim for easy use of gensim with scikit-learn Follows scikit-learn API conventions
gensim.sklearn_api.d2vmodel.D2VTransformer(dm_mean=None, dm=1, dbow_words=0, dm_concat=0, dm_tag_count=1, docvecs=None, docvecs_mapfile=None, comment=None, trim_rule=None, size=100, alpha=0.025, window=5, min_count=5, max_vocab_size=None, sample=0.001, seed=1, workers=3, min_alpha=0.0001, hs=0, negative=5, cbow_mean=1, hashfxn=<built-in function hash>, iter=5, sorted_vocab=1, batch_words=10000)¶Bases: sklearn.base.TransformerMixin, sklearn.base.BaseEstimator
Base Doc2Vec module
Sklearn api for Doc2Vec model. See gensim.models.Doc2Vec and gensim.models.Word2Vec for parameter details.
fit(X, y=None)¶Fit the model according to the given training data. Calls gensim.models.Doc2Vec
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 |
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(docs)¶Return the vector representations for the input documents. The input docs should be a list of lists like : [ [‘calculus’, ‘mathematical’], [‘geometry’, ‘operations’, ‘curves’] ] or a single document like : [‘calculus’, ‘mathematical’]