Documentation
Classes
ClassifierChain

ClassifierChain

A multi-label model that arranges binary classifiers 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 ClassifierChain(opts?: object): ClassifierChain;

Parameters

NameTypeDescription
opts?object-
opts.base_estimator?anyThe base estimator from which the classifier 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

ClassifierChain

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

Properties

_isDisposed

boolean = false

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

_isInitialized

boolean = false

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

_py

PythonBridge

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

id

string

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

opts

any

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

Accessors

classes_

A list of arrays of length len(estimators\_) containing the class labels for each estimator in the chain.

Signature

classes_(): Promise<any[]>;

Returns

Promise<any[]>

Defined in: generated/multioutput/ClassifierChain.ts:321 (opens in a new tab)

estimators_

A list of clones of base_estimator.

Signature

estimators_(): Promise<any[]>;

Returns

Promise<any[]>

Defined in: generated/multioutput/ClassifierChain.ts:346 (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/ClassifierChain.ts:421 (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/ClassifierChain.ts:396 (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/ClassifierChain.ts:371 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

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

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/multioutput/ClassifierChain.ts:61 (opens in a new tab)

Methods

decision_function()

Evaluate the decision_function of the models in the chain.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]The input data.

Returns

Promise<ArrayLike[]>

Defined in: generated/multioutput/ClassifierChain.ts:131 (opens in a new tab)

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/ClassifierChain.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.

Returns

Promise<any>

Defined in: generated/multioutput/ClassifierChain.ts:166 (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/ClassifierChain.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/ClassifierChain.ts:206 (opens in a new tab)

predict_proba()

Predict probability estimates.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeThe input data.

Returns

Promise<ArrayLike[]>

Defined in: generated/multioutput/ClassifierChain.ts:239 (opens in a new tab)

score()

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.

Signature

score(opts: object): Promise<number>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Test samples.
opts.sample_weight?ArrayLikeSample weights.
opts.y?ArrayLikeTrue labels for X.

Returns

Promise<number>

Defined in: generated/multioutput/ClassifierChain.ts:274 (opens in a new tab)