Fixed `chi_square_call` test, the test was passing, but only for pure chance

pull/79/head
Meliurwen 2 years ago
parent c08f4e1985
commit 9fbdf25149
Signed by: meliurwen
GPG Key ID: 818A8B35E9F1CE10
  1. 5
      reCTBN/tests/structure_learning.rs

@ -108,7 +108,7 @@ fn check_compatibility_between_dataset_and_network<T: StructureLearningAlgorithm
} }
} }
let data = trajectory_generator(&net, 100, 20.0, Some(6347747169756259)); let data = trajectory_generator(&net, 100, 30.0, Some(6347747169756259));
let mut net = CtbnNetwork::new(); let mut net = CtbnNetwork::new();
let _n1 = net let _n1 = net
@ -466,7 +466,7 @@ pub fn chi_square_call() {
let N3: usize = 2; let N3: usize = 2;
let N2: usize = 1; let N2: usize = 1;
let N1: usize = 0; let N1: usize = 0;
let separation_set = BTreeSet::new(); let mut separation_set = BTreeSet::new();
let parameter_learning = BayesianApproach { alpha: 1, tau:1.0 }; let parameter_learning = BayesianApproach { alpha: 1, tau:1.0 };
let mut cache = Cache::new(parameter_learning, data); let mut cache = Cache::new(parameter_learning, data);
let chi_sq = ChiSquare::new(0.0001); let chi_sq = ChiSquare::new(0.0001);
@ -474,5 +474,6 @@ pub fn chi_square_call() {
assert!(chi_sq.call(&net, N1, N3, &separation_set, &mut cache)); assert!(chi_sq.call(&net, N1, N3, &separation_set, &mut cache));
assert!(!chi_sq.call(&net, N3, N1, &separation_set, &mut cache)); assert!(!chi_sq.call(&net, N3, N1, &separation_set, &mut cache));
assert!(!chi_sq.call(&net, N3, N2, &separation_set, &mut cache)); assert!(!chi_sq.call(&net, N3, N2, &separation_set, &mut cache));
separation_set.insert(N1);
assert!(chi_sq.call(&net, N2, N3, &separation_set, &mut cache)); assert!(chi_sq.call(&net, N2, N3, &separation_set, &mut cache));
} }

Loading…
Cancel
Save