sgriswol / flarestack

Unbinned likelihood analysis code for astroparticle physics datasets
MIT License
0 stars 0 forks source link

Add Hamiltonian Monte Carlo to Flarestack #1

Open sgriswol opened 2 years ago

sgriswol commented 2 years ago

It appears that most of the code needed to perform a fit on source weights, spectral index and number of source weights is already included in the flarestack.core.minimisation.FitWeightMinimisationHandler class. The minimization is performed in the run_trial method, and is called during execution of submitter.analyse(). Another class that is relevant to this execution is the flarestack.core.multiprocess_wrapper.MultiProcessor class. Two methods of this class in particular are relevant to creation and execution of the minimizer, __init__ where process instances are created and started, and run_trial which ultimately calls run_trial and performs the minimization.

In short, adding something to the effect of the following should put us in the right direction towards adding HMC to Flarestack.

@MinimisationHandler.register_subclass("fit_weights_hmc")
class FitWeightHMCMinimisationHandler(FitWeightMinimisationHandler):
    def run_trial(self, full_dataset):
        ...
        return ...
sgriswol commented 2 years ago

A brief procedure for achieving this could be

  1. Put HMC into run_trial function for the new class
  2. Get the example notebooks running with the new minimizer
  3. Run comparison of our minimizer to example minimizer (sanity check)