Documentation
Classes
MaxAbsScaler

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 linearily scales them down. For an example visualization, refer to Compare MaxAbsScaler with other scalers.

Python Reference (opens in a new tab)

Constructors

constructor()

Signature

new MaxAbsScaler(opts?: object): MaxAbsScaler;

Parameters

NameTypeDescription
opts?object-
opts.copy?booleanSet to false to perform inplace scaling and avoid a copy (if the input is already a numpy array). Default Value true

Returns

MaxAbsScaler

Defined in: generated/preprocessing/MaxAbsScaler.ts:27 (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/MaxAbsScaler.ts:92 (opens in a new tab)

fit()

Compute the maximum absolute value to be used for later scaling.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeThe data used to compute the per-feature minimum and maximum used for later scaling along the features axis.
opts.y?anyIgnored.

Returns

Promise<any>

Defined in: generated/preprocessing/MaxAbsScaler.ts:109 (opens in a new tab)

fit_transform()

Fit to data, then transform it.

Fits transformer to X and y with optional parameters fit\_params and returns a transformed version of X.

Signature

fit_transform(opts: object): Promise<any[]>;

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLike[]Input samples.
opts.fit_params?anyAdditional fit parameters.
opts.y?ArrayLikeTarget values (undefined for unsupervised transformations).

Returns

Promise<any[]>

Defined in: generated/preprocessing/MaxAbsScaler.ts:149 (opens in a new tab)

get_feature_names_out()

Get output feature names for transformation.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.input_features?anyInput features.

Returns

Promise<any>

Defined in: generated/preprocessing/MaxAbsScaler.ts:196 (opens in a new tab)

get_metadata_routing()

Get metadata routing of this object.

Please check User Guide on how the routing mechanism works.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.routing?anyA MetadataRequest encapsulating routing information.

Returns

Promise<any>

Defined in: generated/preprocessing/MaxAbsScaler.ts:234 (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/MaxAbsScaler.ts:52 (opens in a new tab)

inverse_transform()

Scale back the data to the original representation.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeThe data that should be transformed back.

Returns

Promise<ArrayLike>

Defined in: generated/preprocessing/MaxAbsScaler.ts:269 (opens in a new tab)

partial_fit()

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.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeThe data used to compute the mean and standard deviation used for later scaling along the features axis.
opts.y?anyIgnored.

Returns

Promise<any>

Defined in: generated/preprocessing/MaxAbsScaler.ts:306 (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/MaxAbsScaler.ts:346 (opens in a new tab)

transform()

Scale the data.

Signature

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

Parameters

NameTypeDescription
optsobject-
opts.X?ArrayLikeThe data that should be scaled.

Returns

Promise<ArrayLike>

Defined in: generated/preprocessing/MaxAbsScaler.ts:379 (opens in a new tab)

Properties

_isDisposed

boolean = false

Defined in: generated/preprocessing/MaxAbsScaler.ts:25 (opens in a new tab)

_isInitialized

boolean = false

Defined in: generated/preprocessing/MaxAbsScaler.ts:24 (opens in a new tab)

_py

PythonBridge

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

id

string

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

opts

any

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

Accessors

feature_names_in_

Names of features seen during fit. Defined only when X has feature names that are all strings.

Signature

feature_names_in_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/preprocessing/MaxAbsScaler.ts:483 (opens in a new tab)

max_abs_

Per feature maximum absolute value.

Signature

max_abs_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/preprocessing/MaxAbsScaler.ts:435 (opens in a new tab)

n_features_in_

Number of features seen during fit.

Signature

n_features_in_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/preprocessing/MaxAbsScaler.ts:458 (opens in a new tab)

n_samples_seen_

The number of samples processed by the estimator. Will be reset on new calls to fit, but increments across partial\_fit calls.

Signature

n_samples_seen_(): Promise<number>;

Returns

Promise<number>

Defined in: generated/preprocessing/MaxAbsScaler.ts:508 (opens in a new tab)

py

Signature

py(): PythonBridge;

Returns

PythonBridge

Defined in: generated/preprocessing/MaxAbsScaler.ts:39 (opens in a new tab)

Signature

py(pythonBridge: PythonBridge): void;

Parameters

NameType
pythonBridgePythonBridge

Returns

void

Defined in: generated/preprocessing/MaxAbsScaler.ts:43 (opens in a new tab)

scale_

Per feature relative scaling of the data.

Signature

scale_(): Promise<ArrayLike>;

Returns

Promise<ArrayLike>

Defined in: generated/preprocessing/MaxAbsScaler.ts:412 (opens in a new tab)