Fixed some docstrings in `params.rs`

pull/68/head
Meliurwen 2 years ago
parent 616d5ec3d5
commit ccced92149
Signed by: meliurwen
GPG Key ID: 818A8B35E9F1CE10
  1. 47
      reCTBN/src/params.rs

@ -23,9 +23,8 @@ pub enum StateType {
Discrete(usize), Discrete(usize),
} }
/// Parameters /// This is a core element for building different types of nodes; the goal is to define the set of
/// The Params trait is the core element for building different types of nodes. The goal is to /// methods required to describes a generic node.
/// define the set of method required to describes a generic node.
#[enum_dispatch(Params)] #[enum_dispatch(Params)]
pub trait ParamsTrait { pub trait ParamsTrait {
fn reset_params(&mut self); fn reset_params(&mut self);
@ -65,8 +64,8 @@ pub trait ParamsTrait {
fn get_label(&self) -> &String; fn get_label(&self) -> &String;
} }
/// The Params enum is the core element for building different types of nodes. The goal is to /// Is a core element for building different types of nodes; the goal is to define all the
/// define all the supported type of Parameters /// supported type of Parameters
#[derive(Clone)] #[derive(Clone)]
#[enum_dispatch] #[enum_dispatch]
pub enum Params { pub enum Params {
@ -76,14 +75,14 @@ pub enum Params {
/// DiscreteStatesContinousTime. /// DiscreteStatesContinousTime.
/// This represents the parameters of a classical discrete node for ctbn and it's composed by the /// This represents the parameters of a classical discrete node for ctbn and it's composed by the
/// following elements: /// following elements:
/// - **domain**: an ordered and exhaustive set of possible states /// - `label`
/// - **cim**: Conditional Intensity Matrix /// - `domain`: an ordered and exhaustive set of possible states.
/// - **Sufficient Statistics**: the sufficient statistics are mainly used during the parameter /// - `cim`: Conditional Intensity Matrix.
/// learning task and are composed by: /// - `transitions`: number of transitions from one state to another given a specific realization
/// - **transitions**: number of transitions from one state to another given a specific /// of the parent set; is a sufficient statistics are mainly used during the parameter learning
/// realization of the parent set /// task.
/// - **residence_time**: permanence time in each possible states given a specific /// - `residence_time`: permanence time in each possible state, given a specific realization of the
/// realization of the parent set /// parent set; is a sufficient statistics are mainly used during the parameter learning task.
#[derive(Clone)] #[derive(Clone)]
pub struct DiscreteStatesContinousTimeParams { pub struct DiscreteStatesContinousTimeParams {
label: String, label: String,
@ -104,15 +103,17 @@ impl DiscreteStatesContinousTimeParams {
} }
} }
///Getter function for CIM /// Getter function for CIM
pub fn get_cim(&self) -> &Option<Array3<f64>> { pub fn get_cim(&self) -> &Option<Array3<f64>> {
&self.cim &self.cim
} }
///Setter function for CIM.\\ /// Setter function for CIM.
///This function check if the cim is valid using the validate_params method. ///
///- **Valid cim inserted**: it substitute the CIM in self.cim and return Ok(()) /// This function check if the CIM is valid using the validate_params method:
///- **Invalid cim inserted**: it replace the self.cim value with None and it retu ParamsError /// - **Valid CIM inserted**: it substitute the CIM in self.cim and return `Ok(())`.
/// - **Invalid CIM inserted**: it replace the self.cim value with None and it returns
/// `ParamsError`.
pub fn set_cim(&mut self, cim: Array3<f64>) -> Result<(), ParamsError> { pub fn set_cim(&mut self, cim: Array3<f64>) -> Result<(), ParamsError> {
self.cim = Some(cim); self.cim = Some(cim);
match self.validate_params() { match self.validate_params() {
@ -124,27 +125,27 @@ impl DiscreteStatesContinousTimeParams {
} }
} }
///Unchecked version of the setter function for CIM. /// Unchecked version of the setter function for CIM.
pub fn set_cim_unchecked(&mut self, cim: Array3<f64>) { pub fn set_cim_unchecked(&mut self, cim: Array3<f64>) {
self.cim = Some(cim); self.cim = Some(cim);
} }
///Getter function for transitions /// Getter function for transitions.
pub fn get_transitions(&self) -> &Option<Array3<usize>> { pub fn get_transitions(&self) -> &Option<Array3<usize>> {
&self.transitions &self.transitions
} }
///Setter function for transitions /// Setter function for transitions.
pub fn set_transitions(&mut self, transitions: Array3<usize>) { pub fn set_transitions(&mut self, transitions: Array3<usize>) {
self.transitions = Some(transitions); self.transitions = Some(transitions);
} }
///Getter function for residence_time /// Getter function for residence_time.
pub fn get_residence_time(&self) -> &Option<Array2<f64>> { pub fn get_residence_time(&self) -> &Option<Array2<f64>> {
&self.residence_time &self.residence_time
} }
///Setter function for residence_time ///Setter function for residence_time.
pub fn set_residence_time(&mut self, residence_time: Array2<f64>) { pub fn set_residence_time(&mut self, residence_time: Array2<f64>) {
self.residence_time = Some(residence_time); self.residence_time = Some(residence_time);
} }

Loading…
Cancel
Save