spectrochempy.AutoscaleTransformerο
- class AutoscaleTransformer(dim='y')[source]ο
Autoscaling (z-score) transformer.
Learns the mean and standard deviation along a dimension during
fit()and applies \((x - \bar{x}) / s\) duringtransform().- Parameters:
dim (
strorint, optional, default:βyβ) β Dimension along which the mean and standard deviation are computed.
Examples
>>> scaler = scp.AutoscaleTransformer(dim="y") >>> scaler.fit(train) >>> test_scaled = scaler.transform(test) >>> train_restored = scaler.inverse_transform(test_scaled)
See also
autoscaleProcedural autoscaling function.
Methods Summary
fit(dataset)Learn parameters from dataset.
fit_transform(dataset)Fit to dataset, then transform it.
inverse_transform(dataset)Reverse the learned transformation on dataset.
transform(dataset)Apply the learned transformation to dataset.
Methods Documentation
- fit(dataset)[source]ο
Learn parameters from dataset.
- Parameters:
dataset (
NDDataset) β Training data.- Returns:
self β The fitted instance.
- fit_transform(dataset)[source]ο
Fit to dataset, then transform it.
Equivalent to
self.fit(dataset).transform(dataset)but avoids an intermediate copy when possible.
Examples using spectrochempy.AutoscaleTransformer