pub struct LikelihoodExpression { /* private fields */ }Expand description
A combination of LikelihoodTerms as well as sums and products of them.
§Notes
When multiple terms provide parameters with the same name, the term earliest in the expression (or argument list) defines the fixed/free status and default value.
Implementations§
Source§impl LikelihoodExpression
impl LikelihoodExpression
Sourcepub fn from_term(term: Box<dyn LikelihoodTerm>) -> LadduResult<Self>
pub fn from_term(term: Box<dyn LikelihoodTerm>) -> LadduResult<Self>
Build a LikelihoodExpression from a single LikelihoodTerm.
Sourcepub fn parameters(&self) -> ParameterMap
pub fn parameters(&self) -> ParameterMap
The parameters referenced across all terms in this expression.
Sourcepub fn n_parameters(&self) -> usize
pub fn n_parameters(&self) -> usize
Total number of parameters (free + fixed).
Sourcepub fn evaluate(&self, parameters: &[f64]) -> LadduResult<f64>
pub fn evaluate(&self, parameters: &[f64]) -> LadduResult<f64>
Evaluate the sum/product of all terms.
Sourcepub fn evaluate_gradient(&self, parameters: &[f64]) -> LadduResult<DVector<f64>>
pub fn evaluate_gradient(&self, parameters: &[f64]) -> LadduResult<DVector<f64>>
Evaluate the gradient.
Trait Implementations§
Source§impl Add<&LikelihoodExpression> for &LikelihoodExpression
impl Add<&LikelihoodExpression> for &LikelihoodExpression
Source§type Output = LikelihoodExpression
type Output = LikelihoodExpression
The resulting type after applying the
+ operator.Source§impl Add<&LikelihoodExpression> for LikelihoodExpression
impl Add<&LikelihoodExpression> for LikelihoodExpression
Source§type Output = LikelihoodExpression
type Output = LikelihoodExpression
The resulting type after applying the
+ operator.Source§impl Add<LikelihoodExpression> for &LikelihoodExpression
impl Add<LikelihoodExpression> for &LikelihoodExpression
Source§type Output = LikelihoodExpression
type Output = LikelihoodExpression
The resulting type after applying the
+ operator.Source§impl Add for LikelihoodExpression
impl Add for LikelihoodExpression
Source§type Output = LikelihoodExpression
type Output = LikelihoodExpression
The resulting type after applying the
+ operator.Source§impl Clone for LikelihoodExpression
impl Clone for LikelihoodExpression
Source§fn clone(&self) -> LikelihoodExpression
fn clone(&self) -> LikelihoodExpression
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl CostFunction<MaybeThreadPool, LadduError> for LikelihoodExpression
impl CostFunction<MaybeThreadPool, LadduError> for LikelihoodExpression
Source§fn evaluate(
&self,
parameters: &DVector<f64>,
args: &MaybeThreadPool,
) -> LadduResult<f64>
fn evaluate( &self, parameters: &DVector<f64>, args: &MaybeThreadPool, ) -> LadduResult<f64>
The evaluation of the function at a point
x with the given arguments/user data. Read moreSource§impl Debug for LikelihoodExpression
impl Debug for LikelihoodExpression
Source§impl Default for LikelihoodExpression
impl Default for LikelihoodExpression
Source§fn default() -> LikelihoodExpression
fn default() -> LikelihoodExpression
Returns the “default value” for a type. Read more
Source§impl Display for LikelihoodExpression
impl Display for LikelihoodExpression
Source§impl Gradient<MaybeThreadPool, LadduError> for LikelihoodExpression
impl Gradient<MaybeThreadPool, LadduError> for LikelihoodExpression
Source§fn gradient(
&self,
parameters: &DVector<f64>,
args: &MaybeThreadPool,
) -> LadduResult<DVector<f64>>
fn gradient( &self, parameters: &DVector<f64>, args: &MaybeThreadPool, ) -> LadduResult<DVector<f64>>
The evaluation of the gradient at a point
x with the given arguments/user data. Read moreSource§fn evaluate_with_gradient(
&self,
x: &Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>,
args: &U,
) -> Result<(f64, Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>), E>
fn evaluate_with_gradient( &self, x: &Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>, args: &U, ) -> Result<(f64, Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>), E>
The evaluation of both the function and its gradient at a point
x with the given
arguments/user data. Read moreSource§fn hessian(
&self,
x: &Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>,
args: &U,
) -> Result<Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>, E>
fn hessian( &self, x: &Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>, args: &U, ) -> Result<Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>, E>
The evaluation of the hessian at a point
x with the given arguments/user data. Read moreSource§fn gradient_with_hessian(
&self,
x: &Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>,
args: &U,
) -> Result<(Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>, Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>), E>
fn gradient_with_hessian( &self, x: &Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>, args: &U, ) -> Result<(Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>, Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>), E>
The evaluation of both the gradient and hessian at a point
x with the given
arguments/user data. Read moreSource§fn evaluate_with_gradient_and_hessian(
&self,
x: &Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>,
args: &U,
) -> Result<(f64, Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>, Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>), E>
fn evaluate_with_gradient_and_hessian( &self, x: &Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>, args: &U, ) -> Result<(f64, Matrix<f64, Dyn, Const<1>, VecStorage<f64, Dyn, Const<1>>>, Matrix<f64, Dyn, Dyn, VecStorage<f64, Dyn, Dyn>>), E>
The evaluation of the function, gradient, and hessian at a point
x with the given
arguments/user data. Read moreSource§impl LikelihoodTerm for LikelihoodExpression
impl LikelihoodTerm for LikelihoodExpression
Source§fn evaluate(&self, parameters: &[f64]) -> LadduResult<f64>
fn evaluate(&self, parameters: &[f64]) -> LadduResult<f64>
Evaluate the term given some input parameters.
Source§fn evaluate_gradient(&self, parameters: &[f64]) -> LadduResult<DVector<f64>>
fn evaluate_gradient(&self, parameters: &[f64]) -> LadduResult<DVector<f64>>
Evaluate the gradient of the term given some input parameters.
Source§fn fix_parameter(&self, name: &str, value: f64) -> LadduResult<()>
fn fix_parameter(&self, name: &str, value: f64) -> LadduResult<()>
Fix a named parameter local to this term.
Source§fn free_parameter(&self, name: &str) -> LadduResult<()>
fn free_parameter(&self, name: &str) -> LadduResult<()>
Mark a named parameter local to this term as free.
Source§fn rename_parameter(&self, old: &str, new: &str) -> LadduResult<()>
fn rename_parameter(&self, old: &str, new: &str) -> LadduResult<()>
Rename a single parameter local to this term.
Source§fn rename_parameters(
&self,
mapping: &HashMap<String, String>,
) -> LadduResult<()>
fn rename_parameters( &self, mapping: &HashMap<String, String>, ) -> LadduResult<()>
Rename multiple parameters local to this term.
Source§fn parameter_map(&self) -> ParameterMap
fn parameter_map(&self) -> ParameterMap
Return the parameters owned by this term in local order.
Source§fn into_expression(self) -> LadduResult<LikelihoodExpression>where
Self: Sized + 'static,
fn into_expression(self) -> LadduResult<LikelihoodExpression>where
Self: Sized + 'static,
Convenience helper to wrap a likelihood term into a
LikelihoodExpression. Read moreSource§impl LogDensity<MaybeThreadPool, LadduError> for LikelihoodExpression
impl LogDensity<MaybeThreadPool, LadduError> for LikelihoodExpression
Source§fn log_density(
&self,
parameters: &DVector<f64>,
args: &MaybeThreadPool,
) -> LadduResult<f64>
fn log_density( &self, parameters: &DVector<f64>, args: &MaybeThreadPool, ) -> LadduResult<f64>
The log of the evaluation of the density function at a point
x with the given arguments/user data. Read moreSource§impl Mul<&LikelihoodExpression> for &LikelihoodExpression
impl Mul<&LikelihoodExpression> for &LikelihoodExpression
Source§type Output = LikelihoodExpression
type Output = LikelihoodExpression
The resulting type after applying the
* operator.Source§impl Mul<&LikelihoodExpression> for LikelihoodExpression
impl Mul<&LikelihoodExpression> for LikelihoodExpression
Source§type Output = LikelihoodExpression
type Output = LikelihoodExpression
The resulting type after applying the
* operator.Source§impl Mul<LikelihoodExpression> for &LikelihoodExpression
impl Mul<LikelihoodExpression> for &LikelihoodExpression
Source§type Output = LikelihoodExpression
type Output = LikelihoodExpression
The resulting type after applying the
* operator.Source§impl Mul for LikelihoodExpression
impl Mul for LikelihoodExpression
Source§type Output = LikelihoodExpression
type Output = LikelihoodExpression
The resulting type after applying the
* operator.Auto Trait Implementations§
impl Freeze for LikelihoodExpression
impl !RefUnwindSafe for LikelihoodExpression
impl Send for LikelihoodExpression
impl Sync for LikelihoodExpression
impl Unpin for LikelihoodExpression
impl UnsafeUnpin for LikelihoodExpression
impl !UnwindSafe for LikelihoodExpression
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.