htfa.tfa.standardize_data¶
- htfa.tfa.standardize_data(X, mode)[source]¶
Z-score data (V, T) before fitting.
- Parameters:
- Xarray_like, shape (V, T)
Data, one row per voxel and one column per sample.
- mode{‘auto’, True, False}
'auto'z-scores each row (voxel) across columns when T > 1 and leaves single-sample data unchanged.Truez-scores each row when T > 1 and z-scores across all voxels when T == 1.Falseleaves the data unchanged. Constant rows (or a constant single column underTrue) become 0.
- Returns:
- ndarray, shape (V, T)
The standardized data as float64.
- Raises:
- ValueError
If
modeis not'auto',TrueorFalse.
Examples
>>> import numpy as np >>> from htfa.tfa import standardize_data >>> standardize_data(np.array([[1.0, 3.0], [2.0, 2.0]]), "auto") array([[-1., 1.], [ 0., 0.]]) >>> standardize_data(np.array([[1.0], [3.0]]), True) array([[-1.], [ 1.]])