Added F call function

pull/79/head
Meliurwen 2 years ago
parent ec72a6a2f9
commit c08f4e1985
Signed by: meliurwen
GPG Key ID: 818A8B35E9F1CE10
  1. 33
      reCTBN/src/structure_learning/hypothesis_test.rs

@ -89,7 +89,38 @@ impl HypothesisTest for F {
T: network::Network, T: network::Network,
P: parameter_learning::ParameterLearning, P: parameter_learning::ParameterLearning,
{ {
true let P_small = match cache.fit(net, child_node, Some(separation_set.clone())) {
Params::DiscreteStatesContinousTime(node) => node,
};
let mut extended_separation_set = separation_set.clone();
extended_separation_set.insert(parent_node);
let P_big = match cache.fit(net, child_node, Some(extended_separation_set.clone())) {
Params::DiscreteStatesContinousTime(node) => node,
};
let partial_cardinality_product: usize = extended_separation_set
.iter()
.take_while(|x| **x != parent_node)
.map(|x| net.get_node(*x).get_reserved_space_as_parent())
.product();
for idx_M_big in 0..P_big.get_transitions().as_ref().unwrap().shape()[0] {
let idx_M_small: usize = idx_M_big % partial_cardinality_product
+ (idx_M_big
/ (partial_cardinality_product
* net.get_node(parent_node).get_reserved_space_as_parent()))
* partial_cardinality_product;
if !self.compare_matrices(
idx_M_small,
P_small.get_transitions().as_ref().unwrap(),
P_small.get_cim().as_ref().unwrap(),
idx_M_big,
P_big.get_transitions().as_ref().unwrap(),
P_big.get_cim().as_ref().unwrap(),
) {
return false;
}
}
return true;
} }
} }

Loading…
Cancel
Save