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

Function get_ind_mat_label_uniqueness

crates/openquant/src/sampling.rs:52–68  ·  view source on GitHub ↗

Per-label uniqueness series.

(ind_mat: &[Vec<u8>])

Source from the content-addressed store, hash-verified

50
51/// Per-label uniqueness series.
52pub fn get_ind_mat_label_uniqueness(ind_mat: &[Vec<u8>]) -> Vec<Vec<f64>> {
53 let cols = ind_mat.first().map(|r| r.len()).unwrap_or(0);
54 let mut out = vec![Vec::new(); cols];
55 for col in 0..cols {
56 let mut vals = Vec::new();
57 for row in ind_mat {
58 if row[col] == 1 {
59 let conc = row.iter().map(|v| *v as f64).sum::<f64>();
60 vals.push(1.0 / conc);
61 } else {
62 vals.push(0.0);
63 }
64 }
65 out[col] = vals;
66 }
67 out
68}
69
70/// Core step from sequential bootstrap: average uniqueness given current concurrency.
71pub fn bootstrap_loop_run(ind_mat: &[Vec<u8>], prev_concurrency: &[f64]) -> Vec<f64> {

Calls 1

lenMethod · 0.80

Tested by 1