Skip to content

Commit

Permalink
Update for more modern versions of scikit-learn
Browse files Browse the repository at this point in the history
  • Loading branch information
manuel-calzolari committed Oct 12, 2020
1 parent 8aa4f9c commit c029c0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 10 additions & 4 deletions genetic_selection/__init__.py
Expand Up @@ -27,9 +27,15 @@
from sklearn.base import is_classifier
from sklearn.model_selection import check_cv
from sklearn.model_selection._validation import _fit_and_score
from sklearn.metrics.scorer import check_scoring
from sklearn.feature_selection.base import SelectorMixin
from sklearn.externals.joblib import cpu_count
from sklearn.metrics import check_scoring
try:
from sklearn.feature_selection import SelectorMixin # scikit-learn>=0.23.0
except ImportError:
try:
from sklearn.feature_selection._base import SelectorMixin # scikit-learn==0.22.*
except ImportError:
from sklearn.feature_selection.base import SelectorMixin # scikit-learn<0.22.0
from sklearn.utils._joblib import cpu_count
from deap import algorithms
from deap import base
from deap import creator
Expand Down Expand Up @@ -272,7 +278,7 @@ def fit(self, X, y):
def _fit(self, X, y):
X, y = check_X_y(X, y, "csr")
# Initialization
cv = check_cv(self.cv, y, is_classifier(self.estimator))
cv = check_cv(self.cv, y, classifier=is_classifier(self.estimator))
scorer = check_scoring(self.estimator, scoring=self.scoring)
n_features = X.shape[1]

Expand Down
3 changes: 2 additions & 1 deletion setup.py
Expand Up @@ -31,8 +31,9 @@
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
packages=find_packages(),
python_requires='>=2.7',
install_requires=['scikit-learn>=0.18', 'deap>=1.0.2'],
install_requires=['scikit-learn>=0.20.3', 'deap>=1.0.2'],
)

0 comments on commit c029c0e

Please sign in to comment.