8000 fix travis · scikit-learn/scikit-learn@3d759a4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3d759a4

Browse files
committed
fix travis
1 parent 317e30a commit 3d759a4

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines change 8000 d

sklearn/ensemble/iforest.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,8 @@ def fit(self, X, y=None, sample_weight=None):
151151
# ensure that max_sample is in [1, n_samples]:
152152
n_samples = X.shape[0]
153153
if not (self.max_samples <= n_samples):
154-
warn("max_samples is larger than the total number of samples"
155-
" n_samples. Corrected as max_samples=n_samples")
156-
self.max_samples = n_samples
154+
raise ValueError("max_samples (default=256) is greater than the total"
155+
" number of samples")
157156
if not (0 < self.max_samples):
158157
raise ValueError("max_samples has to be positive")
159158

sklearn/ensemble/tests/test_iforest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ def test_iforest_error():
9595
IsolationForest(max_samples=0.0).fit, X)
9696
assert_raises(ValueError,
9797
IsolationForest(max_samples=2.0).fit, X)
98-
assert_warns(UserWarning,
98+
assert_raises(ValueError,
9999
IsolationForest(max_samples=1000).fit, X)
100100
# cannot check for string values
101101

@@ -133,7 +133,8 @@ def test_iforest_gridsearch():
133133
# Grid search with scoring based on decision_function
134134
parameters = {'n_estimators': (1, 2, 100)}
135135

136-
grid_search = GridSearchCV(IsolationForest(max_samples=0.1),
136+
grid_search = GridSearchCV(IsolationForest(random_state=0,
137+
max_samples=0.1),
137138
parameters,
138139
scoring="roc_auc").fit(X, y)
139140
best_score = grid_search.best_score_

0 commit comments

Comments
 (0)
2A6D
0