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

acp module is outdated and does not work as it uses an older version of scikit-learn #16

Open
azedinez opened this issue May 1, 2019 · 3 comments

Comments

@azedinez
Copy link

azedinez commented May 1, 2019

Please replace this bit:

from sklearn.cross_validation import KFold, StratifiedKFold
from sklearn.cross_validation import ShuffleSplit, StratifiedShuffleSplit

by:
from sklearn.model_selection import KFold, StratifiedKFold
from sklearn.model_selection import ShuffleSplit, StratifiedShuffleSplit

@azedinez azedinez changed the title acp module is outdated as uses an older version of scikit-learn acp module is outdated and does not work as it uses an older version of scikit-learn May 1, 2019
@skaliev
Copy link

skaliev commented Oct 7, 2020

Do you know which version of scikit learn is stable with nonconformist 2.1.0 especially concerning acp?
I still get the following error (after editing acp.py):

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-944c165efcac> in <module>
     69 # -----------------------------------------------------------------------------
     70 for name, model in models.items():
---> 71     model.fit(data.data[train, :], data.target[train])
     72     prediction = model.predict(data.data[test, :], significance=significance)
     73     table = np.hstack((prediction, truth))

/zeus/fabiank/python3.7_env/lib/python3.7/site-packages/nonconformist/acp.py in fit(self, x, y)
    181                                                    self.n_models,
    182 		                                   problem_type)
--> 183                 for train, cal in samples:
    184                         predictor = clone(self.predictor)
    185                         predictor.fit(x[train, :], y[train])

/zeus/fabiank/python3.7_env/lib/python3.7/site-packages/nonconformist/acp.py in gen_samples(self, y, n_samples, problem_type)
     80 			splits = StratifiedShuffleSplit(y,
     81                                                         n_iter=n_samples,
---> 82 			                                test_size=self.cal_portion)
     83                 else:
     84 			splits = ShuffleSplit(y.size,

/zeus/fabiank/python3.7_env/lib/python3.7/site-packages/sklearn/utils/validation.py in inner_f(*args, **kwargs)
     70                           FutureWarning)
     71         kwargs.update({k: arg for k, arg in zip(sig.parameters, args)})
---> 72         return f(**kwargs)
     73     return inner_f
     74 

TypeError: __init__() got an unexpected keyword argument 'n_iter'

@juliameister
Copy link

juliameister commented Oct 18, 2020

Using scikit-learn 0.17 worked for me.

'n_iter' was renamed to 'n_splits' in the sklearn.model_selection.StratifiedShuffleSplit class in version 0.18 (see the relevant release history here: https://scikit-learn.org/0.18/whats_new.html).

@ben1a-hastings
Copy link

It seems this has been changed in the code, but this hasn't been updated on pypi. I am still getting the same error with the pypi version:

  File "C:\Users\auffarb\.conda\envs\py10\Lib\site-packages\nonconformist\acp.py", line 10, in <module>
    from sklearn.cross_validation import KFold, StratifiedKFold
ModuleNotFoundError: No module named 'sklearn.cross_validation'

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

4 participants