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

Function normalize_string_map

crates/openquant/src/fingerprint.rs:287–293  ·  view source on GitHub ↗
(effect: &BTreeMap<String, f64>)

Source from the content-addressed store, hash-verified

285}
286
287fn normalize_string_map(effect: &BTreeMap<String, f64>) -> BTreeMap<String, f64> {
288 let sum: f64 = effect.values().sum();
289 if sum == 0.0 {
290 return effect.keys().map(|k| (k.clone(), 0.0)).collect();
291 }
292 effect.iter().map(|(k, v)| (k.clone(), *v / sum)).collect()
293}
294
295fn quantile_sorted(sorted: &[f64], q: f64) -> f64 {
296 if sorted.len() == 1 {

Callers 1

fit_implFunction · 0.85

Calls 1

valuesMethod · 0.80

Tested by

no test coverage detected