Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
ProfiledLikelihood2D.cpp
Go to the documentation of this file.
2
4 std::shared_ptr<ILikelihood> base,
5 std::shared_ptr<Profiler> profiler,
6 std::shared_ptr<IProfilingStrategy> profiling_strategy
7)
8: base(std::move(base)),
9 profiler(std::move(profiler)),
10 profiling_strategy(std::move(profiling_strategy))
11{
12 this->last = this->profiling_strategy->init_warm_start();
13}
14
15double ProfiledLikelihood2D::profiled_nll(double px, double py) {
16 ProfileRequest pr = profiling_strategy->build_request(px, py, this->last);
17 ProfileResult res = profiler->profile(base, pr);
18
19 if (res.converged) {
20 this->last = res.theta_hat;
21 return res.nll_hat;
22 }
23
24 if (std::isfinite(res.nll_hat)) {
25 LOG_INFO("[PROFILED_NLL] weak profile at (", px, ',', py, "), using finite value", res.nll_hat);
26 return res.nll_hat;
27 }
28
29 LOG_INFO("[PROFILED_NLL] rejected point (", px, ',', py, "), using fallback penalty");
30 return 1e300;
31}
32
33std::array<fit_app::ParameterDefinition, 2> ProfiledLikelihood2D::get_param_defs() const {
34 auto all_p_defs = this->base->get_param_defs();
35 return {
36 all_p_defs[this->profiling_strategy->get_x_id()],
37 all_p_defs[this->profiling_strategy->get_y_id()]
38 };
39}
#define LOG_INFO(...)
Macro for logging informational messages.
Definition Logger.h:39
Two-dimensional profiled likelihood wrapper.
ProfiledLikelihood2D()=default
Default constructor.
double profiled_nll(double px, double py)
Evaluates the profiled NLL at one 2D scan point.
std::array< fit_app::ParameterDefinition, 2 > get_param_defs() const
Returns the parameter definitions for the two scan coordinates.
Hash specialization for SymbolId<Tag>.
Definition BlockName.h:353
Input specification for a constrained profile minimization.
Definition Profiler.h:38
Output of a constrained profile minimization.
Definition Profiler.h:48
double nll_hat
Minimum or approximate profiled NLL value.
Definition Profiler.h:49
bool converged
True when the profiler accepted the result as reliable.
Definition Profiler.h:51
std::map< std::size_t, double > theta_hat
Profiled parameter values keyed by global parameter index.
Definition Profiler.h:50