Closed bednya closed 1 year ago
I would say the way FastLikelihood
is implemented, it is very poorly suited for pickling. For users looking for a more convenient way to work with pre-computed and reusable FastLikelihood
instances, I would advise them to use a custom smelli.GlobalLikelihood
, which has dedicated methods to save and load pickled covariance matrices.
Hi, thanks for the hint!
Hi,
I wanted to re-use FaslLikelihood object after a make_measurement call. Dumping it as a YAML string or stream seems to abandon the pseudomeasurement data, so I used the pickle module.
The problem is that after unpickling previously saved FastLikelihood object, the pseudomeasurement does not appear in the list of instances of the Measurement class. As a consequence, functions like likelihood.log_likelihood failed to return correct values.
For example, saving FastLikelihood via
and loading the object (after a kernel restart) via
produces 0.0 as an output of
Probably, there is a better solution to the problem, but for the time being I wrote a small workaround 20a30b8 that manually adds the loaded pseudomeasurement to the instance list.