nnmnkwii.preprocessing.minmax_scale_params

nnmnkwii.preprocessing.minmax_scale_params(data_min, data_max, feature_range=(0, 1))[source]

Compute parameters required to perform min/max scaling.

Given data min, max and feature range, computes scalining factor and minimum value. Min/max scaling can be done as follows:

x_scaled = x * scale_ + min_
Parameters
  • x (array) – Input data

  • data_min (array) – Data min for each feature dimention.

  • data_max (array) – Data max for each feature dimention.

  • feature_range (array like) – Feature range.

Returns

Minimum value and scaling factor for scaled data.

Return type

tuple

Examples

>>> from nnmnkwii.preprocessing import minmax, minmax_scale
>>> from nnmnkwii.preprocessing import minmax_scale_params
>>> from nnmnkwii.util import example_file_data_sources_for_acoustic_model
>>> from nnmnkwii.datasets import FileSourceDataset
>>> X, Y = example_file_data_sources_for_acoustic_model()
>>> X, Y = FileSourceDataset(X), FileSourceDataset(Y)
>>> data_min, data_max = minmax(X)
>>> min_, scale_ = minmax_scale_params(data_min, data_max)
>>> scaled_x = minmax_scale(X[0], min_=min_, scale_=scale_)