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

Interface for a model capable of producing observable predictions. More...

#include <IModel.h>

Inheritance diagram for IModel:

Public Member Functions

virtual ~IModel ()=default
 Default virtual destructor.
 
virtual std::shared_ptr< IModelclone_for_worker () const
 Returns an isolated model instance suitable for one worker thread.
 
virtual bool can_clone_for_worker () const
 Whether clone_for_worker is implemented.
 
virtual std::unique_ptr< IModelThreadGuardforce_decay_threads (size_t)
 Temporarily force internal model/decay thread counts.
 
virtual void prepare_for_prediction ()
 Materialize model-side runtime state before repeated predictions.
 
virtual std::map< ObservableId, std::vector< ObservableValue > > predict_optimized (const std::map< ParamId, double > &p, const std::map< ParamId, double > &eta)=0
 Computes model predictions for a given parameter point.
 
virtual std::size_t n_observables () const =0
 Returns the number of currently active binned observables.
 
virtual std::unordered_set< ParamIdget_obs_deps (ObservableId id)=0
 Returns the model parameters required by an observable.
 
virtual std::vector< BinnedObservableIdget_obs_ids ()=0
 Returns the identifiers of the currently active observable bins.
 
virtual void compute_observables () const =0
 Forces computation of the currently configured observables.
 

Detailed Description

Interface for a model capable of producing observable predictions.

The statistical code interacts with concrete model implementations only through this interface. A model receives two parameter maps:

  • fit parameters p, usually the parameters of interest,
  • nuisance parameters eta, usually auxiliary or external inputs.

Implementations may cache intermediate state internally, but calls to predict_optimized should return predictions consistent with the provided parameter maps.

Definition at line 42 of file IModel.h.

Constructor & Destructor Documentation

◆ ~IModel()

virtual IModel::~IModel ( )
virtualdefault

Default virtual destructor.

Member Function Documentation

◆ can_clone_for_worker()

virtual bool IModel::can_clone_for_worker ( ) const
inlinevirtual

Whether clone_for_worker is implemented.

Reimplemented in ObservableInterfaceProxy.

Definition at line 57 of file IModel.h.

◆ clone_for_worker()

virtual std::shared_ptr< IModel > IModel::clone_for_worker ( ) const
inlinevirtual

Returns an isolated model instance suitable for one worker thread.

Implementations that cannot provide isolation should return nullptr.

Reimplemented in ObservableInterfaceProxy.

Definition at line 52 of file IModel.h.

◆ compute_observables()

virtual void IModel::compute_observables ( ) const
pure virtual

Forces computation of the currently configured observables.

This method is primarily used to initialize or refresh model-side caches before the statistical manager builds likelihood inputs.

Implemented in ObservableInterfaceProxy.

◆ force_decay_threads()

virtual std::unique_ptr< IModelThreadGuard > IModel::force_decay_threads ( size_t  )
inlinevirtual

Temporarily force internal model/decay thread counts.

The returned guard restores the previous state on destruction. Implementations that do not support runtime thread control may return nullptr.

Reimplemented in ObservableInterfaceProxy.

Definition at line 65 of file IModel.h.

◆ get_obs_deps()

virtual std::unordered_set< ParamId > IModel::get_obs_deps ( ObservableId  id)
pure virtual

Returns the model parameters required by an observable.

Parameters
idObservable identifier.
Returns
Set of parameter identifiers on which the observable depends.

Implemented in ObservableInterfaceProxy, and BToMuMuToy.

◆ get_obs_ids()

virtual std::vector< BinnedObservableId > IModel::get_obs_ids ( )
pure virtual

Returns the identifiers of the currently active observable bins.

Returns
Ordered list of binned observable identifiers.

Implemented in ObservableInterfaceProxy.

◆ n_observables()

virtual std::size_t IModel::n_observables ( ) const
pure virtual

Returns the number of currently active binned observables.

Returns
Number of observable bins exposed by the model.

Implemented in ObservableInterfaceProxy, and BToMuMuToy.

◆ predict_optimized()

virtual std::map< ObservableId, std::vector< ObservableValue > > IModel::predict_optimized ( const std::map< ParamId, double > &  p,
const std::map< ParamId, double > &  eta 
)
pure virtual

Computes model predictions for a given parameter point.

Parameters
pMap of fit-parameter identifiers to values.
etaMap of nuisance-parameter identifiers to values.
Returns
Predicted observable values grouped by observable identifier.

Implemented in ObservableInterfaceProxy.

◆ prepare_for_prediction()

virtual void IModel::prepare_for_prediction ( )
inlinevirtual

Materialize model-side runtime state before repeated predictions.

Implementations may use this hook to lazily build dependent parameter blocks, Wilson groups, decay caches, or other mutable runtime structures that must exist before the first parameter update is committed. The default implementation is a no-op so existing non-cloneable models keep their previous behavior.

Reimplemented in ObservableInterfaceProxy.

Definition at line 76 of file IModel.h.


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