8000 Rename '_split' to '_split_with_kernel' · scikit-learn/scikit-learn@33994f0 · GitHub
[go: up one dir, main page]

Skip to content

Commit 33994f0

Browse files
Rename '_split' to '_split_with_kernel'
1 parent f4aa5ca commit 33994f0

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

sklearn/cross_validation.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1178,8 +1178,8 @@ def fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters,
11781178

11791179
start_time = time.time()
11801180

1181-
X_train, y_train = _split(estimator, X, y, train)
1182-
X_test, y_test = _split(estimator, X, y, test, train)
1181+
X_train, y_train = _split_with_kernel(estimator, X, y, train)
1182+
X_test, y_test = _split_with_kernel(estimator, X, y, test, train)
11831183
if y_train is None:
11841184
estimator.fit(X_train, **fit_params)
11851185
else:
@@ -1203,7 +1203,7 @@ def fit_and_score(estimator, X, y, scorer, train, test, verbose, parameters,
12031203
return ret
12041204

12051205

1206-
def _split(estimator, X, y, indices, train_indices=None):
1206+
def _split_with_kernel(estimator, X, y, indices, train_indices=None):
12071207
"""Create subset of dataset."""
12081208
if hasattr(estimator, 'kernel') and callable(estimator.kernel):
12091209
# cannot compute the kernel values with custom function

sklearn/feature_selection/rfe.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
from ..base import clone
1414
from ..base import is_classifier
1515
from ..cross_validation import _check_cv as check_cv
16-
from ..cross_validation import _split, _score
16+
from ..cross_validation import _split_with_kernel, _score
1717
from .base import SelectorMixin
1818
from ..metrics.scorer import check_scoring
1919

@@ -332,8 +332,9 @@ def fit(self, X, y):
332332

333333
# Cross-validation
334334
for n, (train, test) in enumerate(cv):
335-
X_train, y_train = _split(self.estimator, X, y, train)
336-
X_test, y_test = _split(self.estimator, X, y, test, train)
335+
X_train, y_train = _split_with_kernel(self.estimator, X, y, train)
336+
X_test, y_test = _split_with_kernel(self.estimator, X, y, test,
337+
train)
337338

338339
# Compute a full ranking of the features
339340
ranking_ = rfe.fit(X_train, y_train).ranking_

sklearn/learning_curve.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from .cross_validation import _check_cv
1111
from .utils import check_arrays
1212
from .externals.joblib import Parallel, delayed
13-
from .cross_validation import _split, _score, fit_and_score
13+
from .cross_validation import _split_with_kernel, _score, fit_and_score
1414
from .metrics.scorer import check_scoring
1515

1616

@@ -205,10 +205,12 @@ def _incremental_fit_estimator(estimator, X, y, classes, train, test,
205205
train_scores, test_scores = [], []
206206
partitions = zip(train_sizes, np.split(train, train_sizes)[:-1])
207207
for n_train_samples, partial_train in partitions:
208-
X_train, y_train = _split(estimator, X, y, train[:n_train_samples])
209-
X_partial_train, y_partial_train = _split(estimator, X, y,
210-
partial_train)
211-
X_test, y_test = _split(estimator, X, y, test, train[:n_train_samples])
208+
X_train, y_train = _split_with_kernel(estimator, X, y,
209+
train[:n_train_samples])
210+
X_partial_train, y_partial_train = _split_with_kernel(estimator, X, y,
211+
partial_train)
212+
X_test, y_test = _split_with_kernel(estimator, X, y, test,
213+
train[:n_train_samples])
212214
if y_partial_train is None:
213215
estimator.partial_fit(X_partial_train, classes=classes)
214216
else:

0 commit comments

Comments
 (0)
0