AdaBoostClassifier
An AdaBoost classifier.
An AdaBoost [1] classifier is a meta-estimator that begins by fitting a classifier on the original dataset and then fits additional copies of the classifier on the same dataset but where the weights of incorrectly classified instances are adjusted such that subsequent classifiers focus more on difficult cases.
This class implements the algorithm known as AdaBoost-SAMME [2].
Read more in the User Guide.
Python Reference (opens in a new tab)
Constructors
constructor()
Signature
new AdaBoostClassifier(opts?: object): AdaBoostClassifier;
Parameters
Name | Type | Description |
---|---|---|
opts? | object | - |
opts.algorithm? | "SAMME" | "SAMME.R" | If ‘SAMME.R’ then use the SAMME.R real boosting algorithm. estimator must support calculation of class probabilities. If ‘SAMME’ then use the SAMME discrete boosting algorithm. The SAMME.R algorithm typically converges faster than SAMME, achieving a lower test error with fewer boosting iterations. Default Value 'SAMME.R' |
opts.base_estimator? | any | The base estimator from which the boosted ensemble is built. Support for sample weighting is required, as well as proper classes\_ and n\_classes\_ attributes. If undefined , then the base estimator is DecisionTreeClassifier initialized with max\_depth=1 . |
opts.estimator? | any | The base estimator from which the boosted ensemble is built. Support for sample weighting is required, as well as proper classes\_ and n\_classes\_ attributes. If undefined , then the base estimator is DecisionTreeClassifier initialized with max\_depth=1 . |
opts.learning_rate? | number | Weight applied to each classifier at each boosting iteration. A higher learning rate increases the contribution of each classifier. There is a trade-off between the learning\_rate and n\_estimators parameters. Values must be in the range (0.0, inf) . Default Value 1 |
opts.n_estimators? | number | The maximum number of estimators at which boosting is terminated. In case of perfect fit, the learning procedure is stopped early. Values must be in the range \1, inf) . Default Value 50 |
opts.random_state? | number | Controls the random seed given at each estimator at each boosting iteration. Thus, it is only used when estimator exposes a random\_state . Pass an int for reproducible output across multiple function calls. See [Glossary. |
Returns
Defined in: generated/ensemble/AdaBoostClassifier.ts:27 (opens in a new tab)
Properties
_isDisposed
boolean
=false
Defined in: generated/ensemble/AdaBoostClassifier.ts:25 (opens in a new tab)
_isInitialized
boolean
=false
Defined in: generated/ensemble/AdaBoostClassifier.ts:24 (opens in a new tab)
_py
PythonBridge
Defined in: generated/ensemble/AdaBoostClassifier.ts:23 (opens in a new tab)
id
string
Defined in: generated/ensemble/AdaBoostClassifier.ts:20 (opens in a new tab)
opts
any
Defined in: generated/ensemble/AdaBoostClassifier.ts:21 (opens in a new tab)
Accessors
classes_
The classes labels.
Signature
classes_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:632 (opens in a new tab)
estimator_
The base estimator from which the ensemble is grown.
Signature
estimator_(): Promise<any>;
Returns
Promise
<any
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:578 (opens in a new tab)
estimator_errors_
Classification error for each estimator in the boosted ensemble.
Signature
estimator_errors_(): Promise<any>;
Returns
Promise
<any
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:713 (opens in a new tab)
estimator_weights_
Weights for each estimator in the boosted ensemble.
Signature
estimator_weights_(): Promise<any>;
Returns
Promise
<any
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:686 (opens in a new tab)
estimators_
The collection of fitted sub-estimators.
Signature
estimators_(): Promise<any>;
Returns
Promise
<any
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:605 (opens in a new tab)
feature_names_in_
Names of features seen during fit. Defined only when X
has feature names that are all strings.
Signature
feature_names_in_(): Promise<ArrayLike>;
Returns
Promise
<ArrayLike
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:767 (opens in a new tab)
n_classes_
The number of classes.
Signature
n_classes_(): Promise<number>;
Returns
Promise
<number
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:659 (opens in a new tab)
n_features_in_
Number of features seen during fit.
Signature
n_features_in_(): Promise<number>;
Returns
Promise
<number
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:740 (opens in a new tab)
py
Signature
py(): PythonBridge;
Returns
PythonBridge
Defined in: generated/ensemble/AdaBoostClassifier.ts:68 (opens in a new tab)
Signature
py(pythonBridge: PythonBridge): void;
Parameters
Name | Type |
---|---|
pythonBridge | PythonBridge |
Returns
void
Defined in: generated/ensemble/AdaBoostClassifier.ts:72 (opens in a new tab)
Methods
decision_function()
Compute the decision function of X
.
Signature
decision_function(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike | The training input samples. Sparse matrix can be CSC, CSR, COO, DOK, or LIL. COO, DOK, and LIL are converted to CSR. |
Returns
Promise
<any
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:148 (opens in a new tab)
dispose()
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
Signature
dispose(): Promise<void>;
Returns
Promise
<void
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:131 (opens in a new tab)
fit()
Build a boosted classifier/regressor from the training set (X, y).
Signature
fit(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike | The training input samples. Sparse matrix can be CSC, CSR, COO, DOK, or LIL. COO, DOK, and LIL are converted to CSR. |
opts.sample_weight? | ArrayLike | Sample weights. If undefined , the sample weights are initialized to 1 / n_samples. |
opts.y? | ArrayLike | The target values. |
Returns
Promise
<any
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:186 (opens in a new tab)
init()
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
Signature
init(py: PythonBridge): Promise<void>;
Parameters
Name | Type |
---|---|
py | PythonBridge |
Returns
Promise
<void
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:81 (opens in a new tab)
predict()
Predict classes for X.
The predicted class of an input sample is computed as the weighted mean prediction of the classifiers in the ensemble.
Signature
predict(opts: object): Promise<ArrayLike>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike | The training input samples. Sparse matrix can be CSC, CSR, COO, DOK, or LIL. COO, DOK, and LIL are converted to CSR. |
Returns
Promise
<ArrayLike
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:237 (opens in a new tab)
predict_log_proba()
Predict class log-probabilities for X.
The predicted class log-probabilities of an input sample is computed as the weighted mean predicted class log-probabilities of the classifiers in the ensemble.
Signature
predict_log_proba(opts: object): Promise<ArrayLike[]>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike | The training input samples. Sparse matrix can be CSC, CSR, COO, DOK, or LIL. COO, DOK, and LIL are converted to CSR. |
Returns
Promise
<ArrayLike
[]>
Defined in: generated/ensemble/AdaBoostClassifier.ts:274 (opens in a new tab)
predict_proba()
Predict class probabilities for X.
The predicted class probabilities of an input sample is computed as the weighted mean predicted class probabilities of the classifiers in the ensemble.
Signature
predict_proba(opts: object): Promise<ArrayLike[]>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike | The training input samples. Sparse matrix can be CSC, CSR, COO, DOK, or LIL. COO, DOK, and LIL are converted to CSR. |
Returns
Promise
<ArrayLike
[]>
Defined in: generated/ensemble/AdaBoostClassifier.ts:314 (opens in a new tab)
score()
Return the mean accuracy on the given test data and labels.
In multi-label classification, this is the subset accuracy which is a harsh metric since you require for each sample that each label set be correctly predicted.
Signature
score(opts: object): Promise<number>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike [] | Test samples. |
opts.sample_weight? | ArrayLike | Sample weights. |
opts.y? | ArrayLike | True labels for X . |
Returns
Promise
<number
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:353 (opens in a new tab)
staged_decision_function()
Compute decision function of X
for each boosting iteration.
This method allows monitoring (i.e. determine error on testing set) after each boosting iteration.
Signature
staged_decision_function(opts: object): Promise<any[]>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike | The training input samples. Sparse matrix can be CSC, CSR, COO, DOK, or LIL. COO, DOK, and LIL are converted to CSR. |
Returns
Promise
<any
[]>
Defined in: generated/ensemble/AdaBoostClassifier.ts:404 (opens in a new tab)
staged_predict()
Return staged predictions for X.
The predicted class of an input sample is computed as the weighted mean prediction of the classifiers in the ensemble.
This generator method yields the ensemble prediction after each iteration of boosting and therefore allows monitoring, such as to determine the prediction on a test set after each boost.
Signature
staged_predict(opts: object): Promise<any[]>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike [] | The input samples. Sparse matrix can be CSC, CSR, COO, DOK, or LIL. COO, DOK, and LIL are converted to CSR. |
Returns
Promise
<any
[]>
Defined in: generated/ensemble/AdaBoostClassifier.ts:446 (opens in a new tab)
staged_predict_proba()
Predict class probabilities for X.
The predicted class probabilities of an input sample is computed as the weighted mean predicted class probabilities of the classifiers in the ensemble.
This generator method yields the ensemble predicted class probabilities after each iteration of boosting and therefore allows monitoring, such as to determine the predicted class probabilities on a test set after each boost.
Signature
staged_predict_proba(opts: object): Promise<any[]>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike | The training input samples. Sparse matrix can be CSC, CSR, COO, DOK, or LIL. COO, DOK, and LIL are converted to CSR. |
Returns
Promise
<any
[]>
Defined in: generated/ensemble/AdaBoostClassifier.ts:487 (opens in a new tab)
staged_score()
Return staged scores for X, y.
This generator method yields the ensemble score after each iteration of boosting and therefore allows monitoring, such as to determine the score on a test set after each boost.
Signature
staged_score(opts: object): Promise<number>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike | The training input samples. Sparse matrix can be CSC, CSR, COO, DOK, or LIL. COO, DOK, and LIL are converted to CSR. |
opts.sample_weight? | ArrayLike | Sample weights. |
opts.y? | ArrayLike | Labels for X. |
Returns
Promise
<number
>
Defined in: generated/ensemble/AdaBoostClassifier.ts:527 (opens in a new tab)