SWIFTSIM / emulator

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

refactor_emulators_to_consistent_api #15

Closed JBorrow closed 3 years ago

JBorrow commented 3 years ago

Changes the API of all four emulators to be consistent. They all now have consistent parameters for fit_model and predict_model, with the specifiers for the behaviour of each emulator being given to the initialisers instead.

So before we would do (for a generic emulator):

emulator = Emulator(model_specifcation=model_specification, ...)
emulator.fit_model(
  size_of_model=10,
  walkers=11
)

Now, we do:

emulator = Emulator(size_of_model=10, walkers=11)
emulator.fit_model(model_specifcation=model_specification, ...)

Why this change?

This consitent API allows us to programatically compare different methods of training the emulator against each other. It is also much more consistent with other machine learning packages out there, that specify the behaviour of the model in the initialiser and the data in the training method.

JBorrow commented 3 years ago

Currently failing on the cross check

JBorrow commented 3 years ago

Now fixed the cross check

Moyoxkit commented 3 years ago

Looks good! I'll try and give it a test soon to see if everything is working.

Moyoxkit commented 3 years ago

Everything seems to be working smoothly! (and it was way less effort than expected to switch). Sadly it doesn't seem to be quicker (which would have been odd anyway).