pymc icon indicating copy to clipboard operation
pymc copied to clipboard

Add `model_to_minibatch` transformation to convert all `pm.Data` to `pm.Minibatch`

Open jessegrabowski opened this issue 5 months ago • 9 comments

Description

A pain point for me when testing different algorithms (e.g. MCMC vs VI) is that I don't want to write a 2nd version of the model with pm.Minibatch on the data.

This PR adds a model transformation that does that for the user. It's the reverse of the remove_minibatched_nodes transformer that @zaxtax implemented recently.

This is a WIP, it doesn't actually work now, because I can't figure out how to rebuild the observed variable with the total_size set correctly. Help wanted.

Related Issue

  • [ ] Closes #
  • [ ] Related to #

Checklist

Type of change

  • [x] New feature / enhancement
  • [ ] Bug fix
  • [ ] Documentation
  • [ ] Maintenance
  • [ ] Other (please specify):

📚 Documentation preview 📚: https://pymc--7785.org.readthedocs.build/en/7785/

jessegrabowski avatar May 15 '25 12:05 jessegrabowski