nnmnkwii.util.scale

nnmnkwii.util.scale(x, data_mean, data_std)[source]

Mean/variance scaling.

Given mean and variances, apply mean-variance normalization to data.

Parameters:
  • x (array) – Input data
  • data_mean (array) – Means for each feature dimention.
  • data_std (array) – Standard deviation for each feature dimention.
Returns:

Scaled data.

Return type:

array

Examples

>>> from nnmnkwii.util import meanstd, scale
>>> 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)
>>> lengths = [len(y) for y in Y]
>>> data_mean, data_std = meanstd(Y, lengths)
>>> scaled_y = scale(Y[0], data_mean, data_std)