DarkMachines / pyBAMBI

Resurrecting BAMBI for the pythonic deep learning era
MIT License
4 stars 5 forks source link

Define interesting likelihood functions for testing #15

Open williamjameshandley opened 5 years ago

williamjameshandley commented 5 years ago

This can be done in parallel to #4 , in order to try to find a good neural network architecture @melli1992

cbalazs commented 5 years ago

To get the ball rolling, here are a few initial suggestions.

  1. Goldstein-Price function: 𝑓(π‘₯1, π‘₯2) = [1 + (π‘₯1 + π‘₯2 + 1)^2(19 βˆ’ 14π‘₯1 + 3π‘₯1^2 βˆ’ 14π‘₯2 + 6π‘₯1π‘₯2 + 3π‘₯2^2)] Γ— [30 + (2π‘₯1 βˆ’ 3π‘₯2)^2(18 βˆ’ 32π‘₯1 + 12π‘₯1^2 + 48π‘₯2 βˆ’ 36π‘₯1π‘₯2 + 27π‘₯2^2)] The Goldstein-Price function is a two-dimensional function designed to test the convergence rate of global optimisers since it is very flat near the global minimum. It is not a test function with many local minima/maxima and it's only 2 dimensional. (The typical domain of use is π‘₯𝑖 ∈ [βˆ’2, 2], 𝑖 = 1,2, and it has a global minimum of 𝑓(0, βˆ’1) = 3.)

  2. SpikeGrid function: 𝑓(π‘₯𝑖) = 1 βˆ’ |prod sin(πœ‹π‘₯𝑙/2𝑐𝑖)|^𝑠 where the product goes for 𝑖 = 1, … , 𝑑 SpikeGrid function consists of a grid of β€˜spikes’ with 𝑠 controlling the the β€˜sharpness’ of the spikes. It is similar to the egg-holder function but nastier since the spikes can be made arbitrarily sharp. It's disadvantage is that it's periodic, so it might be 'easy' to learn.

  3. Schwefel function: 𝑓(π‘₯𝑖) = 418.9829𝑑 βˆ’βˆ‘ π‘₯𝑖 sin(√|π‘₯𝑖|) where the sum goes for 𝑖 = 1, … , 𝑑 The Schwefel function is highly multi-modal, similar to the egg-holder function but better for testing since the depth and height of the minima and maxima varies with location. Although, it's still periodic. (The typical domain of use is π‘₯𝑖 ∈ [βˆ’500, 500], 𝑖 = 1, … , 𝑑, and it has a global minimum of 𝑓(420.9687, … , 420.9687) = 0.)

    1. CMSSM likelihood function. We cannot get more realistic than using a physical test case! GAMBIT sampled the CMSSM and calculated a likelihood function (including many observables) in 2017. The function is very well sampled: an order of 100 million samples were generated! The function is available for download at https://zenodo.org/communities/gambit-official/. Drawbacks are: the function is over a 4(real para)+~10(nuisances) dimensional space, the function is only available at discrete points (i.e. defined numerically), and the samples can be cumbersome to handle. Same likelihood functions are available for the NUHM1, NUHM2, the MSSM-7, the SM + scalar/fermion/vector singlet, and QCD axion models.
williamjameshandley commented 5 years ago

These are all good ideas @cbalazs . Other examples might include the ones in the MultiNest paper (e.g. rastrigin, rosenbrock, gaussian shell and himmelblau).

I think the best way to start on this would be to create a module pybambi/example_likelihoods.py, and define these functions in there. There should also be a method for generating samples from these distributions using MultiNest and PolyChord (interfaces are provided in the pybambi.MultiNest and pybambi.PolyChord modules), using the outputs of either the _equal_weights.txtor .txt files. You'll need a corresponding test files in tests/test_example_likelihoods.py to confirm that the functions produce the correct values for a small set of example inputs.

Once you've done that on a local fork, you should create a pull request where we can discuss any further changes to the code. Reference this issue with the tag #15