Hi all,
I am currently engaged in modelling/forecasting SARS-CoV-2 transmission (like everyone else it feels like…).
My current work flow involves parameter inference, and I contain all the relevant information about what I’ve inferred about various parameters in a struct. I then save these structs using JLD2
.
One of the fields of the struct is the log-prior function and another is the log-likelihood function. Therefore, each of these struct contains all the data, transmission model, and statistical model information I need to replicate the analysis.
This was not a problem, since JLD2 saves (or saved?) the names of each function; each function name corresponds to a defined option in my TransmissionModels Module e.g. one function might be TransmissionModel.negative_binomial_PCR_model
, and another might be TransmissionModel.beta_binomial_PCR_model
. So long as TransmissionModels
was imported before loading the saved structs this was not a problem.
However, now JLD2 is throwing an error:
typeof(TransmissionModel.negative_binomial_PCR_model)() not defined.
I’ve ‘solved’ the problem by pinning back to JLD2 0.2.0, but I was wondering if anyone had a suggestion for saving functions as a field in a struct using JLD2 (or whatever other IO package).