BestDoseResult

Struct BestDoseResult 

Source
pub struct BestDoseResult { /* private fields */ }
Expand description

Result from BestDose optimization

Contains the optimal doses and associated predictions from running BestDoseProblem::optimize().

§Fields

  • dose: Optimal dose amount(s) in the same order as doses in target subject
  • objf: Final cost function value at optimal doses
  • status: Optimization status message (e.g., “converged”, “max iterations”)
  • preds: Concentration-time predictions using optimal doses
  • auc_predictions: AUC values at observation times (only for [Target::AUC])
  • optimization_method: Which method won: "posterior" or "uniform"

§Interpretation

§Optimization Method

  • “posterior”: Patient-specific optimization won (uses posterior weights)

    • Indicates patient differs from population or has sufficient history
    • Doses are highly personalized
  • “uniform”: Population-based optimization won (uses uniform weights)

    • Indicates patient is population-typical or has limited history
    • Doses are more conservative/robust

§Cost Function (objf)

Lower is better. The cost combines variance and bias:

Cost = (1-λ) × Variance + λ × Bias²

§Examples

§Extracting Results

let result = problem.optimize()?;

// Single dose
println!("Optimal dose: {} mg", result.dose[0]);

// Multiple doses
for (i, &dose) in result.dose.iter().enumerate() {
    println!("Dose {}: {} mg", i + 1, dose);
}

// Check which method was used
match result.optimization_method.as_str() {
    "posterior" => println!("Patient-specific optimization"),
    "uniform" => println!("Population-based optimization"),
    _ => {}
}

// Access predictions
for pred in result.preds.iter() {
    println!("t={:.1}h: {:.2} mg/L", pred.time(), pred.prediction());
}

// For AUC targets
if let Some(auc_values) = result.auc_predictions {
    for (time, auc) in auc_values {
        println!("AUC at t={:.1}h: {:.1} mg·h/L", time, auc);
    }
}

Implementations§

Source§

impl BestDoseResult

Source

pub fn optimal_subject(&self) -> &Subject

Get the optimized subject

Source

pub fn doses(&self) -> Vec<f64>

Get the dose amounts of the optimized subject

This includes all doses (bolus and infusion) in the order they appear in the optimal subject, and returns their amounts as a vector of f64.

Source

pub fn objf(&self) -> f64

Get the objective cost function value

Source

pub fn status(&self) -> &BestDoseStatus

Get the optimization status

Source

pub fn predictions(&self) -> &NPPredictions

Get the concentration-time predictions

Source

pub fn auc_predictions(&self) -> Option<Vec<(f64, f64)>>

Get the AUC predictions, if available

Source

pub fn optimization_method(&self) -> OptimalMethod

Get the optimization method used

Trait Implementations§

Source§

impl Clone for BestDoseResult

Source§

fn clone(&self) -> BestDoseResult

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for BestDoseResult

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for BestDoseResult

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for BestDoseResult

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> ByRef<T> for T

§

fn by_ref(&self) -> &T

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> DistributionExt for T
where T: ?Sized,

§

fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> T
where Self: Distribution<T>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

§

impl<T> SendAlias for T

§

impl<T> SyncAlias for T