spectrochempy.LogTransformerο
- class LogTransformer(method='log1p', eps=1e-10)[source]ο
Logarithmic transform.
This is a stateless transformer:
fit()is a no-op and the same transform is applied regardless of the input data. It is provided for API uniformity so that all preprocessing steps can be expressed as transformer objects.- Parameters:
method (
str, optional, default:βlog1pβ) β Transform to apply:'log1p'β computelog(1 + x)(stable for small or zero values).'log'β computelog(x). If the data contain values \(\le 0\), a small offsetepsis added automatically.
eps (
float, optional, default:1e-10) β Offset added whenmethod='log'and non-positive values are present.
Examples
>>> transformer = scp.LogTransformer(method="log1p") >>> nd = transformer.fit_transform(dataset)
See also
log_transformProcedural log transform 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.LogTransformer