Data Standardization

New in version 0.1.

Changed in version 1.2.0.

This function standardizes (z-score) the series according to equation

\(\textbf{x}_s = \frac{\textbf{x} - a}{b}\)

where \(\textbf{x}\) is time series to standardize, \(a\) is offset to remove and \(b\) scale to remove

See also: Data De-standardization

Usage Explanation

As simple as

xs = pa.standardize(x, offset=a , scale=b)

If the key arguments offset and scale are not provided (example below) the mean value and standard deviation of x is used.

xs = pa.standardize(x)

Minimal Working Example

An example how to standarize (z-score) data:

>>> import numpy as np
>>> import padasip as pa
>>> x = np.random.random(1000)
>>> x.mean()
0.49755420774866677
>>> x.std()
0.29015765297767376
>>> xs = pa.standardize(x)
>>> xs.mean()
1.4123424652012772e-16
>>> xs.std()
0.99999999999999989

Code Explanation

padasip.preprocess.standardize.standardize(x, offset=None, scale=None)[source]

This is function for standarization of input series.

Args:

  • x : series (1 dimensional array)

Kwargs:

  • offset : offset to remove (float). If not given, the mean value of x is used.

  • scale : scale (float). If not given, the standard deviation of x is used.

Returns:

  • xs : standardized series