Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

AdaboostClassifier

Classifier sklearn-compatible 🌲 Tree-Based

AdaBoost classifier — adaptive boosting with weighted decision stumps. / AdaBoost classifieur — boosting adaptatif avec stumps de décision pondérés.

⚡ Rust-native ✓ sklearn parity
Quick start — Python
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))
💡
EN — Drop-in replacement: sp.AdaboostClassifier has the same API as sklearn.
FR — Remplacement direct : même API que sklearn, changez l'import.

API Reference

JSON function name

ml_adaboost_classifier — aliases: adaboost_classifier, ada_cls

Python class
sp.AdaboostClassifier(n_estimators=50, learning_rate=1.0, max_depth=1)
Constructor Parameters
ParameterTypeDefaultDescription
n_estimatorsint50Number of weak learners.
learning_ratefloat1.0Shrinkage of each weak learner.
max_depthint1Depth of each base tree.
Returns

JSON with predictions.

Algorithm

$$F(x) = \text{sign}\left(\sum_{m=1}^{M} \alpha_m h_m(x)\right)$$

Example
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

Nom de fonction JSON

ml_adaboost_classifier — alias : adaboost_classifier, ada_cls

Classe Python
sp.AdaboostClassifier(n_estimators=50, learning_rate=1.0, max_depth=1)
Paramètres du constructeur
ParamètreTypeDéfautDescription
n_estimatorsint50Nombre d'apprenants faibles.
learning_ratefloat1.0Shrinkage de chaque apprenant faible.
max_depthint1Profondeur de chaque arbre de base.
Retourne

JSON avec predictions.

Algorithme

$$F(x) = \text{sign}\left(\sum_{m=1}^{M} \alpha_m h_m(x)\right)$$

Exemple
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

Regressor sklearn-compatible 🌲 Tree-Based

AdaBoost regressor — adaptive boosting with median-weighted aggregation. / AdaBoost régresseur — boosting adaptatif avec agrégation pondérée par la médiane.

⚡ Rust-native ✓ sklearn parity
Quick start — Python
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))
💡
EN — Drop-in replacement: sp.AdaboostRegressor has the same API as sklearn.
FR — Remplacement direct : même API que sklearn, changez l'import.

API Reference

JSON function name

ml_adaboost_regressor — aliases: adaboost_regressor, ada_reg

Python class
sp.AdaboostRegressor(n_estimators=50, learning_rate=1.0, max_depth=3)
Constructor Parameters
ParameterTypeDefaultDescription
n_estimatorsint50Number of weak learners.
learning_ratefloat1.0Shrinkage of each weak learner.
max_depthint3Depth of each base tree.
Returns

JSON with predictions.

Algorithm

$$\hat{y} = \text{weighted median}{h_m(x), w_m}_{m=1}^{M}$$

Example
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

Nom de fonction JSON

ml_adaboost_regressor — alias : adaboost_regressor, ada_reg

Classe Python
sp.AdaboostRegressor(n_estimators=50, learning_rate=1.0, max_depth=3)
Paramètres du constructeur
ParamètreTypeDéfautDescription
n_estimatorsint50Nombre d'apprenants faibles.
learning_ratefloat1.0Shrinkage de chaque apprenant faible.
max_depthint3Profondeur de chaque arbre de base.
Retourne

JSON avec predictions.

Algorithme

$$\hat{y} = \text{médiane pondérée}{h_m(x), w_m}_{m=1}^{M}$$

Exemple
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))