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

Function pack_stats

crates/openquant/src/feature_importance.rs:353–362  ·  view source on GitHub ↗
(feature_names: &[String], values: &[Vec<f64>])

Source from the content-addressed store, hash-verified

351}
352
353fn pack_stats(feature_names: &[String], values: &[Vec<f64>]) -> BTreeMap<String, ImportanceStats> {
354 let mut out = BTreeMap::new();
355 for (j, name) in feature_names.iter().enumerate() {
356 let (m, s) = mean_std(&values[j]);
357 let mean = if m.is_finite() { m } else { 0.0 };
358 let std = if s.is_finite() { s * (values[j].len() as f64).powf(-0.5) } else { 0.0 };
359 out.insert(name.clone(), ImportanceStats { mean, std });
360 }
361 out
362}
363
364fn nan_mean_std(v: &[f64]) -> (f64, f64) {
365 let vals: Vec<f64> = v.iter().copied().filter(|x| x.is_finite()).collect();

Callers 1

mean_decrease_accuracyFunction · 0.85

Calls 2

mean_stdFunction · 0.85
lenMethod · 0.80

Tested by

no test coverage detected