quietset 0.14.0

Filter datasets by label stability across evaluators, budgets, seeds, and models
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use crate::observation::Observation;
use indexmap::IndexMap;

/// Groups observations by sample_id, preserving insertion order.
pub fn group_by_sample_id(
    observations: impl Iterator<Item = Observation>,
) -> IndexMap<String, Vec<Observation>> {
    let mut groups: IndexMap<String, Vec<Observation>> = IndexMap::new();
    for obs in observations {
        groups.entry(obs.sample_id.clone()).or_default().push(obs);
    }
    groups
}