Class: MaxAbsScaler
Scale each feature by its maximum absolute value.
This estimator scales and translates each feature individually such that the maximal absolute value of each feature in the training set will be 1.0. It does not shift/center the data, and thus does not destroy any sparsity.
This scaler can also be applied to sparse CSR or CSC matrices.
MaxAbsScaler
doesn’t reduce the effect of outliers; it only linearly scales them down. For an example visualization, refer to Compare MaxAbsScaler with other scalers.
Constructors
new MaxAbsScaler()
new MaxAbsScaler(
opts
?):MaxAbsScaler
Parameters
Parameter | Type | Description |
---|---|---|
opts ? | object | - |
opts.copy ? | boolean | Set to false to perform inplace scaling and avoid a copy (if the input is already a numpy array). |
Returns MaxAbsScaler
Defined in generated/preprocessing/MaxAbsScaler.ts:27
Properties
Property | Type | Default value | Defined in |
---|---|---|---|
_isDisposed | boolean | false | generated/preprocessing/MaxAbsScaler.ts:25 |
_isInitialized | boolean | false | generated/preprocessing/MaxAbsScaler.ts:24 |
_py | PythonBridge | undefined | generated/preprocessing/MaxAbsScaler.ts:23 |
id | string | undefined | generated/preprocessing/MaxAbsScaler.ts:20 |
opts | any | undefined | generated/preprocessing/MaxAbsScaler.ts:21 |
Accessors
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/MaxAbsScaler.ts:469
max_abs_
Get Signature
get max_abs_():
Promise
<ArrayLike
>
Per feature maximum absolute value.
Returns Promise
<ArrayLike
>
Defined in generated/preprocessing/MaxAbsScaler.ts:421
n_features_in_
Get Signature
get n_features_in_():
Promise
<number
>
Number of features seen during fit.
Returns Promise
<number
>
Defined in generated/preprocessing/MaxAbsScaler.ts:444
n_samples_seen_
Get Signature
get n_samples_seen_():
Promise
<number
>
The number of samples processed by the estimator. Will be reset on new calls to fit, but increments across partial_fit
calls.
Returns Promise
<number
>
Defined in generated/preprocessing/MaxAbsScaler.ts:494
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/MaxAbsScaler.ts:39
scale_
Get Signature
get scale_():
Promise
<ArrayLike
>
Per feature relative scaling of the data.
Returns Promise
<ArrayLike
>
Defined in generated/preprocessing/MaxAbsScaler.ts:398
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/MaxAbsScaler.ts:91
fit()
fit(
opts
):Promise
<any
>
Compute the maximum absolute value 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/MaxAbsScaler.ts:108
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/MaxAbsScaler.ts:147
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/MaxAbsScaler.ts:189
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/MaxAbsScaler.ts:225
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/MaxAbsScaler.ts:52
inverse_transform()
inverse_transform(
opts
):Promise
<ArrayLike
>
Scale back the data to the original representation.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | ArrayLike | The data that should be transformed back. |
Returns Promise
<ArrayLike
>
Defined in generated/preprocessing/MaxAbsScaler.ts:259
partial_fit()
partial_fit(
opts
):Promise
<any
>
Online computation of max absolute value of 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/MaxAbsScaler.ts:295
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/MaxAbsScaler.ts:334
transform()
transform(
opts
):Promise
<ArrayLike
>
Scale the data.
Parameters
Parameter | Type | Description |
---|---|---|
opts | object | - |
opts.X ? | ArrayLike | The data that should be scaled. |
Returns Promise
<ArrayLike
>
Defined in generated/preprocessing/MaxAbsScaler.ts:366