Recognize regressions as GLMs
Nobody has claimed this yet.
- Dominant language
- OCaml
- Stars
- 160
- Forks
- 59
- Avg merge
- 21h 45m
- Merged PRs (30d)
- 26
Description
I think we could make the existing normal_id_glm implementation available to models written as ordinary normal regressions, such as y ~ normal(alpha + X * beta, sigma), without requiring users to rewrite their models.
I have a compiler PR on my fork that recognizes data-matrix predictors and sums of data-vector predictors. It uses existing Stan Math functions and currently runs only under --Oexperimental. Unsupported forms keep their original calls.
An earlier benchmark reduced whole-run instructions by 56% on one regression. I haven't rerun performance measurements on the revised branch. The current compiler and runtime checks pass, including normalized and proportional densities, gradients, and output names. The GLM changes floating-point association, so I don't expect bit-identical draws.
Would this be useful to bring upstream as an experimental optimization? If there's a better place in the compiler to recognize these forms, or a preferred scope for an initial PR, I'd be happy to adjust it.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Review the compiler PR on the linked fork and the existing normal_id_glm implementation, focusing on its --Oexperimental behavior and supported regression forms. Run the cited compiler and runtime checks, then establish the preferred upstream scope and acceptance criteria for recognizing these models without changing unsupported calls.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ocaml
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100