SWIFTSIM / emulator

The SWIFT simulation cosmological emulator (swift-emulator)
GNU Lesser General Public License v3.0
5 stars 2 forks source link

(WIP) Added new code for hyperparameter investigation #3

Closed Moyoxkit closed 3 years ago

Moyoxkit commented 3 years ago

Adds code to create a MCMC sampling of the hyperparameters in a model. Don't look at style etc. yet. Just wondering wether you have comments on the structure, especially as we can potentially use a similar structure for the sensitivity analysis plots you showed me.

JBorrow commented 3 years ago

Hmm, are we really just wanting to use this to investigate the hyperparameters? Or in some cases would we like to use the MCMC to optimize the parameters too?

It may be better to call your new object GaussianProcessEmulatorMCMC. You should then separate out the plotting from the use of the MCMC, you can provide another method (e.g. plot_results or something) that allows for the visualisation.

Other than that this looks great!

Moyoxkit commented 3 years ago

Thats a good point. Nothing is lost if we just make this an additional way of fitting the parameters. This can then also include the (hopefully) more believable errors that take hyperparameter spread into account. For both the plotting and the error calculation I will need the MCMC samples so this will make having both a lot easier.

Moyoxkit commented 3 years ago

Everything should now be in place for the mcmc version of the emulator. Also has a separate function for plotting hyperparameters and has the option to add the hyperparameter errors. My current tests show that the errors caused by uncertain hyperparameters are about a third of the size of the regular emulator errors (so not that important but still nice to know.)

Still to do: formatting

Moyoxkit commented 3 years ago

Formatting should now be at a reviewable level

Moyoxkit commented 3 years ago

Some bad branch management caused me to swap back some of the stuff that was there already, should be good again now.

JBorrow commented 3 years ago

Can you add a basic test to make sure when running this the code makes it to the end?

JBorrow commented 3 years ago

Happy to merge when you are

Moyoxkit commented 3 years ago

Done :D Thanks for the comments!

JBorrow commented 3 years ago

Excellent! Thanks so much for adding this