8000 MNT Deprecate SAMME.R algorithm from AdaBoostClassifier (#26830) · scikit-learn/scikit-learn@c634b8a · GitHub
[go: up one dir, main page]

Skip to content

Commit c634b8a

Browse files
MNT Deprecate SAMME.R algorithm from AdaBoostClassifier (#26830)
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
1 parent b7d80a0 commit c634b8a

File tree

10 files changed

+117
-198
lines changed

10 files changed

+117
-198
lines changed

benchmarks/bench_20newsgroups.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"extra_trees": ExtraTreesClassifier(max_features="sqrt", min_samples_split=10),
2222
"logistic_regression": LogisticRegression(),
2323
"naive_bayes": MultinomialNB(),
24-
"adaboost": AdaBoostClassifier(n_estimators=10),
24+
"adaboost": AdaBoostClassifier(n_estimators=10, algorithm="SAMME"),
2525
}
2626

2727

doc/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,9 @@
300300
"auto_examples/decomposition/plot_beta_divergence": (
301301
"auto_examples/applications/plot_topics_extraction_with_nmf_lda"
302302
),
303+
"auto_examples/ensemble/plot_adaboost_hastie_10_2": (
304+
"auto_examples/ensemble/plot_adaboost_multiclass"
305+
),
303306
}
304307
html_context["redirects"] = redirects
305308
for old_link in redirects:

doc/modules/ensemble.rst

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1570,15 +1570,15 @@ ever-increasing influence. Each subsequent weak learner is thereby forced to
15701570
concentrate on the examples that are missed by the previous ones in the sequence
15711571
[HTF]_.
15721572

1573-
.. figure:: ../auto_examples/ensemble/images/sphx_glr_plot_adaboost_hastie_10_2_001.png
1574-
:target: ../auto_examples/ensemble/plot_adaboost_hastie_10_2.html
1573+
.. figure:: ../auto_examples/ensemble/images/sphx_glr_plot_adaboost_multiclass_001.png
1574+
:target: ../auto_examples/ensemble/plot_adaboost_multiclass.html
15751575
:align: center
15761576
:scale: 75
15771577

15781578
AdaBoost can be used both for classification and regression problems:
15791579

15801580
- For multi-class classification, :class:`AdaBoostClassifier` implements
1581-
AdaBoost-SAMME and AdaBoost-SAMME.R [ZZRH2009]_.
1581+
AdaBoost.SAMME [ZZRH2009]_.
15821582

15831583
- For regression, :class:`AdaBoostRegressor` implements AdaBoost.R2 [D1997]_.
15841584

@@ -1593,7 +1593,7 @@ learners::
15931593
>>> from sklearn.ensemble import AdaBoostClassifier
15941594

15951595
>>> X, y = load_iris(return_X_y=True)
1596-
>>> clf = AdaBoostClassifier(n_estimators=100)
1596+
>>> clf = AdaBoostClassifier(n_estimators=100, algorithm="SAMME",)
15971597
>>> scores = cross_val_score(clf, X, y, cv=5)
15981598
>>> scores.mean()
15991599
0.9...
@@ -1608,12 +1608,8 @@ minimum required number of samples to consider a split ``min_samples_split``).
16081608

16091609
.. topic:: Examples:
16101610

1611-
* :ref:`sphx_glr_auto_examples_ensemble_plot_adaboost_hastie_10_2.py` compares the
1612-
classification error of a decision stump, decision tree, and a boosted
1613-
decision stump using AdaBoost-SAMME and AdaBoost-SAMME.R.
1614-
16151611
* :ref:`sphx_glr_auto_examples_ensemble_plot_adaboost_multiclass.py` shows the performance
1616-
of AdaBoost-SAMME and AdaBoost-SAMME.R on a multi-class problem.
1612+
of AdaBoost on a multi-class problem.
16171613

16181614
* :ref:`sphx_glr_auto_examples_ensemble_plot_adaboost_twoclass.py` shows the decision boundary
16191615
and decision function values for a non-linearly separable two-class problem
@@ -1634,4 +1630,3 @@ minimum required number of samples to consider a split ``min_samples_split``).
16341630
16351631
.. [HTF] T. Hastie, R. Tibshirani and J. Friedman, "Elements of
16361632
Statistical Learning Ed. 2", Springer, 2009.
1637-

doc/whats_new/v1.4.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,10 @@ Changelog
150150
:pr:`13649` by :user:`Samuel Ronsin <samronsin>`,
151151
initiated by :user:`Patrick O'Reilly <pat-oreilly>`.
152152

153+
- |API| In :class:`AdaBoostClassifier`, the `algorithm` argument `SAMME.R` was
154+
deprecated and will be removed in 1.6. :pr:`26830` by :user:`Stefanie Senger
155+
<StefanieSenger>`.
156+
153157
- |Efficiency| :class:`ensemble.GradientBoostingClassifier` is faster,
154158
for binary and in particular for multiclass problems thanks to the private loss
155159
function module.

examples/classification/plot_classifier_comparison.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
max_depth=5, n_estimators=10, max_features=1, random_state=42
6767
),
6868
MLPClassifier(alpha=1, max_iter=1000, random_state=42),
69-
AdaBoostClassifier(random_state=42),
69+
AdaBoostClassifier(algorithm="SAMME", random_state=42),
7070
GaussianNB(),
7171
QuadraticDiscriminantAnalysis(),
7272
]

examples/ensemble/plot_adaboost_hastie_10_2.py

Lines changed: 0 additions & 172 deletions
This file was deleted.

examples/ensemble/plot_forest_iris.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,11 @@
7171
DecisionTreeClassifier(max_depth=None),
7272
RandomForestClassifier(n_estimators=n_estimators),
7373
ExtraTreesClassifier(n_estimators=n_estimators),
74-
AdaBoostClassifier(DecisionTreeClassifier(max_depth=3), n_estimators=n_estimators),
74+
AdaBoostClassifier(
75+
DecisionTreeClassifier(max_depth=3),
76+
n_estimators=n_estimators,
77+
algorithm="SAMME",
78+
),
7579
]
7680

7781
for pair in ([0, 1], [0, 2], [2, 3]):

0 commit comments

Comments
 (0)
0