Skip to content

Commit

Permalink
Merge pull request scikit-learn#25 from glouppe/adaboost
Browse files Browse the repository at this point in the history
Fix issues raised by reviewers
  • Loading branch information
ndawe committed Jan 23, 2013
2 parents f973c27 + 2497856 commit 7ed0063
Show file tree
Hide file tree
Showing 5 changed files with 96 additions and 86 deletions.
4 changes: 2 additions & 2 deletions examples/ensemble/plot_adaboost_hastie_10_2.py
Expand Up @@ -50,14 +50,14 @@
base_estimator=dt_stump,
learning_rate=learning_rate,
n_estimators=n_estimators,
real=False)
algorithm="SAMME")
ada_discrete.fit(X_train, y_train)

ada_real = AdaBoostClassifier(
base_estimator=dt_stump,
learning_rate=learning_rate,
n_estimators=n_estimators,
real=True)
algorithm="SAMME.R")
ada_real.fit(X_train, y_train)

fig = plt.figure()
Expand Down
6 changes: 3 additions & 3 deletions examples/ensemble/plot_adaboost_multiclass.py
Expand Up @@ -51,7 +51,7 @@
DecisionTreeClassifier(max_depth=2),
n_estimators=600,
learning_rate=1.5,
real=False)
algorithm="SAMME")

bdt_real.fit(X_train, y_train)
bdt_discrete.fit(X_train, y_train)
Expand Down Expand Up @@ -89,11 +89,11 @@
pl.xlim((-20, len(bdt_discrete) + 20))

pl.subplot(133)
pl.plot(n_trees, bdt_discrete.weights_, "b", label='SAMME')
pl.plot(n_trees, bdt_discrete.estimator_weights_, "b", label='SAMME')
pl.legend()
pl.ylabel('Weight')
pl.xlabel('Tree')
pl.ylim((0, bdt_discrete.weights_.max() * 1.2))
pl.ylim((0, bdt_discrete.estimator_weights_.max() * 1.2))
pl.xlim((-20, len(bdt_discrete) + 20))

# prevent overlapping y-axis labels
Expand Down
2 changes: 1 addition & 1 deletion examples/ensemble/plot_adaboost_twoclass.py
Expand Up @@ -26,7 +26,7 @@

bdt = AdaBoostClassifier(
DecisionTreeClassifier(max_depth=1),
real=False,
algorithm="SAMME",
n_estimators=50)

bdt.fit(X, y)
Expand Down
6 changes: 5 additions & 1 deletion sklearn/ensemble/tests/test_weight_boosting.py
Expand Up @@ -180,6 +180,10 @@ def test_error():
AdaBoostClassifier(learning_rate=-1).fit,
X, y)

assert_raises(ValueError,
AdaBoostClassifier(algorithm="foo").fit,
X, y)

assert_raises(TypeError,
AdaBoostClassifier(base_estimator=DummyRegressor()).fit,
X, y)
Expand All @@ -197,7 +201,7 @@ def test_base_estimator():
clf = AdaBoostClassifier(RandomForestClassifier())
clf.fit(X, y)

clf = AdaBoostClassifier(SVC(), real=False)
clf = AdaBoostClassifier(SVC(), algorithm="SAMME")
clf.fit(X, y)

from sklearn.ensemble import RandomForestRegressor
Expand Down

0 comments on commit 7ed0063

Please sign in to comment.