AdaBoostRegressor
An AdaBoost regressor.
An AdaBoost [1] regressor is a meta-estimator that begins by fitting a regressor on the original dataset and then fits additional copies of the regressor on the same dataset but where the weights of instances are adjusted according to the error of the current prediction. As such, subsequent regressors focus more on difficult cases.
This class implements the algorithm known as AdaBoost.R2 [2].
Read more in the User Guide.
Python Reference (opens in a new tab)
Constructors
constructor()
Signature
new AdaBoostRegressor(opts?: object): AdaBoostRegressor;
Parameters
Name | Type | Description |
---|---|---|
opts? | object | - |
opts.base_estimator? | any | The base estimator from which the boosted ensemble is built. If undefined , then the base estimator is DecisionTreeRegressor initialized with max\_depth=3 . |
opts.estimator? | any | The base estimator from which the boosted ensemble is built. If undefined , then the base estimator is DecisionTreeRegressor initialized with max\_depth=3 . |
opts.learning_rate? | number | Weight applied to each regressor at each boosting iteration. A higher learning rate increases the contribution of each regressor. 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.loss? | "linear" | "square" | "exponential" | The loss function to use when updating the weights after each boosting iteration. Default Value 'linear' |
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 . In addition, it controls the bootstrap of the weights used to train the estimator at each boosting iteration. Pass an int for reproducible output across multiple function calls. See [Glossary. |
Returns
Defined in: generated/ensemble/AdaBoostRegressor.ts:27 (opens in a new tab)
Methods
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/AdaBoostRegressor.ts:129 (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/AdaBoostRegressor.ts:146 (opens in a new tab)
get_metadata_routing()
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
Signature
get_metadata_routing(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.routing? | any | A MetadataRequest encapsulating routing information. |
Returns
Promise
<any
>
Defined in: generated/ensemble/AdaBoostRegressor.ts:197 (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/AdaBoostRegressor.ts:81 (opens in a new tab)
predict()
Predict regression value for X.
The predicted regression value of an input sample is computed as the weighted median prediction of the regressors 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/AdaBoostRegressor.ts:237 (opens in a new tab)
score()
Return the coefficient of determination of the prediction.
The coefficient of determination \(R^2\) is defined as \((1 - \frac{u}{v})\), where \(u\) is the residual sum of squares ((y\_true \- y\_pred)\*\* 2).sum()
and \(v\) is the total sum of squares ((y\_true \- y\_true.mean()) \*\* 2).sum()
. The best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y
, disregarding the input features, would get a \(R^2\) score of 0.0.
Signature
score(opts: object): Promise<number>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.X? | ArrayLike [] | Test samples. For some estimators this may be a precomputed kernel matrix or a list of generic objects instead with shape (n\_samples, n\_samples\_fitted) , where n\_samples\_fitted is the number of samples used in the fitting for the estimator. |
opts.sample_weight? | ArrayLike | Sample weights. |
opts.y? | ArrayLike | True values for X . |
Returns
Promise
<number
>
Defined in: generated/ensemble/AdaBoostRegressor.ts:274 (opens in a new tab)
set_fit_request()
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:
Signature
set_fit_request(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.sample_weight? | string | boolean | Metadata routing for sample\_weight parameter in fit . |
Returns
Promise
<any
>
Defined in: generated/ensemble/AdaBoostRegressor.ts:327 (opens in a new tab)
set_score_request()
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:
Signature
set_score_request(opts: object): Promise<any>;
Parameters
Name | Type | Description |
---|---|---|
opts | object | - |
opts.sample_weight? | string | boolean | Metadata routing for sample\_weight parameter in score . |
Returns
Promise
<any
>
Defined in: generated/ensemble/AdaBoostRegressor.ts:369 (opens in a new tab)
staged_predict()
Return staged predictions for X.
The predicted regression value of an input sample is computed as the weighted median prediction of the regressors 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 training input samples. |
Returns
Promise
<any
[]>
Defined in: generated/ensemble/AdaBoostRegressor.ts:411 (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/AdaBoostRegressor.ts:450 (opens in a new tab)
Properties
_isDisposed
boolean
=false
Defined in: generated/ensemble/AdaBoostRegressor.ts:25 (opens in a new tab)
_isInitialized
boolean
=false
Defined in: generated/ensemble/AdaBoostRegressor.ts:24 (opens in a new tab)
_py
PythonBridge
Defined in: generated/ensemble/AdaBoostRegressor.ts:23 (opens in a new tab)
id
string
Defined in: generated/ensemble/AdaBoostRegressor.ts:20 (opens in a new tab)
opts
any
Defined in: generated/ensemble/AdaBoostRegressor.ts:21 (opens in a new tab)
Accessors
estimator_
The base estimator from which the ensemble is grown.
Signature
estimator_(): Promise<any>;
Returns
Promise
<any
>
Defined in: generated/ensemble/AdaBoostRegressor.ts:501 (opens in a new tab)
estimator_errors_
Regression error for each estimator in the boosted ensemble.
Signature
estimator_errors_(): Promise<any>;
Returns
Promise
<any
>
Defined in: generated/ensemble/AdaBoostRegressor.ts:582 (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/AdaBoostRegressor.ts:555 (opens in a new tab)
estimators_
The collection of fitted sub-estimators.
Signature
estimators_(): Promise<any>;
Returns
Promise
<any
>
Defined in: generated/ensemble/AdaBoostRegressor.ts:528 (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/AdaBoostRegressor.ts:636 (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/AdaBoostRegressor.ts:609 (opens in a new tab)
py
Signature
py(): PythonBridge;
Returns
PythonBridge
Defined in: generated/ensemble/AdaBoostRegressor.ts:68 (opens in a new tab)
Signature
py(pythonBridge: PythonBridge): void;
Parameters
Name | Type |
---|---|
pythonBridge | PythonBridge |
Returns
void
Defined in: generated/ensemble/AdaBoostRegressor.ts:72 (opens in a new tab)