Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
scikit-learn
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ian Johnson
scikit-learn
Commits
2c97793d
Commit
2c97793d
authored
12 years ago
by
Peter Prettenhofer
Browse files
Options
Downloads
Patches
Plain Diff
rm CV class tests
parent
e6f0b1d6
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
sklearn/ensemble/tests/test_gradient_boosting.py
+0
-51
0 additions, 51 deletions
sklearn/ensemble/tests/test_gradient_boosting.py
with
0 additions
and
51 deletions
sklearn/ensemble/tests/test_gradient_boosting.py
+
0
−
51
View file @
2c97793d
...
@@ -14,8 +14,6 @@ from sklearn.utils import check_random_state
...
@@ -14,8 +14,6 @@ from sklearn.utils import check_random_state
from
sklearn.ensemble
import
GradientBoostingClassifier
from
sklearn.ensemble
import
GradientBoostingClassifier
from
sklearn.ensemble
import
GradientBoostingRegressor
from
sklearn.ensemble
import
GradientBoostingRegressor
from
sklearn.ensemble
import
GradientBoostingClassifierCV
from
sklearn.ensemble
import
GradientBoostingRegressorCV
from
sklearn
import
datasets
from
sklearn
import
datasets
...
@@ -418,52 +416,3 @@ def test_mem_layout():
...
@@ -418,52 +416,3 @@ def test_mem_layout():
clf
.
fit
(
X
,
y_
)
clf
.
fit
(
X
,
y_
)
assert_array_equal
(
clf
.
predict
(
T
),
true_result
)
assert_array_equal
(
clf
.
predict
(
T
),
true_result
)
assert_equal
(
100
,
len
(
clf
.
estimators_
))
assert_equal
(
100
,
len
(
clf
.
estimators_
))
def
test_cv_attr
():
"""
Test attribute access for CV classes.
"""
clf
=
GradientBoostingClassifierCV
(
max_estimators
=
100
,
min_samples_leaf
=
3
)
clf
.
fit
(
X
,
y
)
assert
clf
.
min_samples_leaf
==
3
==
clf
.
_model
.
min_samples_leaf
clf
.
min_samples_leaf
=
2
assert
clf
.
min_samples_leaf
==
2
==
clf
.
_model
.
min_samples_leaf
def
test_cv_clf
():
"""
Test GradientBoostingClassifierCV n_estimators selection.
"""
X
,
y
=
datasets
.
make_hastie_10_2
(
n_samples
=
1000
,
random_state
=
1
)
max_estimators
=
50
clf
=
GradientBoostingClassifierCV
(
max_estimators
=
max_estimators
)
clf
.
fit
(
X
,
y
)
# max_estimators very small so it chooses all of them
assert
clf
.
n_estimators
==
max_estimators
clf_prime
=
GradientBoostingClassifier
(
n_estimators
=
max_estimators
).
fit
(
X
,
y
)
assert_array_equal
(
clf_prime
.
train_score_
,
clf
.
train_score_
)
assert
clf
.
cv_score_
.
shape
[
0
]
==
5
# default 5-fold CV
assert
clf
.
cv_score_
.
shape
[
1
]
==
max_estimators
def
test_cv_reg
():
"""
Test GradientBoostingRegressorCV n_estimators selection.
"""
X
,
y
=
datasets
.
make_friedman1
(
n_samples
=
1000
,
random_state
=
1
)
max_estimators
=
50
clf
=
GradientBoostingRegressorCV
(
max_estimators
=
max_estimators
)
clf
.
fit
(
X
,
y
)
# max_estimators very small so it chooses all of them
assert
clf
.
n_estimators
==
max_estimators
clf_prime
=
GradientBoostingRegressor
(
n_estimators
=
max_estimators
).
fit
(
X
,
y
)
assert_array_equal
(
clf_prime
.
train_score_
,
clf
.
train_score_
)
assert
clf
.
cv_score_
.
shape
[
0
]
==
5
# default 5-fold CV
assert
clf
.
cv_score_
.
shape
[
1
]
==
max_estimators
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment