Documentation
Classes
MultiLabelBinarizer

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

Constructors

constructor()

Signature

new MultiLabelBinarizer(opts?: object): MultiLabelBinarizer;

Parameters

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

Returns

MultiLabelBinarizer

Defined in: generated/preprocessing/MultiLabelBinarizer.ts:23 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/preprocessing/MultiLabelBinarizer.ts:21 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/preprocessing/MultiLabelBinarizer.ts:20 (opens in a new tab)

_py

PythonBridge

Defined in: generated/preprocessing/MultiLabelBinarizer.ts:19 (opens in a new tab)

id

string

Defined in: generated/preprocessing/MultiLabelBinarizer.ts:16 (opens in a new tab)

opts

any

Defined in: generated/preprocessing/MultiLabelBinarizer.ts:17 (opens in a new tab)

Accessors

classes_

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

Signature

classes_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/preprocessing/MultiLabelBinarizer.ts:300 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/preprocessing/MultiLabelBinarizer.ts:40 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/preprocessing/MultiLabelBinarizer.ts:44 (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/preprocessing/MultiLabelBinarizer.ts:99 (opens in a new tab)

fit()

Fit the label sets binarizer, storing classes_.

Signature

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

Parameters

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

fit_transform()

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

Signature

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

Parameters

NameTypeDescription
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:151 (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/preprocessing/MultiLabelBinarizer.ts:53 (opens in a new tab)

inverse_transform()

Transform the given indicator matrix into label sets.

Signature

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

Parameters

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

Returns

Promise<any>

Defined in: generated/preprocessing/MultiLabelBinarizer.ts:188 (opens in a new tab)

set_output()

Set output container.

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

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.transform?"default" | "pandas"Configure output of transform and fit\_transform.

Returns

Promise<any>

Defined in: generated/preprocessing/MultiLabelBinarizer.ts:228 (opens in a new tab)

transform()

Transform the given label sets.

Signature

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

Parameters

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