DocumentationClassesMultiLabelBinarizer

Class: MultiLabelBinarizer

Transform between iterable of iterables and a multilabel format.

Although a list of sets or tuples is a very intuitive format for multilabel data, it is unwieldy to process. This transformer converts between this intuitive format and the supported multilabel format: a (samples x classes) binary matrix indicating the presence of a class label.

Python Reference

Constructors

new MultiLabelBinarizer()

new MultiLabelBinarizer(opts?): MultiLabelBinarizer

Parameters

ParameterTypeDescription
opts?object-
opts.classes?ArrayLikeIndicates an ordering for the class labels. All entries should be unique (cannot contain duplicate classes).
opts.sparse_output?booleanSet to true if output binary array is desired in CSR sparse format.

Returns MultiLabelBinarizer

Defined in generated/preprocessing/MultiLabelBinarizer.ts:23

Properties

PropertyTypeDefault valueDefined in
_isDisposedbooleanfalsegenerated/preprocessing/MultiLabelBinarizer.ts:21
_isInitializedbooleanfalsegenerated/preprocessing/MultiLabelBinarizer.ts:20
_pyPythonBridgeundefinedgenerated/preprocessing/MultiLabelBinarizer.ts:19
idstringundefinedgenerated/preprocessing/MultiLabelBinarizer.ts:16
optsanyundefinedgenerated/preprocessing/MultiLabelBinarizer.ts:17

Accessors

classes_

Get Signature

get classes_(): Promise<ArrayLike>

A copy of the classes parameter when provided. Otherwise it corresponds to the sorted set of classes found when fitting.

Returns Promise<ArrayLike>

Defined in generated/preprocessing/MultiLabelBinarizer.ts:329


py

Get Signature

get py(): PythonBridge

Returns PythonBridge

Set Signature

set py(pythonBridge): void

Parameters

ParameterType
pythonBridgePythonBridge

Returns void

Defined in generated/preprocessing/MultiLabelBinarizer.ts:40

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/preprocessing/MultiLabelBinarizer.ts:96


fit()

fit(opts): Promise<any>

Fit the label sets binarizer, storing classes_.

Parameters

ParameterTypeDescription
optsobject-
opts.y?anyA set of labels (any orderable and hashable object) for each sample. If the classes parameter is set, y will not be iterated.

Returns Promise<any>

Defined in generated/preprocessing/MultiLabelBinarizer.ts:113


fit_transform()

fit_transform(opts): Promise<ArrayLike>

Fit the label sets binarizer and transform the given label sets.

Parameters

ParameterTypeDescription
optsobject-
opts.y?anyA set of labels (any orderable and hashable object) for each sample. If the classes parameter is set, y will not be iterated.

Returns Promise<ArrayLike>

Defined in generated/preprocessing/MultiLabelBinarizer.ts:147


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 MetadataRequest encapsulating routing information.

Returns Promise<any>

Defined in generated/preprocessing/MultiLabelBinarizer.ts:185


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/preprocessing/MultiLabelBinarizer.ts:53


inverse_transform()

inverse_transform(opts): Promise<any>

Transform the given indicator matrix into label sets.

Parameters

ParameterTypeDescription
optsobject-
opts.yt?ArrayLikeA matrix containing only 1s ands 0s.

Returns Promise<any>

Defined in generated/preprocessing/MultiLabelBinarizer.ts:221


set_output()

set_output(opts): Promise<any>

Set output container.

See Introducing the set_output API for an example on how to use the API.

Parameters

ParameterTypeDescription
optsobject-
opts.transform?"default" | "pandas" | "polars"Configure output of transform and fit_transform.

Returns Promise<any>

Defined in generated/preprocessing/MultiLabelBinarizer.ts:259


transform()

transform(opts): Promise<any>

Transform the given label sets.

Parameters

ParameterTypeDescription
optsobject-
opts.y?anyA set of labels (any orderable and hashable object) for each sample. If the classes parameter is set, y will not be iterated.

Returns Promise<any>

Defined in generated/preprocessing/MultiLabelBinarizer.ts:295