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.
Constructors
new MultiLabelBinarizer()
new MultiLabelBinarizer(
opts
?):MultiLabelBinarizer
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.classes ? | ArrayLike | Indicates an ordering for the class labels. All entries should be unique (cannot contain duplicate classes). |
opts.sparse_output ? | boolean | Set to true if output binary array is desired in CSR sparse format. |
Returns MultiLabelBinarizer
Defined in generated/preprocessing/MultiLabelBinarizer.ts:23
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/preprocessing/MultiLabelBinarizer.ts:21 |
_isInitialized | boolean | false | generated/preprocessing/MultiLabelBinarizer.ts:20 |
_py | PythonBridge | undefined | generated/preprocessing/MultiLabelBinarizer.ts:19 |
id | string | undefined | generated/preprocessing/MultiLabelBinarizer.ts:16 |
opts | any | undefined | generated/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
Parameter | Type |
---|---|
pythonBridge | PythonBridge |
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
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.y ? | any | A 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
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.y ? | any | A 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
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.routing ? | any | A 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
Parameter | Type |
---|---|
py | PythonBridge |
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
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.yt ? | ArrayLike | A 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
Parameter | Type | Description |
---|---|---|
opts | object | - |
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
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.y ? | any | A 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