spectrochempy.range_scale๏ƒ

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

Scale data by the range along a dimension.

Each variable (or observation) is divided by its range (max - min). This is sometimes called min-max scaling or range normalisation in the chemometric literature.

\[x_{ij}^\prime = \frac{x_{ij}}{\max(x_j) - \min(x_j)}\]
Parameters:
  • dataset (NDDataset) โ€“ The input data.

  • dim (str or int, optional, default:โ€™yโ€™) โ€“ Dimension along which the range is computed.

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

Returns:

NDDataset โ€“ The range-scaled dataset.

Examples

>>> dataset = scp.read("irdata/nh4y-activation.spg")
>>> nd = dataset.range_scale(dim="y")

See also

normalize

General normalisation (includes min-max to [0, 1]).