Function power_transform

Source
pub fn power_transform<S>(
    array: &ArrayBase<S, Ix2>,
    method: &str,
    standardize: bool,
) -> Result<Array2<f64>>
where S: Data, S::Elem: Float + NumCast,
Expand description

Applies various power transformations to make data more Gaussian-like

§Arguments

  • array - The input array to transform
  • method - The transformation method (‘yeo-johnson’ or ‘box-cox’)
  • standardize - Whether to standardize the output to have zero mean and unit variance

§Returns

  • Result<Array2<f64>> - The transformed array

§Examples

use ndarray::array;
use scirs2_transform::features::power_transform;

let data = array![[1.0, 2.0, 3.0],
                  [4.0, 5.0, 6.0],
                  [7.0, 8.0, 9.0]];
                   
let transformed = power_transform(&data, "yeo-johnson", true).unwrap();