Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MRG] Updated IPython notebook for scikit-learn wrappers #1428

Merged
merged 9 commits into from
Jun 21, 2017
316 changes: 256 additions & 60 deletions docs/notebooks/sklearn_wrapper.ipynb

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions gensim/sklearn_integration/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,10 @@
See [1] for complete set of conventions.
[1] http://scikit-learn.org/stable/developers/
"""


from .base_sklearn_wrapper import BaseSklearnWrapper # noqa: F401
from .sklearn_wrapper_gensim_ldamodel import SklLdaModel # noqa: F401
from .sklearn_wrapper_gensim_lsimodel import SklLsiModel # noqa: F401
from .sklearn_wrapper_gensim_rpmodel import SklRpModel # noqa: F401
from .sklearn_wrapper_gensim_ldaseqmodel import SklLdaSeqModel # noqa: F401
5 changes: 3 additions & 2 deletions gensim/sklearn_integration/sklearn_wrapper_gensim_ldamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

from gensim import models
from gensim import matutils
from gensim.sklearn_integration import base_sklearn_wrapper
from gensim.sklearn_integration import BaseSklearnWrapper


class SklLdaModel(base_sklearn_wrapper.BaseSklearnWrapper, TransformerMixin, BaseEstimator):
class SklLdaModel(BaseSklearnWrapper, TransformerMixin, BaseEstimator):
"""
Base LDA module
"""
Expand Down Expand Up @@ -64,6 +64,7 @@ def set_params(self, **parameters):
Set all parameters.
"""
super(SklLdaModel, self).set_params(**parameters)
return self

def fit(self, X, y=None):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
from sklearn.exceptions import NotFittedError

from gensim import models
from gensim.sklearn_integration import base_sklearn_wrapper
from gensim.sklearn_integration import BaseSklearnWrapper


class SklLdaSeqModel(base_sklearn_wrapper.BaseSklearnWrapper, TransformerMixin, BaseEstimator):
class SklLdaSeqModel(BaseSklearnWrapper, TransformerMixin, BaseEstimator):
"""
Base LdaSeq module
"""
Expand Down Expand Up @@ -61,6 +61,7 @@ def set_params(self, **parameters):
Set all parameters.
"""
super(SklLdaSeqModel, self).set_params(**parameters)
return self

def fit(self, X, y=None):
"""
Expand Down
5 changes: 3 additions & 2 deletions gensim/sklearn_integration/sklearn_wrapper_gensim_lsimodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@

from gensim import models
from gensim import matutils
from gensim.sklearn_integration import base_sklearn_wrapper
from gensim.sklearn_integration import BaseSklearnWrapper


class SklLsiModel(base_sklearn_wrapper.BaseSklearnWrapper, TransformerMixin, BaseEstimator):
class SklLsiModel(BaseSklearnWrapper, TransformerMixin, BaseEstimator):
"""
Base LSI module
"""
Expand Down Expand Up @@ -51,6 +51,7 @@ def set_params(self, **parameters):
Set all parameters.
"""
super(SklLsiModel, self).set_params(**parameters)
return self

def fit(self, X, y=None):
"""
Expand Down
5 changes: 3 additions & 2 deletions gensim/sklearn_integration/sklearn_wrapper_gensim_rpmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
from sklearn.exceptions import NotFittedError

from gensim import models
from gensim.sklearn_integration import base_sklearn_wrapper
from gensim.sklearn_integration import BaseSklearnWrapper


class SklRpModel(base_sklearn_wrapper.BaseSklearnWrapper, TransformerMixin, BaseEstimator):
class SklRpModel(BaseSklearnWrapper, TransformerMixin, BaseEstimator):
"""
Base RP module
"""
Expand All @@ -41,6 +41,7 @@ def set_params(self, **parameters):
Set all parameters.
"""
super(SklRpModel, self).set_params(**parameters)
return self

def fit(self, X, y=None):
"""
Expand Down