mlprep_minmax_scale/minmax_scale.rs
1//! Scale each feature column into [0, 1].
2//! Run: cargo run -p matten-mlprep --example mlprep_minmax_scale
3use matten::Tensor;
4use matten_mlprep::minmax_scale_columns;
5
6fn main() {
7 let x = Tensor::new(vec![0.0, 100.0, 5.0, 150.0, 10.0, 200.0], &[3, 2]);
8 let s = minmax_scale_columns(&x).expect("two non-constant columns");
9 println!("input {:?}", x.as_slice());
10 println!("scaled {:?}", s.as_slice());
11}