Laying grounds for CTPC

pull/79/head
Meliurwen 2 years ago
parent cac19b1756
commit 6e90458418
Signed by: meliurwen
GPG Key ID: 818A8B35E9F1CE10
  1. 40
      reCTBN/src/structure_learning/constraint_based_algorithm.rs

@ -1,5 +1,39 @@
//! Module containing constraint based algorithms like CTPC and Hiton. //! Module containing constraint based algorithms like CTPC and Hiton.
//pub struct CTPC { use super::hypothesis_test::*;
// use crate::structure_learning::StructureLearningAlgorithm;
//} use crate::{process, tools};
use crate::parameter_learning::{Cache, ParameterLearning};
pub struct CTPC<P: ParameterLearning> {
Ftest: F,
Chi2test: ChiSquare,
cache: Cache<P>,
}
impl<P: ParameterLearning> CTPC<P> {
pub fn new(Ftest: F, Chi2test: ChiSquare, cache: Cache<P>) -> CTPC<P> {
CTPC {
Chi2test,
Ftest,
cache,
}
}
}
impl<P: ParameterLearning> StructureLearningAlgorithm for CTPC<P> {
fn fit_transform<T>(&self, net: T, dataset: &tools::Dataset) -> T
where
T: process::NetworkProcess,
{
//Check the coherence between dataset and network
if net.get_number_of_nodes() != dataset.get_trajectories()[0].get_events().shape()[1] {
panic!("Dataset and Network must have the same number of variables.")
}
//Make the network mutable.
let mut net = net;
net
}
}

Loading…
Cancel
Save