pub fn normalize_rows(data: &[Vec<f64>]) -> Result<Vec<Vec<f64>>>Expand description
Normalize each row of a data matrix (L2 normalization).
This is useful preprocessing for some kernel methods.
§Arguments
data- Data matrix (rows are samples)
§Returns
- Row-normalized data matrix
§Examples
use tensorlogic_sklears_kernels::kernel_utils::normalize_rows;
let data = vec![
vec![3.0, 4.0],
vec![5.0, 12.0],
];
let normalized = normalize_rows(&data).unwrap();
// Each row now has unit norm