Documentation
Classes
MultiOutputClassifier

MultiOutputClassifier

Multi target classification.

This strategy consists of fitting one classifier per target. This is a simple strategy for extending classifiers that do not natively support multi-target classification.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new MultiOutputClassifier(opts?: object): MultiOutputClassifier;

Parameters

NameTypeDescription
opts?object-
opts.estimator?anyAn estimator object implementing fit and predict. A predict_proba method will be exposed only if estimator implements it.
opts.n_jobs?numberThe number of jobs to run in parallel. fit, predict and partial\_fit (if supported by the passed estimator) will be parallelized for each target. When individual estimators are fast to train or predict, using n\_jobs > 1 can result in slower performance due to the parallelism overhead. undefined means 1 unless in a joblib.parallel\_backend (opens in a new tab) context. \-1 means using all available processes / threads. See Glossary for more details.

Returns

MultiOutputClassifier

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

Properties

_isDisposed

boolean = false

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

_isInitialized

boolean = false

Defined in: generated/multioutput/MultiOutputClassifier.ts:20 (opens in a new tab)

_py

PythonBridge

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

id

string

Defined in: generated/multioutput/MultiOutputClassifier.ts:16 (opens in a new tab)

opts

any

Defined in: generated/multioutput/MultiOutputClassifier.ts:17 (opens in a new tab)

Accessors

classes_

Class labels.

Signature

classes_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/multioutput/MultiOutputClassifier.ts:349 (opens in a new tab)

estimators_

Estimators used for predictions.

Signature

estimators_(): Promise<any>;

Returns

Promise<any>

Defined in: generated/multioutput/MultiOutputClassifier.ts:376 (opens in a new tab)

feature_names_in_

Names of features seen during fit. Only defined if the underlying estimators expose such an attribute when fit.

Signature

feature_names_in_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/multioutput/MultiOutputClassifier.ts:430 (opens in a new tab)

n_features_in_

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

Signature

n_features_in_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/multioutput/MultiOutputClassifier.ts:403 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/multioutput/MultiOutputClassifier.ts:42 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/multioutput/MultiOutputClassifier.ts:46 (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/MultiOutputClassifier.ts:99 (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 estimator.fit method of each step.
opts.sample_weight?ArrayLikeSample weights. If undefined, then samples are equally weighted. Only supported if the underlying classifier supports sample weights.

Returns

Promise<any>

Defined in: generated/multioutput/MultiOutputClassifier.ts:116 (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/MultiOutputClassifier.ts:55 (opens in a new tab)

partial_fit()

Incrementally fit a separate model for each class output.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeThe input data.
opts.classes?any[]Each array is unique classes for one output in str/int. Can be obtained via \[np.unique(y\[:, i\]) for i in range(y.shape\[1\])\], where y is the target matrix of the entire dataset. This argument is required for the first call to partial_fit and can be omitted in the subsequent calls. Note that y doesn’t need to contain all labels in classes.
opts.sample_weight?ArrayLikeSample weights. If undefined, then samples are equally weighted. Only supported if the underlying regressor supports sample weights.
opts.y?ArrayLikeMulti-output targets.

Returns

Promise<any>

Defined in: generated/multioutput/MultiOutputClassifier.ts:172 (opens in a new tab)

predict()

Predict multi-output variable using model for each target variable.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeThe input data.

Returns

Promise<ArrayLike>

Defined in: generated/multioutput/MultiOutputClassifier.ts:232 (opens in a new tab)

predict_proba()

Return prediction probabilities for each class of each output.

This method will raise a ValueError if any of the estimators do not have predict\_proba.

Signature

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

Parameters

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

Returns

Promise<any>

Defined in: generated/multioutput/MultiOutputClassifier.ts:269 (opens in a new tab)

score()

Return the mean accuracy on the given test data and labels.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Test samples.
opts.y?ArrayLike[]True values for X.

Returns

Promise<number>

Defined in: generated/multioutput/MultiOutputClassifier.ts:307 (opens in a new tab)