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

Function test_aggregation_helpers

crates/openquant/tests/ensemble_methods.rs:36–52  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

34
35#[test]
36fn test_aggregation_helpers() {
37 let reg = aggregate_regression_mean(&[vec![1.0, 3.0], vec![3.0, 1.0]]).unwrap();
38 assert_eq!(reg, vec![2.0, 2.0]);
39
40 let vote =
41 aggregate_classification_vote(&[vec![1, 0, 1], vec![1, 1, 0], vec![0, 1, 1]]).unwrap();
42 assert_eq!(vote, vec![1, 1, 1]);
43
44 let (prob, labels) = aggregate_classification_probability_mean(
45 &[vec![0.9, 0.2], vec![0.7, 0.4], vec![0.8, 0.3]],
46 0.5,
47 )
48 .unwrap();
49 assert!((prob[0] - 0.8).abs() < 1e-12);
50 assert!((prob[1] - 0.3).abs() < 1e-12);
51 assert_eq!(labels, vec![1, 0]);
52}
53
54#[test]
55fn test_variance_reduction_and_redundancy_failure_mode() {

Callers

nothing calls this directly

Tested by

no test coverage detected