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

Function test_number_of_bins

crates/openquant/tests/codependence.rs:95–103  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

93
94#[test]
95fn test_number_of_bins() {
96 let (x, y_1, _) = load_series();
97 let n_bins_x = get_optimal_number_of_bins(x.len(), None).expect("n bins x");
98 let corr = corrcoef(&x, &y_1);
99 let n_bins_x_y = get_optimal_number_of_bins(x.len(), Some(corr)).expect("n bins x y");
100
101 assert_eq!(n_bins_x, 15);
102 assert_eq!(n_bins_x_y, 9);
103}
104
105/// A correlation of -1 used to reach the bivariate bin formula, divide by zero, and ask for
106/// isize::MAX bins, which panicked with "capacity overflow" inside the histogram.

Callers

nothing calls this directly

Calls 4

load_seriesFunction · 0.85
lenMethod · 0.80
corrcoefFunction · 0.70

Tested by

no test coverage detected