spectrochempy.autoscale๏ƒ

autoscale(dataset, dim='y', inplace=False)[source]๏ƒ

Mean-center and scale to unit variance along a dimension.

This is the classic autoscaling (or z-score / standard-score) operation used before PCA, PLS, and other multivariate analyses.

\[x_{ij}^\prime = \frac{x_{ij} - \bar{x}_j}{s_j}\]

where \(\bar{x}_j\) and \(s_j\) are the mean and standard deviation along the chosen dimension.

Parameters:
  • dataset (NDDataset) โ€“ The input data.

  • dim (str or int, optional, default:โ€™yโ€™) โ€“ Dimension along which the mean and standard deviation are computed.

  • inplace (bool, optional, default:False) โ€“ If True, autoscaling is performed in place.

Returns:

NDDataset โ€“ The autoscaled dataset.

Examples

>>> dataset = scp.read("irdata/nh4.spg")
>>> nd = dataset.autoscale(dim="x")