First implemtation of bpc IO container#72
Conversation
|
Note that you can make this a bit more automated by overloading the custom serialization interface: https://juliaio.github.io/JLD2.jl/dev/customserialization (so then you don't have to do the conversion manually, it will automatically write a BeliefPropagationCache as a BPCContainer and read it back as a BeliefPropagationCache). |
|
Hey @mtfishman, thanks for the suggestion and sorry for the late reply (been on vacation). I wrote this little piece of code because older versions of the repo, for some reason that I cannot reproduce today, would always throw an error when trying to write a BeliefPropagationCache object to JLD2. As I learned the hard way some weeks ago, this should be done, however, since only storing the network (and not the messages) and then calling update(network) can give you vastly different messages and vastly different measurements from the original BeliefPropagationCache object. It seems that current versions of the repo allow you to store BeliefPropagationCache objects directly in JLD2, so this PR is no longer necessary I think (unless it is somehow more stable but I could not find a difference as of now). |
|
Yeah I think this is no longer necessary as serialization works on the latest version of the library for the BP Cache. |
Lightweight struct that allows saving/loading of BeliefPropagationCache objects to/from jld2 files. To save it, simply use "JLD2.save(jld2_f, Dict("bpc" => BPCContainer(ψ_bpc)))" and to reconstruct it use "BeliefPropagationCache(JLD2.load(jld2_f)["bpc"])".