hypertools.normalize

hypertools.normalize(*args, **kwargs)[source]

Z-transform the columns or rows of an array, or list of arrays

This function normalizes the rows or columns of the input array(s). This can be useful because data reduction and machine learning techniques are sensitive to scaling differences between features. By default, the function is set to normalize ‘across’ the columns of all lists, but it can also normalize the columns ‘within’ each individual list, or alternatively, for each row in the array.

Parameters:

x : Numpy array or list of arrays

This can either be a single array, or list of arrays

normalize : str or False or None

If set to ‘across’, the columns of the input data will be z-scored across lists (default). That is, the z-scores will be computed with with repect to column n across all arrays passed in the list. If set to ‘within’, the columns will be z-scored within each list that is passed. If set to ‘row’, each row of the input data will be z-scored. If set to False, the input data will be returned with no z-scoring.

Returns:

normalized_x : Numpy array or list of arrays

An array or list of arrays where the columns or rows are z-scored. If the input was a list, a list is returned. Otherwise, an array is returned.