sklearn_api.w2vmodel – Scikit learn wrapper for word2vec model¶Scikit learn interface for gensim for easy use of gensim with scikit-learn Follows scikit-learn API conventions
gensim.sklearn_api.w2vmodel.W2VTransformer(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, sg=0, hs=0, negative=5, cbow_mean=1, hashfxn=<built-in function hash>, iter=5, null_word=0, trim_rule=None, sorted_vocab=1, batch_words=10000)¶Bases: sklearn.base.TransformerMixin, sklearn.base.BaseEstimator
Base Word2Vec module
Sklearn wrapper for Word2Vec model. See gensim.models.Word2Vec for parameter details.
fit(X, y=None)¶Fit the model according to the given training data. Calls gensim.models.Word2Vec
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)¶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(words)¶Return the word-vectors for the input list of words.