Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
WithGaussianConstraints Class Reference

Decorates a likelihood with Gaussian constraints on selected parameters. More...

#include <WithGaussianConstraints.h>

Inheritance diagram for WithGaussianConstraints:
Collaboration diagram for WithGaussianConstraints:

Public Member Functions

 WithGaussianConstraints (std::shared_ptr< ILikelihood > base, std::shared_ptr< JointDistribution > constraints_dist, std::vector< std::size_t > constrained_params)
 Constructs a constrained likelihood wrapper.
 
double nll (const std::vector< double > &theta) const override
 Evaluates the constrained negative log-likelihood.
 
std::vector< fit_app::ParameterDefinitionget_param_defs () const override
 Returns the metadata describing the likelihood parameters.
 
std::size_t dim () const override
 Returns the total dimension of the parameter vector.
 
- Public Member Functions inherited from ILikelihood
virtual ~ILikelihood ()=default
 Virtual destructor for safe polymorphic deletion.
 

Detailed Description

Decorates a likelihood with Gaussian constraints on selected parameters.

The class is useful when a profile or projection should keep some parameters weakly constrained around a fitted central value. For a full parameter vector $\theta$, the objective evaluated by this wrapper is

\[
  \mathrm{NLL}_{\mathrm{total}}(\theta)
  = \mathrm{NLL}_{\mathrm{base}}(\theta)
    - \log p_{\mathrm{constraint}}(\theta_{I}),
\]

where $\theta_I$ is the sub-vector selected by constrained_params.

Note
The wrapper does not own or modify parameter definitions. It forwards metadata and dimensionality queries to the wrapped likelihood.

Definition at line 37 of file WithGaussianConstraints.h.

Constructor & Destructor Documentation

◆ WithGaussianConstraints()

WithGaussianConstraints::WithGaussianConstraints ( std::shared_ptr< ILikelihood base,
std::shared_ptr< JointDistribution constraints_dist,
std::vector< std::size_t >  constrained_params 
)

Constructs a constrained likelihood wrapper.

Parameters
baseBase likelihood to evaluate first.
constraints_distJoint distribution defining the Gaussian prior-like constraint on the selected parameters.
constrained_paramsIndices of the full parameter-vector components passed to constraints_dist, in distribution order.

Definition at line 3 of file WithGaussianConstraints.cpp.

Member Function Documentation

◆ dim()

std::size_t WithGaussianConstraints::dim ( ) const
overridevirtual

Returns the total dimension of the parameter vector.

Returns
Number of scalar parameters expected by nll.

Implements ILikelihood.

Definition at line 29 of file WithGaussianConstraints.cpp.

◆ get_param_defs()

std::vector< fit_app::ParameterDefinition > WithGaussianConstraints::get_param_defs ( ) const
overridevirtual

Returns the metadata describing the likelihood parameters.

The returned definitions are expected to follow the same ordering as the parameter vector accepted by nll.

Returns
Ordered list of parameter definitions.

Implements ILikelihood.

Definition at line 25 of file WithGaussianConstraints.cpp.

◆ nll()

double WithGaussianConstraints::nll ( const std::vector< double > &  theta) const
overridevirtual

Evaluates the constrained negative log-likelihood.

The returned value is the sum of the base NLL and the constraint penalty $-\log p_{\mathrm{constraint}}$ evaluated on the constrained subset.

Parameters
thetaFull parameter vector passed to the base likelihood.
Returns
Constrained negative log-likelihood value.
Exceptions
std::out_of_rangeif a constrained parameter index is outside theta.
std::exceptionforwarded from the base likelihood or constraint distribution.

Implements ILikelihood.

Definition at line 12 of file WithGaussianConstraints.cpp.


The documentation for this class was generated from the following files: