Class: RegressorChain
A multi-label model that arranges regressions into a chain.
Each model makes a prediction in the order specified by the chain using all of the available features provided to the model plus the predictions of models that are earlier in the chain.
Read more in the User Guide.
Constructors
new RegressorChain()
new RegressorChain(
opts
?):RegressorChain
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.base_estimator ? | any | The base estimator from which the regressor chain is built. |
opts.cv ? | number | Determines whether to use cross validated predictions or true labels for the results of previous estimators in the chain. Possible inputs for cv are: |
opts.order ? | ArrayLike | "random" | If undefined , the order will be determined by the order of columns in the label matrix Y.: |
opts.random_state ? | number | If order='random' , determines random number generation for the chain order. In addition, it controls the random seed given at each base_estimator at each chaining iteration. Thus, it is only used when base_estimator exposes a random_state . Pass an int for reproducible output across multiple function calls. See Glossary. |
opts.verbose ? | boolean | If true , chain progress is output as each model is completed. |
Returns RegressorChain
Defined in generated/multioutput/RegressorChain.ts:25
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/multioutput/RegressorChain.ts:23 |
_isInitialized | boolean | false | generated/multioutput/RegressorChain.ts:22 |
_py | PythonBridge | undefined | generated/multioutput/RegressorChain.ts:21 |
id | string | undefined | generated/multioutput/RegressorChain.ts:18 |
opts | any | undefined | generated/multioutput/RegressorChain.ts:19 |
Accessors
estimators_
Get Signature
get estimators_():
Promise
<any
[]>
A list of clones of base_estimator.
Returns Promise
<any
[]>
Defined in generated/multioutput/RegressorChain.ts:318
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/multioutput/RegressorChain.ts:391
n_features_in_
Get Signature
get n_features_in_():
Promise
<number
>
Number of features seen during fit. Only defined if the underlying base_estimator
exposes such an attribute when fit.
Returns Promise
<number
>
Defined in generated/multioutput/RegressorChain.ts:366
order_
Get Signature
get order_():
Promise
<any
[]>
The order of labels in the classifier chain.
Returns Promise
<any
[]>
Defined in generated/multioutput/RegressorChain.ts:343
py
Get Signature
get py():
PythonBridge
Returns PythonBridge
Set Signature
set py(
pythonBridge
):void
Parameters
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
Returns void
Defined in generated/multioutput/RegressorChain.ts:57
Methods
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/multioutput/RegressorChain.ts:109
fit()
fit(
opts
):Promise
<any
>
Fit the model to data matrix X and targets Y.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.fit_params ? | any | Parameters passed to the fit method at each step of the regressor chain. |
opts.X ? | ArrayLike | The input data. |
opts.Y ? | ArrayLike [] | The target values. |
Returns Promise
<any
>
Defined in generated/multioutput/RegressorChain.ts:126
get_metadata_routing()
get_metadata_routing(
opts
):Promise
<any
>
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.routing ? | any | A MetadataRouter encapsulating routing information. |
Returns Promise
<any
>
Defined in generated/multioutput/RegressorChain.ts:170
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/multioutput/RegressorChain.ts:70
predict()
predict(
opts
):Promise
<ArrayLike
[]>
Predict on the data matrix X using the ClassifierChain model.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | ArrayLike | The input data. |
Returns Promise
<ArrayLike
[]>
Defined in generated/multioutput/RegressorChain.ts:204
score()
score(
opts
):Promise
<number
>
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.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.sample_weight ? | ArrayLike | Sample weights. |
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.y ? | ArrayLike | True values for X . |
Returns Promise
<number
>
Defined in generated/multioutput/RegressorChain.ts:238
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/multioutput/RegressorChain.ts:284