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

Incompatibility with scikit-learn model selection module #32

Open
nguigs opened this issue Aug 31, 2018 · 0 comments
Open

Incompatibility with scikit-learn model selection module #32

nguigs opened this issue Aug 31, 2018 · 0 comments

Comments

@nguigs
Copy link
Contributor

nguigs commented Aug 31, 2018

It is currently not possible to use the scikit-learn GridSearchCV module with estimators from Parsimony because the method get_params is not compatible:

import parsimony.estimators as estimators
from sklearn.model_selection import GridSearchCV

rr = estimators.RidgeRegression(l=1.0)
param = {'ridgeregression__l': [0.2 * k for k in range(6)]}
grid_search = GridSearchCV(estimator=rr, param_grid=param, cv=5)

grid_search.fit(Xtr, ytr)

Traceback (most recent call last):

  File "<ipython-input-51-4f6ebd276276>", line 8, in <module>
    grid_search.fit(Xtr, ytr)

  File "/home/python-environments/env/lib/python2.7/site-packages/sklearn/model_selection/_search.py", line 625, in fit
    base_estimator = clone(self.estimator)

  File "/home/python-environments/env/lib/python2.7/site-packages/sklearn/base.py", line 60, in clone
    new_object_params = estimator.get_params(deep=False)

TypeError: get_params() got an unexpected keyword argument 'deep'

This could be fixed adding the parameter deep and as in scikit-learn:

https://github.com/scikit-learn/scikit-learn/blob/f0ab589f1541b1ca4570177d93fd7979613497e3/sklearn/base.py#L244-L248

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

No branches or pull requests

1 participant