AdaboostClassifier
AdaBoost classifier — adaptive boosting with weighted decision stumps. / AdaBoost classifieur — boosting adaptatif avec stumps de décision pondérés.
import seraplot as sp
from sklearn.datasets import make_classification
X, y = make_classification(n_samples=500, n_features=8)
ada = sp.AdaBoostClassifier(n_estimators=50)
ada.fit(X, y)
print(ada.score(X, y))
sp.AdaboostClassifier has the same API as sklearn.FR — Remplacement direct : même API que sklearn, changez l'import.
API Reference
ml_adaboost_classifier — aliases: adaboost_classifier, ada_cls
sp.AdaboostClassifier(n_estimators=50, learning_rate=1.0, max_depth=1)
| Parameter | Type | Default | Description |
|---|---|---|---|
n_estimators | int | 50 | Number of weak learners. |
learning_rate | float | 1.0 | Shrinkage of each weak learner. |
max_depth | int | 1 | Depth of each base tree. |
JSON with predictions.
$$F(x) = \text{sign}\left(\sum_{m=1}^{M} \alpha_m h_m(x)\right)$$
import seraplot as sp
from sklearn.datasets import make_classification
X, y = make_classification(n_samples=500, n_features=8)
ada = sp.AdaBoostClassifier(n_estimators=50)
ada.fit(X, y)
print(ada.score(X, y))
Référence API
ml_adaboost_classifier — alias : adaboost_classifier, ada_cls
sp.AdaboostClassifier(n_estimators=50, learning_rate=1.0, max_depth=1)
| Paramètre | Type | Défaut | Description |
|---|---|---|---|
n_estimators | int | 50 | Nombre d'apprenants faibles. |
learning_rate | float | 1.0 | Shrinkage de chaque apprenant faible. |
max_depth | int | 1 | Profondeur de chaque arbre de base. |
JSON avec predictions.
$$F(x) = \text{sign}\left(\sum_{m=1}^{M} \alpha_m h_m(x)\right)$$
import seraplot as sp
from sklearn.datasets import make_classification
X, y = make_classification(n_samples=500, n_features=8)
ada = sp.AdaBoostClassifier(n_estimators=50)
ada.fit(X, y)
print(ada.score(X, y))
AdaboostRegressor
AdaBoost regressor — adaptive boosting with median-weighted aggregation. / AdaBoost régresseur — boosting adaptatif avec agrégation pondérée par la médiane.
import seraplot as sp, numpy as np
X = np.random.randn(400, 4)
y = X[:, 0] ** 2 + np.random.randn(400) * 0.3
ada = sp.AdaBoostRegressor(n_estimators=50, learning_rate=0.8)
ada.fit(X, y)
print(ada.score(X, y))
sp.AdaboostRegressor has the same API as sklearn.FR — Remplacement direct : même API que sklearn, changez l'import.
API Reference
ml_adaboost_regressor — aliases: adaboost_regressor, ada_reg
sp.AdaboostRegressor(n_estimators=50, learning_rate=1.0, max_depth=3)
| Parameter | Type | Default | Description |
|---|---|---|---|
n_estimators | int | 50 | Number of weak learners. |
learning_rate | float | 1.0 | Shrinkage of each weak learner. |
max_depth | int | 3 | Depth of each base tree. |
JSON with predictions.
$$\hat{y} = \text{weighted median}{h_m(x), w_m}_{m=1}^{M}$$
import seraplot as sp, numpy as np
X = np.random.randn(400, 4)
y = X[:, 0] ** 2 + np.random.randn(400) * 0.3
ada = sp.AdaBoostRegressor(n_estimators=50, learning_rate=0.8)
ada.fit(X, y)
print(ada.score(X, y))
Référence API
ml_adaboost_regressor — alias : adaboost_regressor, ada_reg
sp.AdaboostRegressor(n_estimators=50, learning_rate=1.0, max_depth=3)
| Paramètre | Type | Défaut | Description |
|---|---|---|---|
n_estimators | int | 50 | Nombre d'apprenants faibles. |
learning_rate | float | 1.0 | Shrinkage de chaque apprenant faible. |
max_depth | int | 3 | Profondeur de chaque arbre de base. |
JSON avec predictions.
$$\hat{y} = \text{médiane pondérée}{h_m(x), w_m}_{m=1}^{M}$$
import seraplot as sp, numpy as np
X = np.random.randn(400, 4)
y = X[:, 0] ** 2 + np.random.randn(400) * 0.3
ada = sp.AdaBoostRegressor(n_estimators=50, learning_rate=0.8)
ada.fit(X, y)
print(ada.score(X, y))