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/src/tools.rs

31 lines
714 B

3 years ago
use ndarray::prelude::*;
use crate::network;
use petgraph::prelude::*;
use rand::Rng;
pub struct Trajectory {
time: Array1<f64>,
events: Array2<u32>
}
pub struct Dataset {
trajectories: Vec<Trajectory>
}
fn trajectory_generator(net: &Box<dyn network::Network>, n_trajectories: u64, t_end: f64) -> Dataset {
let mut dataset = Dataset{
trajectories: Vec::new()
};
for _ in 0..n_trajectories {
let mut rng = rand::thread_rng();
let t = 0.0;
let mut time: Vec<f64> = Vec::new();
let mut events: Vec<Vec<u32>> = Vec::new();
let current_state: Vec<u32> = net.get_node_indices().map(|x| rng.gen_range(0..2)).collect();
}
dataset
}