Skip to content

First implemtation of bpc IO container#72

Closed
EbertPaul wants to merge 1 commit into
JoeyT1994:mainfrom
EbertPaul:BPC_container
Closed

First implemtation of bpc IO container#72
EbertPaul wants to merge 1 commit into
JoeyT1994:mainfrom
EbertPaul:BPC_container

Conversation

@EbertPaul

Copy link
Copy Markdown
Contributor

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"])".

@mtfishman

Copy link
Copy Markdown
Contributor

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).

@EbertPaul

Copy link
Copy Markdown
Contributor Author

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).

@JoeyT1994

Copy link
Copy Markdown
Owner

Yeah I think this is no longer necessary as serialization works on the latest version of the library for the BP Cache.

@JoeyT1994 JoeyT1994 closed this Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants