Class: LabelEncoder
Encode target labels with value between 0 and n_classes-1.
This transformer should be used to encode target values, i.e. y
, and not the input X
.
Read more in the User Guide.
Constructors
new LabelEncoder()
new LabelEncoder(
opts
?):LabelEncoder
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.classes_ ? | ArrayLike | Holds the label for each class. |
Returns LabelEncoder
Defined in generated/preprocessing/LabelEncoder.ts:25
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/preprocessing/LabelEncoder.ts:23 |
_isInitialized | boolean | false | generated/preprocessing/LabelEncoder.ts:22 |
_py | PythonBridge | undefined | generated/preprocessing/LabelEncoder.ts:21 |
id | string | undefined | generated/preprocessing/LabelEncoder.ts:18 |
opts | any | undefined | generated/preprocessing/LabelEncoder.ts:19 |
Accessors
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/LabelEncoder.ts:35
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/LabelEncoder.ts:87
fit()
fit(
opts
):Promise
<any
>
Fit label encoder.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.y ? | ArrayLike | Target values. |
Returns Promise
<any
>
Defined in generated/preprocessing/LabelEncoder.ts:104
fit_transform()
fit_transform(
opts
):Promise
<ArrayLike
>
Fit label encoder and return encoded labels.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.y ? | ArrayLike | Target values. |
Returns Promise
<ArrayLike
>
Defined in generated/preprocessing/LabelEncoder.ts:136
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/LabelEncoder.ts:170
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/LabelEncoder.ts:48
inverse_transform()
inverse_transform(
opts
):Promise
<ArrayLike
>
Transform labels back to original encoding.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.y ? | ArrayLike | Target values. |
Returns Promise
<ArrayLike
>
Defined in generated/preprocessing/LabelEncoder.ts:204
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/LabelEncoder.ts:240
transform()
transform(
opts
):Promise
<ArrayLike
>
Transform labels to normalized encoding.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.y ? | ArrayLike | Target values. |
Returns Promise
<ArrayLike
>
Defined in generated/preprocessing/LabelEncoder.ts:272