DocumentationClassesRegressorChain

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.

Python Reference

Constructors

new RegressorChain()

new RegressorChain(opts?): RegressorChain

Parameters

ParameterTypeDescription
opts?object-
opts.base_estimator?anyThe base estimator from which the regressor chain is built.
opts.cv?numberDetermines 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?numberIf 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?booleanIf true, chain progress is output as each model is completed.

Returns RegressorChain

Defined in generated/multioutput/RegressorChain.ts:25

Properties

PropertyTypeDefault valueDefined in
_isDisposedbooleanfalsegenerated/multioutput/RegressorChain.ts:23
_isInitializedbooleanfalsegenerated/multioutput/RegressorChain.ts:22
_pyPythonBridgeundefinedgenerated/multioutput/RegressorChain.ts:21
idstringundefinedgenerated/multioutput/RegressorChain.ts:18
optsanyundefinedgenerated/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

ParameterType
pythonBridgePythonBridge

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

ParameterTypeDescription
optsobject-
opts.fit_params?anyParameters passed to the fit method at each step of the regressor chain.
opts.X?ArrayLikeThe 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

ParameterTypeDescription
optsobject-
opts.routing?anyA 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

ParameterType
pyPythonBridge

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

ParameterTypeDescription
optsobject-
opts.X?ArrayLikeThe 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

ParameterTypeDescription
optsobject-
opts.sample_weight?ArrayLikeSample 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?ArrayLikeTrue 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

ParameterTypeDescription
optsobject-
opts.sample_weight?string | booleanMetadata routing for sample_weight parameter in score.

Returns Promise<any>

Defined in generated/multioutput/RegressorChain.ts:284