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.
Added in version 0.17.
Set to False to perform inplace scaling and avoid a copy (if the input is already a numpy array).
Per feature relative scaling of the data.
Added in version 0.17: scale_ attribute.
Per feature maximum absolute value.
Number of features seen during fit.
Added in version 0.24.
n_features_in_
,)
Names of features seen during fit. Defined only when X
has feature names that are all strings.
Added in version 1.0.
The number of samples processed by the estimator. Will be reset on new calls to fit, but increments across partial_fit
calls.
See also
maxabs_scale
Equivalent function without the estimator API.
Notes
NaNs are treated as missing values: disregarded in fit, and maintained in transform.
Examples
>>> from sklearn.preprocessing import MaxAbsScaler >>> X = [[ 1., -1., 2.], ... [ 2., 0., 0.], ... [ 0., 1., -1.]] >>> transformer = MaxAbsScaler().fit(X) >>> transformer MaxAbsScaler() >>> transformer.transform(X) array([[ 0.5, -1. , 1. ], [ 1. , 0. , 0. ], [ 0. , 1. , -0.5]])
Compute the maximum absolute value to be used for later scaling.
The data used to compute the per-feature minimum and maximum used for later scaling along the features axis.
Ignored.
Fitted scaler.
Fit to data, then transform it.
Fits transformer to X
and y
with optional parameters fit_params
and returns a transformed version of X
.
Input samples.
Target values (None for unsupervised transformations).
Additional fit parameters.
Transformed array.
Get output feature names for transformation.
Input features.
If input_features
is None
, then feature_names_in_
is used as feature names in. If feature_names_in_
is not defined, then the following input feature names are generated: ["x0", "x1", ..., "x(n_features_in_ - 1)"]
.
If input_features
is an array-like, then input_features
must match feature_names_in_
if feature_names_in_
is defined.
Same as input features.
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
A MetadataRequest
encapsulating routing information.
Get parameters for this estimator.
If True, will return the parameters for this estimator and contained subobjects that are estimators.
Parameter names mapped to their values.
Scale back the data to the original representation.
The data that should be transformed back.
Transformed array.
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.
The data used to compute the mean and standard deviation used for later scaling along the features axis.
Ignored.
Fitted scaler.
Set output container.
See Introducing the set_output API for an example on how to use the API.
Configure output of transform
and fit_transform
.
"default"
: Default output format of a transformer
"pandas"
: DataFrame output
"polars"
: Polars output
None
: Transform configuration is unchanged
Added in version 1.4: "polars"
option was added.
Estimator instance.
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as Pipeline
). The latter have parameters of the form <component>__<parameter>
so that it’s possible to update each component of a nested object.
Estimator parameters.
Estimator instance.
Scale the data.
The data that should be scaled.
Transformed array.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4