pyro-ppl / brmp

Bayesian Regression Models in Pyro
Apache License 2.0
69 stars 8 forks source link

offset function in the formula #82

Open Henrilin28 opened 3 years ago

Henrilin28 commented 3 years ago

I am wondering if the team has plan to develop offset function? What is the expecting timeline for this?

eb8680 commented 3 years ago

We don't have any plans for this, but open source contributions are welcome!

matteby commented 3 years ago

I'd be interested in support for this as well. I may take a look at implementing it if I can find the time in the next few weeks.

null-a commented 3 years ago

I wrote a lot of the code in this repository. I'm no longer actively working on this, but I'm still following the issues. Feel free to ask me about anything I've done that doesn't make sense. Good luck!

matteby commented 3 years ago

@null-a Thanks!

I haven't yet had time to think through how to implement w.r.t. this code base. If there has been any thoughts or discussions on how to support I'd be interested to hear. Otherwise, I'll be sure to ask if I run into any questions.

null-a commented 3 years ago

I'm not aware of any previous discussion. (And don't even recall what offset does off the top of my head!) Nevertheless, I'd be happy to discuss a general strategy at some point if that would be helpful.

As a starting point, here's a rough high-level sketch of how we go from the inputs of formula, dataset and description of custom priors we get from the user, to either Pyro/NumPyro code.

                DataFrame metadata --|
                                     |-> `ModelDescPre` --|
input string --parser--> `Formula` --|                    |-> `ModelDesc` --code gen--> code
                                                 priors --|

(The items in back-ticks denote Python classes.)

My guess would be that each stage of this pipeline would need to be updated to handle offsets. i.e. Update the parser to parse out offsets and represent them in Formula, update ModelDesc (which is something like an abstract description of the model) to also represent offsets, and update the code generators to output code that implements the appropriate functionality.