stan-dev / stan-dev/stanc3

Recognize regressions as GLMs

Open
#1,697 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature optimization
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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.