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

High-level driver for likelihood minimization and 2D contour extraction. More...

#include <Fit.h>

Public Member Functions

 MLFitter (std::shared_ptr< LikelihoodContext > ctx, const ModelFn &model, MLFitOptions options={})
 Constructs a fitter from a likelihood context and model function.
 
 MLFitter (std::shared_ptr< BaseLikelihood > like, MLFitOptions options={})
 Constructs a fitter from an already configured base likelihood.
 
FitResult maximum_likelihood_fit (const std::vector< double > &p0)
 Runs the global maximum-likelihood fit.
 
Contour contour (std::size_t x_id, std::size_t y_id, double z, std::array< double, 4 > bounds, ContourOptions options) const
 Computes a 2D confidence contour after the global fit.
 

Detailed Description

High-level driver for likelihood minimization and 2D contour extraction.

MLFitter owns a profileable likelihood, performs the global maximum- likelihood fit, stores the best-fit state, and subsequently builds confidence contours for selected fit-parameter pairs.

Typical usage:

Note
Contour computation requires a successful prior call to maximum_likelihood_fit.

Definition at line 129 of file Fit.h.

Constructor & Destructor Documentation

◆ MLFitter() [1/2]

MLFitter::MLFitter ( std::shared_ptr< LikelihoodContext ctx,
const ModelFn model,
MLFitOptions  options = {} 
)

Constructs a fitter from a likelihood context and model function.

A BaseLikelihood is created internally. The number of fit parameters is inferred from ctx->fp_defs.

Parameters
ctxLikelihood context containing distributions, observations and parameter definitions.
modelModel function mapping fit and nuisance parameters to predicted observables.
optionsFit options controlling the minimization and covariance extraction.

Definition at line 376 of file Fit.cpp.

◆ MLFitter() [2/2]

MLFitter::MLFitter ( std::shared_ptr< BaseLikelihood like,
MLFitOptions  options = {} 
)
explicit

Constructs a fitter from an already configured base likelihood.

Parameters
likeLikelihood object used by the fitter.
optionsFit options controlling the minimization and covariance extraction.
Exceptions
std::invalid_argumentif like is null.

Definition at line 383 of file Fit.cpp.

Member Function Documentation

◆ contour()

Contour MLFitter::contour ( std::size_t  x_id,
std::size_t  y_id,
double  z,
std::array< double, 4 >  bounds,
ContourOptions  options 
) const

Computes a 2D confidence contour after the global fit.

Parameters
x_idIndex of the first fit parameter in the global fit-parameter block.
y_idIndex of the second fit parameter in the global fit-parameter block.
zGaussian-equivalent confidence level in standard deviations.
boundsContour bounds ordered as {xmin, xmax, ymin, ymax}.
optionsContour and profiling options.
Returns
Extracted contour at the requested level.
Precondition
maximum_likelihood_fit must have been called successfully.

Definition at line 545 of file Fit.cpp.

◆ maximum_likelihood_fit()

FitResult MLFitter::maximum_likelihood_fit ( const std::vector< double > &  p0)

Runs the global maximum-likelihood fit.

The fit parameters are initialized from p0, while nuisance parameters keep the values stored in the likelihood parameter definitions. The returned FitResult contains the best-fit values, profiled nuisance estimates, minimum NLL, and covariance-derived uncertainties when available.

Parameters
p0Initial values for the fit-parameter block.
Returns
Global fit result.

Definition at line 392 of file Fit.cpp.


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