Class: MinMaxScaler
Transform features by scaling each feature to a given range.
This estimator scales and translates each feature individually such that it is in the given range on the training set, e.g. between zero and one.
The transformation is given by:
Constructors
new MinMaxScaler()
new MinMaxScaler(
opts
?):MinMaxScaler
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.clip ? | boolean | Set to true to clip transformed values of held-out data to provided feature range . |
opts.copy ? | boolean | Set to false to perform inplace row normalization and avoid a copy (if the input is already a numpy array). |
opts.feature_range ? | any | Desired range of transformed data. |
Returns MinMaxScaler
Defined in generated/preprocessing/MinMaxScaler.ts:25
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/preprocessing/MinMaxScaler.ts:23 |
_isInitialized | boolean | false | generated/preprocessing/MinMaxScaler.ts:22 |
_py | PythonBridge | undefined | generated/preprocessing/MinMaxScaler.ts:21 |
id | string | undefined | generated/preprocessing/MinMaxScaler.ts:18 |
opts | any | undefined | generated/preprocessing/MinMaxScaler.ts:19 |
Accessors
data_max_
Get Signature
get data_max_():
Promise
<ArrayLike
>
Per feature maximum seen in the data
Returns Promise
<ArrayLike
>
Defined in generated/preprocessing/MinMaxScaler.ts:479
data_min_
Get Signature
get data_min_():
Promise
<ArrayLike
>
Per feature minimum seen in the data
Returns Promise
<ArrayLike
>
Defined in generated/preprocessing/MinMaxScaler.ts:454
data_range_
Get Signature
get data_range_():
Promise
<ArrayLike
>
Per feature range (data_max_ \- data_min_)
seen in the data
Returns Promise
<ArrayLike
>
Defined in generated/preprocessing/MinMaxScaler.ts:504
feature_names_in_
Get Signature
get feature_names_in_():
Promise
<ArrayLike
>
Names of features seen during fit. Defined only when X
has feature names that are all strings.
Returns Promise
<ArrayLike
>
Defined in generated/preprocessing/MinMaxScaler.ts:579
min_
Get Signature
get min_():
Promise
<ArrayLike
>
Per feature adjustment for minimum. Equivalent to min \- X.min(axis=0) \* self.scale_
Returns Promise
<ArrayLike
>
Defined in generated/preprocessing/MinMaxScaler.ts:408
n_features_in_
Get Signature
get n_features_in_():
Promise
<number
>
Number of features seen during fit.
Returns Promise
<number
>
Defined in generated/preprocessing/MinMaxScaler.ts:529
n_samples_seen_
Get Signature
get n_samples_seen_():
Promise
<number
>
The number of samples processed by the estimator. It will be reset on new calls to fit, but increments across partial_fit
calls.
Returns Promise
<number
>
Defined in generated/preprocessing/MinMaxScaler.ts:554
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/MinMaxScaler.ts:49
scale_
Get Signature
get scale_():
Promise
<ArrayLike
>
Per feature relative scaling of the data. Equivalent to (max \- min) / (X.max(axis=0) \- X.min(axis=0))
Returns Promise
<ArrayLike
>
Defined in generated/preprocessing/MinMaxScaler.ts:431
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/MinMaxScaler.ts:101
fit()
fit(
opts
):Promise
<any
>
Compute the minimum and maximum to be used for later scaling.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | ArrayLike [] | The data used to compute the per-feature minimum and maximum used for later scaling along the features axis. |
opts.y ? | any | Ignored. |
Returns Promise
<any
>
Defined in generated/preprocessing/MinMaxScaler.ts:118
fit_transform()
fit_transform(
opts
):Promise
<any
[]>
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit_params
and returns a transformed version of X
.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.fit_params ? | any | Additional fit parameters. |
opts.X ? | ArrayLike [] | Input samples. |
opts.y ? | ArrayLike | Target values (undefined for unsupervised transformations). |
Returns Promise
<any
[]>
Defined in generated/preprocessing/MinMaxScaler.ts:157
get_feature_names_out()
get_feature_names_out(
opts
):Promise
<any
>
Get output feature names for transformation.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.input_features ? | any | Input features. |
Returns Promise
<any
>
Defined in generated/preprocessing/MinMaxScaler.ts:199
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/MinMaxScaler.ts:235
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/MinMaxScaler.ts:62
inverse_transform()
inverse_transform(
opts
):Promise
<ArrayLike
[]>
Undo the scaling of X according to feature_range.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | ArrayLike [] | Input data that will be transformed. It cannot be sparse. |
Returns Promise
<ArrayLike
[]>
Defined in generated/preprocessing/MinMaxScaler.ts:269
partial_fit()
partial_fit(
opts
):Promise
<any
>
Online computation of min and max on X for later scaling.
All of X is processed as a single batch. This is intended for cases when fit
is not feasible due to very large number of n_samples
or because X is read from a continuous stream.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | ArrayLike [] | The data used to compute the mean and standard deviation used for later scaling along the features axis. |
opts.y ? | any | Ignored. |
Returns Promise
<any
>
Defined in generated/preprocessing/MinMaxScaler.ts:305
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/MinMaxScaler.ts:344
transform()
transform(
opts
):Promise
<ArrayLike
[]>
Scale features of X according to feature_range.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | ArrayLike [] | Input data that will be transformed. |
Returns Promise
<ArrayLike
[]>
Defined in generated/preprocessing/MinMaxScaler.ts:376