pymc-devs/pymc — pull request #294 by twiecki (2013-06-15 21:56:35+00:00)
Title: GLM

This is not ready for merging yet but I'm putting it up as WIP and to get some code review (continuation of #199). Once we finalize on the structure I'll add some tests. This branch is also based off of `scaling` which should be merged before this one.

I'm pretty happy with the interface now as it allows the creation of Bayesian GLMs with almost the same simplicity as in R or statsmodels. See http://nbviewer.ipython.org/urls/raw.github.com/pymc-devs/pymc/glm/pymc/examples/GLM.ipynb for examples.

Another thing that really helps is the initialization by fitting with `statsmodels` first and using this as a starting point.

Outstanding questions are:
1. Currently `statsmodels` is optional but is required for anything except `linear_component()`. I think this might be a reasonable trade-off. `statsmodels` itself is pretty light-weight.
2. I created a `glm` subdirectory. Is that where we want to keep this?
3. `links.py` and `families.py` ties together `theano` and `statsmodels`. We need to have 2 of everything so that we can initialize properly with the correct `statsmodel`. The individual classes make the code pretty modular and easy extendable. Not sure if someone has a better idea for how to structure these.
4. `glm`'s classes do not go into the `pymc` namespace but e.g. `pymc.glm.families` which I think is the right thing to do. To create a new glm, one would call `pymc.glm.glm()`. Not sure I like the `glm.glm` too much but I'm not sure what a better name for either the submodule or the function would be. Maybe it's fine though?