MCPcopy Create free account
hub / github.com/Open-Quant/openquant / mean_std

Function mean_std

crates/openquant/src/feature_importance.rs:369–376  ·  view source on GitHub ↗
(v: &[f64])

Source from the content-addressed store, hash-verified

367}
368
369fn mean_std(v: &[f64]) -> (f64, f64) {
370 if v.is_empty() {
371 return (0.0, 0.0);
372 }
373 let mean = v.iter().sum::<f64>() / v.len() as f64;
374 let var = v.iter().map(|x| (x - mean).powi(2)).sum::<f64>() / v.len() as f64;
375 (mean, var.sqrt())
376}
377
378fn standardize(rows: &[Vec<f64>]) -> Vec<Vec<f64>> {
379 let n = rows.len();

Callers 3

pack_statsFunction · 0.85
nan_mean_stdFunction · 0.85

Calls 2

is_emptyMethod · 0.80
lenMethod · 0.80

Tested by

no test coverage detected