Class: 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 based on [2].
Read more in the User Guide.
Constructors
new AdaBoostClassifier()
new AdaBoostClassifier(
opts
?):AdaBoostClassifier
Parameters
Parameter | 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. |
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) . |
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) . |
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 AdaBoostClassifier
Defined in generated/ensemble/AdaBoostClassifier.ts:27
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/ensemble/AdaBoostClassifier.ts:25 |
_isInitialized | boolean | false | generated/ensemble/AdaBoostClassifier.ts:24 |
_py | PythonBridge | undefined | generated/ensemble/AdaBoostClassifier.ts:23 |
id | string | undefined | generated/ensemble/AdaBoostClassifier.ts:20 |
opts | any | undefined | generated/ensemble/AdaBoostClassifier.ts:21 |
Accessors
classes_
Get Signature
get classes_():
Promise
<ArrayLike
>
The classes labels.
Returns Promise
<ArrayLike
>
Defined in generated/ensemble/AdaBoostClassifier.ts:706
estimator_
Get Signature
get estimator_():
Promise
<any
>
The base estimator from which the ensemble is grown.
Returns Promise
<any
>
Defined in generated/ensemble/AdaBoostClassifier.ts:652
estimator_errors_
Get Signature
get estimator_errors_():
Promise
<any
>
Classification error for each estimator in the boosted ensemble.
Returns Promise
<any
>
Defined in generated/ensemble/AdaBoostClassifier.ts:787
estimator_weights_
Get Signature
get estimator_weights_():
Promise
<any
>
Weights for each estimator in the boosted ensemble.
Returns Promise
<any
>
Defined in generated/ensemble/AdaBoostClassifier.ts:760
estimators_
Get Signature
get estimators_():
Promise
<any
>
The collection of fitted sub-estimators.
Returns Promise
<any
>
Defined in generated/ensemble/AdaBoostClassifier.ts:679
feature_names_in_
Get Signature
get feature_names_in_():
Promise
<ArrayLike
>
Names of features seen during fit. Defined only when X
has feature names that are all strings.
Returns Promise
<ArrayLike
>
Defined in generated/ensemble/AdaBoostClassifier.ts:841
n_classes_
Get Signature
get n_classes_():
Promise
<number
>
The number of classes.
Returns Promise
<number
>
Defined in generated/ensemble/AdaBoostClassifier.ts:733
n_features_in_
Get Signature
get n_features_in_():
Promise
<number
>
Number of features seen during fit.
Returns Promise
<number
>
Defined in generated/ensemble/AdaBoostClassifier.ts:814
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge
):void
Parameters
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/ensemble/AdaBoostClassifier.ts:63
Methods
decision_function()
decision_function(
opts
):Promise
<any
>
Compute the decision function of X
.
Parameters
Parameter | 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:136
dispose()
dispose():
Promise
<void
>
Disposes of the underlying Python resources.
Once dispose()
is called, the instance is no longer usable.
Returns Promise
<void
>
Defined in generated/ensemble/AdaBoostClassifier.ts:119
fit()
fit(
opts
):Promise
<any
>
Build a boosted classifier/regressor from the training set (X, y).
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.sample_weight ? | ArrayLike | Sample weights. If undefined , the sample weights are initialized to 1 / n_samples. |
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.y ? | ArrayLike | The target values. |
Returns Promise
<any
>
Defined in generated/ensemble/AdaBoostClassifier.ts:172
get_metadata_routing()
get_metadata_routing(
opts
):Promise
<any
>
Raise NotImplementedError
.
This estimator does not support metadata routing yet.
Parameters
Parameter | Type |
---|---|
opts | object |
Returns Promise
<any
>
Defined in generated/ensemble/AdaBoostClassifier.ts:218
init()
init(
py
):Promise
<void
>
Initializes the underlying Python resources.
This instance is not usable until the Promise
returned by init()
resolves.
Parameters
Parameter | Type |
---|---|
py | PythonBridge |
Returns Promise
<void
>
Defined in generated/ensemble/AdaBoostClassifier.ts:76
predict()
predict(
opts
):Promise
<ArrayLike
>
Predict classes for X.
The predicted class of an input sample is computed as the weighted mean prediction of the classifiers in the ensemble.
Parameters
Parameter | 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:250
predict_log_proba()
predict_log_proba(
opts
):Promise
<ArrayLike
[]>
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.
Parameters
Parameter | 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:286
predict_proba()
predict_proba(
opts
):Promise
<ArrayLike
[]>
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.
Parameters
Parameter | 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:324
score()
score(
opts
):Promise
<number
>
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.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.sample_weight ? | ArrayLike | Sample weights. |
opts.X ? | ArrayLike [] | Test samples. |
opts.y ? | ArrayLike | True labels for X . |
Returns Promise
<number
>
Defined in generated/ensemble/AdaBoostClassifier.ts:362
set_fit_request()
set_fit_request(
opts
):Promise
<any
>
Request metadata passed to the fit
method.
Note that this method is only relevant if enable_metadata_routing=True
(see sklearn.set_config
). Please see User Guide on how the routing mechanism works.
The options for each parameter are:
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.sample_weight ? | string | boolean | Metadata routing for sample_weight parameter in fit . |
Returns Promise
<any
>
Defined in generated/ensemble/AdaBoostClassifier.ts:410
set_score_request()
set_score_request(
opts
):Promise
<any
>
Request metadata passed to the score
method.
Note that this method is only relevant if enable_metadata_routing=True
(see sklearn.set_config
). Please see User Guide on how the routing mechanism works.
The options for each parameter are:
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.sample_weight ? | string | boolean | Metadata routing for sample_weight parameter in score . |
Returns Promise
<any
>
Defined in generated/ensemble/AdaBoostClassifier.ts:450
staged_decision_function()
staged_decision_function(
opts
):Promise
<any
[]>
Compute decision function of X
for each boosting iteration.
This method allows monitoring (i.e. determine error on testing set) after each boosting iteration.
Parameters
Parameter | 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:488
staged_predict()
staged_predict(
opts
):Promise
<any
[]>
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.
Parameters
Parameter | 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:528
staged_predict_proba()
staged_predict_proba(
opts
):Promise
<any
[]>
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.
Parameters
Parameter | 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:568
staged_score()
staged_score(
opts
):Promise
<number
>
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.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.sample_weight ? | ArrayLike | Sample weights. |
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.y ? | ArrayLike | Labels for X. |
Returns Promise
<number
>
Defined in generated/ensemble/AdaBoostClassifier.ts:606