Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
mhovd committed Dec 29, 2023
1 parent 0b4c7c8 commit 5a0ceaf
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/algorithms/npag.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ use ndarray::{Array, Array1, Array2, Axis};
use ndarray_stats::{DeviationExt, QuantileExt};
use tokio::sync::mpsc::UnboundedSender;

const THETA_E: f64 = 1e-4; //convergence Criteria
const THETA_G: f64 = 1e-4; //objf stop criteria
const THETA_E: f64 = 1e-4; // Convergence criteria
const THETA_G: f64 = 1e-4; // Objective function convergence criteria
const THETA_F: f64 = 1e-2;
const THETA_D: f64 = 1e-4;

Expand Down
7 changes: 4 additions & 3 deletions src/routines/datafile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ use std::process::exit;

type Record = HashMap<String, String>;

/// A Scenario is a collection of blocks that represent a single subject in the Datafile
/// A Scenario is a collection of blocks that represent a single subject in the datafile
/// Each block is a collection of events that represent a single dose, possibly followed by observations
#[derive(Debug, Clone)]
pub struct Scenario {
pub id: String,
Expand All @@ -23,8 +24,8 @@ impl Scenario {
}

/// Adds "mock" events to a Scenario in order to generate predictions at those times
/// The interval is mapped to the `idelta`-setting in the configuration time
/// Time after dose (tad) will ensure that predictions are made until the last dose + tad
/// The interval is mapped to the `idelta`-setting in the configuration file
/// Time after dose (`tad`) will ensure that predictions are made until the last dose + tad
pub fn add_event_interval(&self, interval: f64, tad: f64) -> Self {
// Clone the underlying Event data instead of the references
let all_events = self
Expand Down
2 changes: 1 addition & 1 deletion src/routines/evaluation/ipm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ type OneDimArray = ArrayBase<OwnedRepr<f64>, ndarray::Dim<[usize; 1]>>;
///
/// A `Result` containing a tuple with two elements:
///
/// * `lam` - An Array1<f64> representing the solution of the optimization problem.
/// * `lam` - An `Array1<f64>` representing the solution of the optimization problem.
/// * `obj` - A f64 value representing the objective function value at the solution.
///
/// # Errors
Expand Down
7 changes: 7 additions & 0 deletions src/routines/expansion/adaptative_grid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ use ndarray::{Array, Array2};

use crate::routines::condensation::prune::prune;

/// Adaptive grid algorithm for support point expansion
///
/// For each support point, generate up to 2 new support points in each dimension
///
/// New support points are symmetrically placed around the original support point, at a distance of eps * (range_max - range_min)
///
/// If the new support point is too close to an existing support point, or it is outside the given range, it is discarded
pub fn adaptative_grid(
theta: &mut Array2<f64>,
eps: f64,
Expand Down
9 changes: 9 additions & 0 deletions src/routines/output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,15 @@ impl CycleLog {
}
}

/// Defines the result objects from a run
/// An [NPResult] contains the necessary information to generate predictions and summary statistics
/// It holds the following information:
/// - `cycle`: The cycle number
/// - `objf`: The objective function value
/// - `gamlam`: The assay noise parameter, either gamma or lambda
/// - `theta`: The support points and their associated probabilities
/// - `nspp`: The number of support points
/// - `delta_objf`: The change in objective function value from last cycle
#[derive(Debug, Clone)]
pub struct NPCycle {
pub cycle: usize,
Expand Down
6 changes: 3 additions & 3 deletions src/routines/simulation/predict.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,16 +160,16 @@ pub fn get_ypred<S: Predict<'static> + Sync + Clone>(
///
/// * `sim_eng` - A reference to the simulation engine implementing the `Predict` trait.
///
/// * `scenarios` - A reference to a Vec<Scenario> containing information about different scenarios.
/// * `scenarios` - A reference to a `Vec<Scenario>` containing information about different scenarios.
///
/// * `support_points` - A 2D Array (Array2<f64>) representing the support points. Each row
/// * `support_points` - A 2D Array `(Array2<f64>)` representing the support points. Each row
/// corresponds to a different support point scenario.
///
/// * `cache` - A boolean flag indicating whether to cache predicted values during simulation.
///
/// # Returns
///
/// A 2D Array (Array2<Array1<f64>>) where each element is an Array1<f64> representing the
/// A 2D Array `(Array2<Array1<f64>>)` where each element is an `Array1<f64>` representing the
/// simulated observations for a specific scenario and support point.
///
/// # Example
Expand Down

0 comments on commit 5a0ceaf

Please sign in to comment.