pub struct BestDoseProblem<E: Equation> { /* private fields */ }Expand description
A dose-optimization problem over a parameter distribution.
A BestDoseProblem pairs a model with a distribution over its parameters —
the support points (Theta) and their probability Weights. The
distribution is supplied by the caller: it may be a population fit, or a
patient-specific posterior computed with NCNPAG/NPMAP from past data.
Call optimize to solve for the doses that best hit a
target profile.
§Example
let problem = BestDoseProblem::new(eq, theta, weights)?;
let result = problem.optimize(
target,
Target::Concentration,
DoseRange::new(0.0, 300.0),
0.5,
BestDoseOptions::default(),
)?;
let optimal_subject = result.subject();
let cost = result.cost();Implementations§
Source§impl<E: Equation> BestDoseProblem<E>
impl<E: Equation> BestDoseProblem<E>
Sourcepub fn new(eq: E, theta: Theta, weights: Weights) -> Result<Self>
pub fn new(eq: E, theta: Theta, weights: Weights) -> Result<Self>
Creates a dose-optimization problem from a model and a parameter distribution.
Returns an error if the number of weights does not match the number of
support points in theta.
Sourcepub fn optimize(
&self,
target: Subject,
target_type: Target,
dose_range: DoseRange,
bias: f64,
options: BestDoseOptions,
) -> Result<BestDoseResult>
pub fn optimize( &self, target: Subject, target_type: Target, dose_range: DoseRange, bias: f64, options: BestDoseOptions, ) -> Result<BestDoseResult>
Solves for the optimal doses that hit target.
Doses in the target subject with amount 0.0 are optimized; non-zero
doses stay fixed. bias (λ ∈ [0, 1]) trades off minimizing the expected
squared error over the distribution (λ = 0) against minimizing the error
of the weighted-mean prediction (λ = 1).
Returns the optimal dosing Subject and its cost. Predictions can be
generated afterwards by simulating the returned subject.
Trait Implementations§
Auto Trait Implementations§
impl<E> Freeze for BestDoseProblem<E>where
E: Freeze,
impl<E> RefUnwindSafe for BestDoseProblem<E>where
E: RefUnwindSafe,
impl<E> Send for BestDoseProblem<E>where
E: Send,
impl<E> Sync for BestDoseProblem<E>
impl<E> Unpin for BestDoseProblem<E>where
E: Unpin,
impl<E> UnsafeUnpin for BestDoseProblem<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for BestDoseProblem<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
fn rand<T>(&self, rng: &mut (impl Rng + ?Sized)) -> Twhere
Self: Distribution<T>,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.