Skip to main content

Predictions

Trait Predictions 

pub trait Predictions: Default {
    // Required methods
    fn squared_error(&self) -> f64;
    fn get_predictions(&self) -> Vec<Prediction>;
    fn log_likelihood(
        &self,
        error_models: &AssayErrorModels,
    ) -> Result<f64, PharmsolError>;

    // Provided method
    fn new(_nparticles: usize) -> Self { ... }
}
Expand description

Trait for prediction containers.

Required Methods§

fn squared_error(&self) -> f64

Calculate the sum of squared errors for all predictions.

§Returns

The sum of squared errors

fn get_predictions(&self) -> Vec<Prediction>

Get all predictions as a vector.

§Returns

Vector of prediction objects

fn log_likelihood( &self, error_models: &AssayErrorModels, ) -> Result<f64, PharmsolError>

Calculate the log-likelihood of the predictions given an error model.

This is numerically more stable than computing the likelihood and taking its log, especially for extreme values or many observations.

§Parameters
  • error_models: The error models for computing observation variance
§Returns

The sum of log-likelihoods for all predictions

Provided Methods§

fn new(_nparticles: usize) -> Self

Create a new prediction container with specified capacity.

§Parameters
  • nparticles: Number of particles (for SDE)
§Returns

A new predictions container

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl Predictions for ArrayBase<OwnedRepr<Prediction>, Dim<[usize; 2]>>

Predictions implementation for particle-based SDE simulation outputs.

This implementation manages and processes predictions from multiple particles.

§

fn new(nparticles: usize) -> ArrayBase<OwnedRepr<Prediction>, Dim<[usize; 2]>>

§

fn squared_error(&self) -> f64

§

fn get_predictions(&self) -> Vec<Prediction>

§

fn log_likelihood( &self, error_models: &AssayErrorModels, ) -> Result<f64, PharmsolError>

Implementors§