mltk.core.preprocess.utils.normalize

Utilities for normalizing data

normalize(x, rescale=None, samplewise_center=False, samplewise_std_normalization=False, samplewise_normalize_range=None, dtype=None)[source]

Applies the normalization configuration in-place to a batch of inputs.

Parameters:
  • x (ndarray) – Input sample to normalize

  • rescale (float) – x *= rescale

  • samplewise_centerx -= np.mean(x, keepdims=True)

  • samplewise_std_normalizationx /= (np.std(x, keepdims=True) + 1e-6)

  • samplewise_normalize_rangex = diff * (x - np.min(x)) / np.ptp(x) + lower

  • dtype (dtype) – The output dtype, if not dtype if given then x is converted to float32

Return type:

ndarray

Returns:

The normalized value of x