Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to give samplers access to an object that cannot be deep-copied? #129

Open
maximerischard opened this issue Nov 8, 2017 · 2 comments

Comments

@maximerischard
Copy link

I'm implementing a coupled MCMC algorithm, wherein two chains run in parallel but need to communicate with each other. I'm trying to build this on top of Mamba, and have implemented an object that takes care of the communication between the two chains (it provides input and output channels for each chain).

What is the best way to provide access to the communication channels to the samplers?

I've tried putting them inside of the SampleTune objects, but the many calls to deepcopy are thwarting me. The communication channels are deep-copied, so that the two chains no longer share the same channels and can't communicate. It also seems like that's not what SampleTune objects are intended for.

What's a better way to do this? I'd be happy to provide more details if this is too abstract.

@bdeonovic
Copy link
Contributor

Without knowing more about the object I'll make some silly suggestions like would it work to put your object in the data dict or the init dict?

@maximerischard
Copy link
Author

Thank you for that suggestion. Each chain needs its own separate channel, so init would make more sense than the data dict. But ultimately, the channels need to be available in the sample! function, which as far as I can tell means they'll have to find their way into a SampleTune object of some sort. I've got this working for a stand-alone sampler now, but still trying to get it to work for a Model specification.

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

No branches or pull requests

2 participants