pub fn log_transform<T>(data: &[T]) -> Vec<f64>Expand description
Applies the natural logarithm transformation to a numeric data series.
This will aggressively compresses large values while expanding small values, which can be useful for stabilizing variance, normalizing right-skewed distributions, and linearizing exponential releationships.
NOTE: This transformation is much stronger at tail compression than
the square root transformation crate::transforms::sqrt_transform,
so use that if only light tail dampening is desired.
NOTE: The log transform is undefined for values less than or equal to zero. Such values will be skipped silently during transformation.
ยงExample
use quant_mathema::transforms::log_transform;
let data = vec![1.0, 2.0, 10.0, 100.0];
let data_log_trans = log_transform(&data);