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 normalizerescale (
float) –x *= rescalesamplewise_center –
x -= np.mean(x, keepdims=True)samplewise_std_normalization –
x /= (np.std(x, keepdims=True) + 1e-6)samplewise_normalize_range –
x = diff * (x - np.min(x)) / np.ptp(x) + lowerdtype (
dtype) – The output dtype, if not dtype if given then x is converted to float32
- Return type:
ndarray- Returns:
The normalized value of x