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

Inheritance in OnehotTransactions #249

Merged
merged 3 commits into from
Sep 19, 2017
Merged

Inheritance in OnehotTransactions #249

merged 3 commits into from
Sep 19, 2017

Conversation

iaroslav-ai
Copy link
Contributor

The following

from sklearn.base import clone
from mlxtend.preprocessing import OnehotTransactions
enc = OnehotTransactions()
clone(enc)

raises

TypeError: Cannot clone object '<mlxtend.preprocessing.onehot.OnehotTransactions object at 0x7f11d8ed7a90>' (type <class 'mlxtend.preprocessing.onehot.OnehotTransactions'>): it does not seem to be a scikit-learn estimator as it does not implement a 'get_params' methods.

because the class does not inherit from base classes in sklearn.
This is a fix

The following
```python
from sklearn.base import clone
from mlxtend.preprocessing import OnehotTransactions
enc = OnehotTransactions()
clone(enc)
```
raises
```
TypeError: Cannot clone object '<mlxtend.preprocessing.onehot.OnehotTransactions object at 0x7f11d8ed7a90>' (type <class 'mlxtend.preprocessing.onehot.OnehotTransactions'>): it does not seem to be a scikit-learn estimator as it does not implement a 'get_params' methods.
```
because the class does not inherit from base classes in sklearn.
This is a fix
@iaroslav-ai
Copy link
Contributor Author

P.S. Because of this I cannot use this class for example in FeatureUnion or in GridSearchCV.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.002%) to 89.521% when pulling c306008 on iaroslav-ai:patch-1 into 00b4857 on rasbt:master.

@rasbt
Copy link
Owner

rasbt commented Sep 19, 2017

Yeah, that makes sense. Thanks a lot!

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.007%) to 89.512% when pulling ecd2f44 on iaroslav-ai:patch-1 into 00b4857 on rasbt:master.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 89.534% when pulling ecd2f44 on iaroslav-ai:patch-1 into 00b4857 on rasbt:master.

@rasbt rasbt merged commit 958cb83 into rasbt:master Sep 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants