Documentation
Classes
RegressorChain

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 (opens in a new tab)

Constructors

constructor()

Signature

new RegressorChain(opts?: object): RegressorChain;

Parameters

NameTypeDescription
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. Default Value false

Returns

RegressorChain

Defined in: generated/multioutput/RegressorChain.ts:25 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/multioutput/RegressorChain.ts:23 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/multioutput/RegressorChain.ts:22 (opens in a new tab)

_py

PythonBridge

Defined in: generated/multioutput/RegressorChain.ts:21 (opens in a new tab)

id

string

Defined in: generated/multioutput/RegressorChain.ts:18 (opens in a new tab)

opts

any

Defined in: generated/multioutput/RegressorChain.ts:19 (opens in a new tab)

Accessors

estimators_

A list of clones of base_estimator.

Signature

estimators_(): Promise<any[]>;

Returns

Promise<any[]>

Defined in: generated/multioutput/RegressorChain.ts:260 (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/multioutput/RegressorChain.ts:333 (opens in a new tab)

n_features_in_

Number of features seen during fit. Only defined if the underlying base\_estimator exposes such an attribute when fit.

Signature

n_features_in_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/multioutput/RegressorChain.ts:308 (opens in a new tab)

order_

The order of labels in the classifier chain.

Signature

order_(): Promise<any[]>;

Returns

Promise<any[]>

Defined in: generated/multioutput/RegressorChain.ts:285 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/multioutput/RegressorChain.ts:57 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/multioutput/RegressorChain.ts:61 (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/multioutput/RegressorChain.ts:114 (opens in a new tab)

fit()

Fit the model to data matrix X and targets Y.

Signature

fit(opts: object): Promise<any>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeThe input data.
opts.Y?ArrayLike[]The target values.
opts.fit_params?anyParameters passed to the fit method at each step of the regressor chain.

Returns

Promise<any>

Defined in: generated/multioutput/RegressorChain.ts:131 (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

NameType
pyPythonBridge

Returns

Promise<void>

Defined in: generated/multioutput/RegressorChain.ts:70 (opens in a new tab)

predict()

Predict on the data matrix X using the ClassifierChain model.

Signature

predict(opts: object): Promise<ArrayLike[]>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeThe input data.

Returns

Promise<ArrayLike[]>

Defined in: generated/multioutput/RegressorChain.ts:178 (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

NameTypeDescription
optsobject-
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?ArrayLikeSample weights.
opts.y?ArrayLikeTrue values for X.

Returns

Promise<number>

Defined in: generated/multioutput/RegressorChain.ts:213 (opens in a new tab)