pyts.preprocessing.MinMaxScaler

class pyts.preprocessing.MinMaxScaler(sample_range=(0, 1))[source]

Transforms samples by scaling each sample to a given range.

Parameters:
sample_range : tuple (min, max) (default = (0, 1))

Desired range of transformed data.

Examples

>>> from pyts.preprocessing import MinMaxScaler
>>> X = [[1, 5, 3, 2, 9, 6, 4, 7],
...      [1, -2, 3, 2, 2, 1, 0, 2]]
>>> scaler = MinMaxScaler()
>>> scaler.transform(X)
array([[0.   , 0.5  , 0.25 , 0.125, 1.   , 0.625, 0.375, 0.75 ],
       [0.6  , 0.   , 1.   , 0.8  , 0.8  , 0.6  , 0.4  , 0.8  ]])

Methods

__init__([sample_range]) Initialize self.
fit([X, y]) Pass.
fit_transform(X[, y]) Fit to data, then transform it.
get_params([deep]) Get parameters for this estimator.
set_output(*[, transform]) Set output container.
set_params(**params) Set the parameters of this estimator.
transform(X) Scale samples of X according to sample_range.
__init__(sample_range=(0, 1))[source]

Initialize self. See help(type(self)) for accurate signature.

fit(X=None, y=None)[source]

Pass.

Parameters:
X

Ignored

y

Ignored

Returns:
self : object
fit_transform(X, y=None, **fit_params)

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:
X : array-like of shape (n_samples, n_features)

Input samples.

y : array-like of shape (n_samples,) or (n_samples, n_outputs), default=None

Target values (None for unsupervised transformations).

**fit_params : dict

Additional fit parameters.

Returns:
X_new : ndarray array of shape (n_samples, n_features_new)

Transformed array.

get_params(deep=True)

Get parameters for this estimator.

Parameters:
deep : bool, default=True

If True, will return the parameters for this estimator and contained subobjects that are estimators.

Returns:
params : dict

Parameter names mapped to their values.

set_output(*, transform=None)

Set output container.

See Introducing the set_output API for an example on how to use the API.

Parameters:
transform : {“default”, “pandas”}, default=None

Configure output of transform and fit_transform.

  • “default”: Default output format of a transformer
  • “pandas”: DataFrame output
  • None: Transform configuration is unchanged
Returns:
self : estimator instance

Estimator instance.

set_params(**params)

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.

Parameters:
**params : dict

Estimator parameters.

Returns:
self : estimator instance

Estimator instance.

transform(X)[source]

Scale samples of X according to sample_range.

Parameters:
X : array-like, shape = (n_samples, n_timestamps)

Data to scale.

Returns:
X_new : array-like, shape = (n_samples, n_timestamps)

Scaled data.

Examples using pyts.preprocessing.MinMaxScaler

Scalers

Scalers

Scalers