Module rusty_machine::data::transforms::normalize
source · [−]Expand description
The Normalizing Transformer
This module contains the Normalizer
transformer.
The Normalizer
transformer is used to transform input data
so that the norm of each row is equal to 1. By default the
Normalizer
uses the Euclidean
norm.
If input data has a row with all 0, Normalizer
keeps the row as it is.
Because transformation is performed per row independently, inverse transformation is not supported.
Examples
use rusty_machine::data::transforms::{Transformer, Normalizer};
use rusty_machine::linalg::Matrix;
// Constructs a new `Normalizer`
let mut transformer = Normalizer::default();
let inputs = Matrix::new(2, 2, vec![-1.0, 2.0, 1.5, 3.0]);
// Transform the inputs
let transformed = transformer.transform(inputs).unwrap();
Structs
The Normalizer