A new, blazing-fast learning engine for Continuous Time Bayesian Networks. Written in pure Rust. 🦀
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
reCTBN/tests/structure_learning.rs

38 lines
756 B

mod utils;
use utils::*;
use rustyCTBN::ctbn::*;
use rustyCTBN::network::Network;
use rustyCTBN::tools::*;
use rustyCTBN::structure_learning::*;
use ndarray::{arr1, arr2};
use std::collections::BTreeSet;
#[macro_use]
extern crate approx;
#[test]
fn simple_log_likelihood() {
let mut net = CtbnNetwork::init();
let n1 = net
.add_node(generate_discrete_time_continous_node(String::from("n1"),2))
.unwrap();
let trj = Trajectory{
time: arr1(&[0.0,0.1,0.3]),
events: arr2(&[[0],[1],[1]])};
let dataset = Dataset{
trajectories: vec![trj]};
let ll = LogLikelihood::init(1, 1.0);
assert_abs_diff_eq!(0.04257, ll.compute_score(&net, n1, &BTreeSet::new(), &dataset), epsilon=1e-3);
}