Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
Fit.h
Go to the documentation of this file.
1#ifndef FIT_H
2#define FIT_H
3
4#include <vector>
5#include <functional>
6
7#include "BaseLikelihood.h"
9#include "IContourExtractor.h"
10#include "Math.h"
11#include "ContourEngine.h"
12#include "ContourObserver.h"
13
37 bool run_hesse = true;
38
40 bool request_minos = false;
41
43 bool verbose = false;
44
46 unsigned strategy = 0;
47
49 unsigned max_fcn = 0;
50
52 double tolerance = 0.0;
53
59
62
65
67 bool trace_first_evals = false;
68
70 std::size_t trace_max_evals = 25;
71};
72
77enum class ProfileBackend {
79 MINUIT,
80
83};
84
112
129class MLFitter {
130public:
144 MLFitter(std::shared_ptr<LikelihoodContext> ctx, const ModelFn& model, MLFitOptions options = {});
145
155 explicit MLFitter(std::shared_ptr<BaseLikelihood> like, MLFitOptions options = {});
156
169 FitResult maximum_likelihood_fit(const std::vector<double>& p0);
170
185 Contour contour(std::size_t x_id, std::size_t y_id, double z, std::array<double, 4> bounds, ContourOptions options) const;
186
187private:
188 std::shared_ptr<BaseLikelihood> like_;
189 MLFitOptions fit_options_;
190 FitResult master_fit_result;
191 bool master_fit_success = false;
192};
193
194#endif // FIT_H
Concrete profileable likelihood built from a model and joint distributions.
std::function< std::vector< double >(const std::vector< double > &p, const std::vector< double > &eta)> ModelFn
Model function signature used by BaseLikelihood.
High-level engine for profiled two-dimensional likelihood contours.
ContourAlgorithm
Algorithm family used to extract contour paths from the profiled field.
@ MINUIT
Minuit contour extractor.
ProfilingMethod
Strategy used to reduce the full likelihood to a 2D profile.
@ SLICE
Fix all fit parameters except nuisances; scan only the selected axes.
Progress-event types and callback interface for contour extraction.
std::function< void(const ContourProgressEvent &)> ContourProgressCallback
Callback signature used to receive contour progress events.
ProfileBackend
Backend used to profile nuisance parameters during contour building.
Definition Fit.h:77
Common data structures and interface for 2D contour extraction.
Profiling strategies used to build two-dimensional likelihood scan requests.
High-level driver for likelihood minimization and 2D contour extraction.
Definition Fit.h:129
FitResult maximum_likelihood_fit(const std::vector< double > &p0)
Runs the global maximum-likelihood fit.
Definition Fit.cpp:392
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.
Definition Fit.cpp:545
Runtime options controlling 2D contour computation.
Definition Fit.h:93
ContourProgressCallback on_progress
Definition Fit.h:110
std::size_t resolution
Definition Fit.h:107
ContourAlgorithm primary_contour_method
Definition Fit.h:101
ProfilingMethod profiling_method
Definition Fit.h:95
ProfileBackend profile_backend
Definition Fit.h:98
std::optional< ContourAlgorithm > fallback_contour_method
Definition Fit.h:104
Output of a contour extraction algorithm.
Summary of a global likelihood fit.
Runtime options controlling the global maximum-likelihood fit.
Definition Fit.h:35
unsigned max_fcn
Definition Fit.h:49
bool request_minos
Definition Fit.h:40
unsigned strategy
Definition Fit.h:46
double profile_hessian_eig_floor_rel
Definition Fit.h:64
bool trace_first_evals
Definition Fit.h:67
double profile_hessian_step_scale
Definition Fit.h:61
bool run_hesse
Definition Fit.h:37
std::size_t trace_max_evals
Definition Fit.h:70
bool allow_profile_hessian_fallback
Definition Fit.h:58
double tolerance
Definition Fit.h:52
bool verbose
Definition Fit.h:43