Skip to content
Advertisement

Eli5.Sklearn PermutationImportance() — TypeError: check_cv() takes from 0 to 2 positional arguments but 3 were given

cv = RepeatedStratifiedKFold(n_splits=5, n_repeats=10, random_state=100)
perm = PermutationImportance(clf.named_steps['classifier'], scoring='roc_auc', cv=cv)
perm.fit(X=x_train_valid_proc, y=y_train_valid)

I am running permutation importance from eli5.sklearn. I keep getting this error :

 Traceback (most recent call last):
 cv = check_cv(self.cv, y, is_classifier(self.estimator))
 TypeError: check_cv() takes from 0 to 2 positional arguments but 3 were given

I am unsure how to go about this as I am only passing 2 arguments into perm.fit()

Any advice would be appreciated.

Thank You

error message image link to error message image

Advertisement

Answer

This is a known error, fixed in the master branch of the spinoff repo, but not yet in a PyPI release. You can fix it by installing directly from github.

https://github.com/TeamHG-Memex/eli5/issues/414
https://github.com/eli5-org/eli5/issues/12
https://github.com/eli5-org/eli5/blob/master/eli5/sklearn/permutation_importance.py#L214

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement