Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 887aebd

Browse files
committed
MAINT merge _check_cv into check_cv as indices argument is removed in 0.17
1 parent 3f2f225 commit 887aebd

File tree

11 files changed

+22
-27
lines changed

11 files changed

+22
-27
lines changed

sklearn/calibration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from .utils.validation import check_is_fitted
2323
from .isotonic import IsotonicRegression
2424
from .svm import LinearSVC
25-
from .cross_validation import _check_cv
25+
from .cross_validation import check_cv
2626
from .metrics.classification import _check_binary_probabilistic_predictions
2727

2828

@@ -141,7 +141,7 @@ def fit(self, X, y, sample_weight=None):
141141
calibrated_classifier.fit(X, y)
142142
self.calibrated_classifiers_.append(calibrated_classifier)
143143
else:
144-
cv = _check_cv(self.cv, X, y, classifier=True)
144+
cv = check_cv(self.cv, X, y, classifier=True)
145145
arg_names = inspect.getargspec(base_estimator.fit)[0]
146146
estimator_name = type(base_estimator).__name__
147147
if (sample_weight is not None

sklearn/covariance/graph_lasso_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from ..utils.validation import check_random_state, check_array
2222
from ..linear_model import lars_path
2323
from ..linear_model import cd_fast
24-
from ..cross_validation import _check_cv as check_cv, cross_val_score
24+
from ..cross_validation import check_cv, cross_val_score
2525
from ..externals.joblib import Parallel, delayed
2626
import collections
2727

sklearn/cross_validation.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,7 +1033,7 @@ def cross_val_predict(estimator, X, y=None, cv=None, n_jobs=1,
10331033
"""
10341034
X, y = indexable(X, y)
10351035

1036-
cv = _check_cv(cv, X, y, classifier=is_classifier(estimator))
1036+
cv = check_cv(cv, X, y, classifier=is_classifier(estimator))
10371037
# We clone the estimator to make sure that all the folds are
10381038
# independent, and that it is pickle-able.
10391039
parallel = Parallel(n_jobs=n_jobs, verbose=verbose,
@@ -1191,7 +1191,7 @@ def cross_val_score(estimator, X, y=None, scoring=None, cv=None, n_jobs=1,
11911191
"""
11921192
X, y = indexable(X, y)
11931193

1194-
cv = _check_cv(cv, X, y, classifier=is_classifier(estimator))
1194+
cv = check_cv(cv, X, y, classifier=is_classifier(estimator))
11951195
scorer = check_scoring(estimator, scoring=scoring)
11961196
# We clone the estimator to make sure that all the folds are
11971197
# independent, and that it is pickle-able.
@@ -1428,11 +1428,6 @@ def check_cv(cv, X=None, y=None, classifier=False):
14281428
The return value is guaranteed to be a cv generator instance, whatever
14291429
the input type.
14301430
"""
1431-
return _check_cv(cv, X=X, y=y, classifier=classifier)
1432-
1433-
1434-
def _check_cv(cv, X=None, y=None, classifier=False):
1435-
# This exists for internal use while indices is being deprecated.
14361431
is_sparse = sp.issparse(X)
14371432
if cv is None:
14381433
cv = 3
@@ -1523,7 +1518,7 @@ def permutation_test_score(estimator, X, y, cv=None,
15231518
15241519
"""
15251520
X, y = indexable(X, y)
1526-
cv = _check_cv(cv, X, y, classifier=is_classifier(estimator))
1521+
cv = check_cv(cv, X, y, classifier=is_classifier(estimator))
15271522
scorer = check_scoring(estimator, scoring=scoring)
15281523
random_state = check_random_state(random_state)
15291524

sklearn/feature_selection/rfe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
from ..base import MetaEstimatorMixin
1515
from ..base import clone
1616
from ..base import is_classifier
17-
from ..cross_validation import _check_cv as check_cv
17+
from ..cross_validation import check_cv
1818
from ..cross_validation import _safe_split, _score
1919
from ..metrics.scorer import check_scoring
2020
from .base import SelectorMixin

sklearn/grid_search.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
from .base import BaseEstimator, is_classifier, clone
2323
from .base import MetaEstimatorMixin
24-
from .cross_validation import _check_cv as check_cv
24+
from .cross_validation import check_cv
2525
from .cross_validation import _fit_and_score
2626
from .externals.joblib import Parallel, delayed
2727
from .externals import six

sklearn/learning_curve.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import numpy as np
1010

1111
from .base import is_classifier, clone
12-
from .cross_validation import _check_cv
12+
from .cross_validation import check_cv
1313
from .externals.joblib import Parallel, delayed
1414
from .cross_validation import _safe_split, _score, _fit_and_score
1515
from .metrics.scorer import check_scoring
@@ -108,7 +108,7 @@ def learning_curve(estimator, X, y, train_sizes=np.linspace(0.1, 1.0, 5),
108108

109109
X, y = indexable(X, y)
110110
# Make a list since we will be iterating multiple times over the folds
111-
cv = list(_check_cv(cv, X, y, classifier=is_classifier(estimator)))
111+
cv = list(check_cv(cv, X, y, classifier=is_classifier(estimator)))
112112
scorer = check_scoring(estimator, scoring=scoring)
113113

114114
# HACK as long as boolean indices are allowed in cv generators
@@ -297,7 +297,7 @@ def validation_curve(estimator, X, y, param_name, param_range, cv=None,
297297
<example_model_selection_plot_validation_curve.py>`
298298
"""
299299
X, y = indexable(X, y)
300-
cv = _check_cv(cv, X, y, classifier=is_classifier(estimator))
300+
cv = check_cv(cv, X, y, classifier=is_classifier(estimator))
301301
scorer = check_scoring(estimator, scoring=scoring)
302302

303303
parallel = Parallel(n_jobs=n_jobs, pre_dispatch=pre_dispatch,

sklearn/linear_model/coordinate_descent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from .base import center_data, sparse_center_data
1818
from ..utils import check_array, check_X_y, deprecated
1919
from ..utils.validation import check_random_state
20-
from ..cross_validation import _check_cv as check_cv
20+
from ..cross_validation import check_cv
2121
from ..externals.joblib import Parallel, delayed
2222
from ..externals import six
2323
from ..externals.six.moves import xrange

sklearn/linear_model/least_angle.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from .base import LinearModel
2323
from ..base import RegressorMixin
2424
from ..utils import arrayfuncs, as_float_array, check_X_y
25-
from ..cross_validation import _check_cv as check_cv
25+
from ..cross_validation import check_cv
2626
from ..utils import ConvergenceWarning
2727
from ..externals.joblib import Parallel, delayed
2828
from ..externals.six.moves import xrange

sklearn/linear_model/logistic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
check_X_y)
2929
from ..utils.fixes import expit
3030
from ..externals.joblib import Parallel, delayed
31-
from ..cross_validation import _check_cv
31+
from ..cross_validation import check_cv
3232
from ..externals import six
3333
from ..metrics import SCORERS
3434

@@ -1345,7 +1345,7 @@ def fit(self, X, y):
13451345
check_consistent_length(X, y)
13461346

13471347
# init cross-validation generator
1348-
cv = _check_cv(self.cv, X, y, classifier=True)
1348+
cv = check_cv(self.cv, X, y, classifier=True)
13491349
folds = list(cv)
13501350

13511351
self._enc = LabelEncoder()

sklearn/linear_model/omp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from .base import LinearModel, _pre_fit
1616
from ..base import RegressorMixin
1717
from ..utils import as_float_array, check_array, check_X_y
18-
from ..cross_validation import _check_cv as check_cv
18+
from ..cross_validation import check_cv
1919
from ..externals.joblib import Parallel, delayed
2020

2121
import scipy

0 commit comments

Comments
 (0)