msmbuilder.preprocessing.MinMaxScaler

class msmbuilder.preprocessing.MinMaxScaler(feature_range=(0, 1), copy=True)

Transforms 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, i.e. between zero and one.

The transformation is given by:

X_std = (X - X.min(axis=0)) / (X.max(axis=0) - X.min(axis=0))
X_scaled = X_std * (max - min) + min

where min, max = feature_range.

This transformation is often used as an alternative to zero mean, unit variance scaling.

Read more in the User Guide.

Parameters:

feature_range : tuple (min, max), default=(0, 1)

Desired range of transformed data.

copy : boolean, optional, default True

Set to False to perform inplace row normalization and avoid a copy (if the input is already a numpy array).

See also

minmax_scale
Equivalent function without the object oriented API.

Attributes

min_ (ndarray, shape (n_features,)) Per feature adjustment for minimum.
scale_ (ndarray, shape (n_features,)) Per feature relative scaling of the data. .. versionadded:: 0.17 scale_ attribute.
data_min_ (ndarray, shape (n_features,)) Per feature minimum seen in the data .. versionadded:: 0.17 data_min_ instead of deprecated data_min.
data_max_ (ndarray, shape (n_features,)) Per feature maximum seen in the data .. versionadded:: 0.17 data_max_ instead of deprecated data_max.
data_range_ (ndarray, shape (n_features,)) Per feature range (data_max_ - data_min_) seen in the data .. versionadded:: 0.17 data_range_ instead of deprecated data_range.

Methods

fit(sequences[, y]) Fit Preprocessing to X.
fit_transform(sequences[, y]) Fit the model and apply preprocessing
get_params([deep]) Get parameters for this estimator.
inverse_transform(X) Undo the scaling of X according to feature_range.
partial_fit(sequence[, y]) Fit Preprocessing to X.
partial_transform(sequence) Apply preprocessing to single sequence
set_params(**params) Set the parameters of this estimator.
summarize() Return some diagnostic summary statistics about this Markov model
transform(sequences) Apply preprocessing to sequences
__init__(feature_range=(0, 1), copy=True)

Methods

__init__([feature_range, copy])
fit(sequences[, y]) Fit Preprocessing to X.
fit_transform(sequences[, y]) Fit the model and apply preprocessing
get_params([deep]) Get parameters for this estimator.
inverse_transform(X) Undo the scaling of X according to feature_range.
partial_fit(sequence[, y]) Fit Preprocessing to X.
partial_transform(sequence) Apply preprocessing to single sequence
set_params(**params) Set the parameters of this estimator.
summarize() Return some diagnostic summary statistics about this Markov model
transform(sequences) Apply preprocessing to sequences

Attributes

data_min DEPRECATED: Attribute data_min will be removed in 0.19.
data_range DEPRECATED: Attribute data_range will be removed in 0.19.
data_min

DEPRECATED: Attribute data_min will be removed in 0.19. Use data_min_ instead

data_range

DEPRECATED: Attribute data_range will be removed in 0.19. Use data_range_ instead

fit(sequences, y=None)

Fit Preprocessing to X.

Parameters:

sequences : list of array-like, each of shape [sequence_length, n_features]

A list of multivariate timeseries. Each sequence may have a different length, but they all must have the same number of features.

y : None

Ignored

Returns:

self

fit_transform(sequences, y=None)

Fit the model and apply preprocessing

Parameters:

sequences: list of array-like, each of shape (n_samples_i, n_features)

Training data, where n_samples_i in the number of samples in sequence i and n_features is the number of features.

y : None

Ignored

Returns:

sequence_new : list of array-like, each of shape (n_samples_i, n_components)

get_params(deep=True)

Get parameters for this estimator.

Parameters:

deep : boolean, optional

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

Returns:

params : mapping of string to any

Parameter names mapped to their values.

inverse_transform(X)

Undo the scaling of X according to feature_range.

Parameters:

X : array-like, shape [n_samples, n_features]

Input data that will be transformed. It cannot be sparse.

partial_fit(sequence, y=None)

Fit Preprocessing to X.

Parameters:

sequence : array-like, [sequence_length, n_features]

A multivariate timeseries.

y : None

Ignored

Returns:

self

partial_transform(sequence)

Apply preprocessing to single sequence

Parameters:

sequence: array like, shape (n_samples, n_features)

A single sequence to transform

Returns:

out : array like, shape (n_samples, n_features)

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Returns:self
summarize()

Return some diagnostic summary statistics about this Markov model

transform(sequences)

Apply preprocessing to sequences

Parameters:

sequences: list of array-like, each of shape (n_samples_i, n_features)

Sequence data to transform, where n_samples_i in the number of samples in sequence i and n_features is the number of features.

Returns:

sequence_new : list of array-like, each of shape (n_samples_i, n_components)