pub struct Likelihood { /* private fields */ }Expand description
A resolved collection of likelihood terms sharing one parameter layout.
Implementations§
Source§impl Likelihood
impl Likelihood
Sourcepub fn cross_section(
self: &Arc<Likelihood>,
term_name: impl Into<String>,
generated_mc: Dataset,
luminosity: f64,
parameters: Vec<f64>,
) -> Result<CrossSection, LikelihoodError>
pub fn cross_section( self: &Arc<Likelihood>, term_name: impl Into<String>, generated_mc: Dataset, luminosity: f64, parameters: Vec<f64>, ) -> Result<CrossSection, LikelihoodError>
Prepares a central-value cross-section analysis from a shared likelihood.
§Errors
Returns an error for invalid inputs or likelihood preparation failure.
Sourcepub fn cross_section_with_ensemble(
self: &Arc<Likelihood>,
term_name: impl Into<String>,
generated_mc: Dataset,
luminosity: f64,
parameters: Vec<f64>,
ensemble: Ensemble,
) -> Result<CrossSection, LikelihoodError>
pub fn cross_section_with_ensemble( self: &Arc<Likelihood>, term_name: impl Into<String>, generated_mc: Dataset, luminosity: f64, parameters: Vec<f64>, ensemble: Ensemble, ) -> Result<CrossSection, LikelihoodError>
Prepares an ensemble-backed cross-section analysis.
§Errors
Returns an error for invalid inputs, mismatched draws, or preparation failure.
Source§impl Likelihood
impl Likelihood
Sourcepub fn new<T>(
terms: impl IntoIterator<Item = T>,
) -> Result<Likelihood, LikelihoodError>where
T: LikelihoodTerm + 'static,
pub fn new<T>(
terms: impl IntoIterator<Item = T>,
) -> Result<Likelihood, LikelihoodError>where
T: LikelihoodTerm + 'static,
Construct a likelihood from terms of one concrete type.
The terms are boxed internally, so the common case does not require a
manual LikelihoodTerm::boxed call.
§Errors
Returns LikelihoodError when term names or parameter definitions
conflict, or a term cannot be resolved.
Sourcepub fn new_boxed(
terms: impl IntoIterator<Item = Box<dyn LikelihoodTerm>>,
) -> Result<Likelihood, LikelihoodError>
pub fn new_boxed( terms: impl IntoIterator<Item = Box<dyn LikelihoodTerm>>, ) -> Result<Likelihood, LikelihoodError>
Construct a likelihood containing heterogeneous, already boxed terms.
§Errors
Returns LikelihoodError when term names or parameter definitions
conflict, or a term cannot be resolved.
Sourcepub fn with_execution<T>(
terms: impl IntoIterator<Item = T>,
execution: &Execution,
) -> Result<Likelihood, LikelihoodError>where
T: LikelihoodTerm + 'static,
pub fn with_execution<T>(
terms: impl IntoIterator<Item = T>,
execution: &Execution,
) -> Result<Likelihood, LikelihoodError>where
T: LikelihoodTerm + 'static,
Constructs a likelihood with an explicit execution context.
§Errors
Returns LikelihoodError when term names or parameter definitions
conflict, or a term cannot be resolved for execution.
Sourcepub fn with_execution_boxed(
terms: impl IntoIterator<Item = Box<dyn LikelihoodTerm>>,
execution: &Execution,
) -> Result<Likelihood, LikelihoodError>
pub fn with_execution_boxed( terms: impl IntoIterator<Item = Box<dyn LikelihoodTerm>>, execution: &Execution, ) -> Result<Likelihood, LikelihoodError>
Construct a heterogeneous likelihood using a borrowed execution setup.
§Errors
Returns LikelihoodError when term names or parameter definitions
conflict, or a term cannot be resolved for execution.
Sourcepub fn params(&self) -> &ParamLayout
pub fn params(&self) -> &ParamLayout
Returns the global parameter layout.
Sourcepub fn default_params(&self) -> Vec<f64>
pub fn default_params(&self) -> Vec<f64>
Return deterministic initial values in the order expected by Self::nll.
Sourcepub fn params_with(&self, value: impl FnMut(&Parameter) -> f64) -> Vec<f64>
pub fn params_with(&self, value: impl FnMut(&Parameter) -> f64) -> Vec<f64>
Generate one value for each free parameter in objective-vector order.
Sourcepub fn sample_initial(&self, seed: u64) -> Vec<f64>
pub fn sample_initial(&self, seed: u64) -> Vec<f64>
Sample uniform initial ranges while preserving fixed and point-initialized parameters.
Sourcepub fn bootstrap(&self, seed: u64) -> Result<Likelihood, LikelihoodError>
pub fn bootstrap(&self, seed: u64) -> Result<Likelihood, LikelihoodError>
Rebuilds this likelihood with Poisson-bootstrapped observed datasets.
§Errors
Returns LikelihoodError when a term cannot be bootstrap-cloned or
the rebuilt likelihood cannot be prepared.
Sourcepub fn terms(&self) -> &[Box<dyn LikelihoodTerm>]
pub fn terms(&self) -> &[Box<dyn LikelihoodTerm>]
Returns the resolved likelihood terms.
Sourcepub fn diagnostics(&self) -> LikelihoodDiagnostics
pub fn diagnostics(&self) -> LikelihoodDiagnostics
Returns a snapshot of preparation and objective-evaluation diagnostics.
Sourcepub fn nll<'a>(
&self,
parameters: impl Into<Parameters<'a>>,
) -> Result<f64, LikelihoodError>
pub fn nll<'a>( &self, parameters: impl Into<Parameters<'a>>, ) -> Result<f64, LikelihoodError>
Evaluate the objective from free values in Self::params order.
§Errors
Returns LikelihoodError when parameters have the wrong layout or
length, violate bounds, or a term cannot be evaluated.
Sourcepub fn nll_with_gradient<'a>(
&self,
parameters: impl Into<Parameters<'a>>,
) -> Result<LikelihoodEvaluation, LikelihoodError>
pub fn nll_with_gradient<'a>( &self, parameters: impl Into<Parameters<'a>>, ) -> Result<LikelihoodEvaluation, LikelihoodError>
Evaluates the objective and gradient from free or resolved parameter values.
§Errors
Returns LikelihoodError when parameters are invalid or a term’s
value or gradient cannot be evaluated.
Sourcepub fn stochastic_nll_with_gradient(
&self,
free_parameters: &[f64],
fraction: f64,
seed: u64,
) -> Result<LikelihoodEvaluation, LikelihoodError>
pub fn stochastic_nll_with_gradient( &self, free_parameters: &[f64], fraction: f64, seed: u64, ) -> Result<LikelihoodEvaluation, LikelihoodError>
Evaluates an unbiased stochastic objective and gradient.
§Errors
Returns LikelihoodError when fraction is outside (0, 1],
parameters are invalid, or stochastic term evaluation fails.
Sourcepub fn cross_section_integrals(
&self,
term_name: &str,
generated_mc: &Dataset,
) -> Result<CrossSectionIntegrals, LikelihoodError>
pub fn cross_section_integrals( &self, term_name: &str, generated_mc: &Dataset, ) -> Result<CrossSectionIntegrals, LikelihoodError>
Prepares accepted and generated Monte Carlo integrals for an intensity term.
§Errors
Returns LikelihoodError when term_name is missing or not an
intensity term, or dataset preparation fails.
Prepares tag-narrowed accepted and generated Monte Carlo integrals.
The selected tags define the numerator contribution. Cross sections
retain the full accepted-model normalization, matching
Self::projection.
§Errors
Returns LikelihoodError when term_name is missing or not an
intensity term, graph projection fails, or dataset preparation fails.
Sourcepub fn intensity_datasets(
&self,
term_name: &str,
) -> Result<(&Dataset, &Dataset), LikelihoodError>
pub fn intensity_datasets( &self, term_name: &str, ) -> Result<(&Dataset, &Dataset), LikelihoodError>
Returns the observed and accepted Monte Carlo sources for an intensity term.
§Errors
Returns LikelihoodError when term_name is missing or is not an
intensity term.
Sourcepub fn projection<'a>(
&self,
term_name: &str,
generated_mc: &Dataset,
tags: impl IntoIterator<Item = &'a str>,
) -> Result<LikelihoodProjection, LikelihoodError>
pub fn projection<'a>( &self, term_name: &str, generated_mc: &Dataset, tags: impl IntoIterator<Item = &'a str>, ) -> Result<LikelihoodProjection, LikelihoodError>
Projects an intensity term onto selected model tags over generated Monte Carlo.
§Errors
Returns LikelihoodError when term_name is missing or not an
intensity term, graph projection fails, or dataset preparation fails.
Trait Implementations§
Source§impl Debug for Likelihood
impl Debug for Likelihood
Source§impl Objective for Likelihood
impl Objective for Likelihood
Source§fn parameter_layout(&self) -> &ParamLayout
fn parameter_layout(&self) -> &ParamLayout
Source§fn value(&self, free_parameters: &[f64]) -> Result<f64, LikelihoodError>
fn value(&self, free_parameters: &[f64]) -> Result<f64, LikelihoodError>
Source§fn value_gradient(
&self,
free_parameters: &[f64],
) -> Result<LikelihoodEvaluation, LikelihoodError>
fn value_gradient( &self, free_parameters: &[f64], ) -> Result<LikelihoodEvaluation, LikelihoodError>
Source§impl StochasticObjective for Likelihood
impl StochasticObjective for Likelihood
Source§fn stochastic_value_gradient(
&self,
free_parameters: &[f64],
fraction: f64,
seed: u64,
) -> Result<LikelihoodEvaluation, LikelihoodError>
fn stochastic_value_gradient( &self, free_parameters: &[f64], fraction: f64, seed: u64, ) -> Result<LikelihoodEvaluation, LikelihoodError>
Auto Trait Implementations§
impl !Freeze for Likelihood
impl !RefUnwindSafe for Likelihood
impl !UnwindSafe for Likelihood
impl Send for Likelihood
impl Sync for Likelihood
impl Unpin for Likelihood
impl UnsafeUnpin for Likelihood
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
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>
self from the equivalent element of its
superset. Read moreSource§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).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.