Skip to main content

mlprep_standardize_columns/
standardize_columns.rs

1//! Standardize each feature column to zero mean and unit std.
2//! Run: cargo run -p matten-mlprep --example mlprep_standardize_columns
3use matten::Tensor;
4use matten_mlprep::standardize_columns;
5
6fn main() {
7    let x = Tensor::new(vec![1.0, 10.0, 2.0, 20.0, 3.0, 30.0], &[3, 2]);
8    let z = standardize_columns(&x).expect("two non-constant columns");
9    println!("input  shape {:?}: {:?}", x.shape(), x.as_slice());
10    println!("z-score      {:?}: {:?}", z.shape(), z.as_slice());
11}