Skip to content

Commit

Permalink
Fix sk22 - Needs to be checked (societe-generale#37)
Browse files Browse the repository at this point in the history
* dev 0.2.1-dev

* compatibility sklearn 22 and 22

* fix typo
  • Loading branch information
Lionel MASSOULARD authored and GitHub Enterprise committed Feb 28, 2020
1 parent 1ae252d commit 551fc0a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
11 changes: 9 additions & 2 deletions aikit/cross_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@

import sklearn.model_selection
from sklearn.model_selection._split import BaseCrossValidator, _num_samples, train_test_split
from sklearn.model_selection._validation import _index_param_value
try:
from sklearn.utils.validation import _check_fit_params # In sklearn 0.22
except ImportError:
from sklearn.model_selection._validation import _index_param_value
_check_fit_params = _index_param_value




import sklearn.base

Expand Down Expand Up @@ -270,7 +277,7 @@ def _compute_one_fold(
index_test = test

fit_params = fit_params if fit_params is not None else {}
fit_params = {k: _index_param_value(X, v, train)
fit_params = {k: _check_fit_params(X, v, train)
for k, v in fit_params.items()}
# Try to subset the fit_params if that is possible, Ex : 'sample_weight=np.array(....)' should be subsetted but not 'epochs=10'
start_fit = time()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cross_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ def test_approx_cross_validation_fit_params(approximate_cv):
)


def test_approx_cross_validatoin_pass_kwargs():
def test_approx_cross_validation_pass_kwargs():
X, y = make_classification(n_samples=100, random_state=123)

estimator = DummyModelWithApprox(check_kwargs=True)
Expand Down

0 comments on commit 551fc0a

Please sign in to comment.