Feature cmdstan version 2.0#181
Closed
Nathaniel-Haines wants to merge 5 commits into
Closed
Conversation
Remove three working planning documents from the tracked tree. Files remain on disk locally but are no longer part of the repository going forward. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
hBayesDM 2.0 — modernize stack & toolchain
Top-to-bottom refactor of both the R and Python packages onto
current Stan tooling, plus the supporting work to keep behavior, docs, and
CI in sync.
Highlights
cmdstanpy (Python).
CmdStan is now a system dependency installed once via
cmdstanr::install_cmdstan()/cmdstanpy.install_cmdstan(). No install-timeprecompilation; models compile on first use (~30 s) and the
binary is cached.
.tool-versions.(
Python/pyproject.toml).array[N, T] real x,absfor
fabs) across all 66 models.DataTree,plot_dist,ci_prob, LOO-onlyextract_ic).Breaking changes
result$fit(R) /model.fit(Python) is now aCmdStanMCMC/CmdStanVBobject, not
rstan::stanfit. Replacerstan::extract(fit)with
posterior::as_draws_*(fit$draws())or use thealready-extracted
parVals/par_vals.BUILD_ALL=trueinstall-time precompile flag removed.Latent bugs fixed (no test previously)
additional_args:args[[nm]] <- NULLwas deletingentries with
NULLdefaults (e.g.banditNarm_2par_lapseNarm,pstRT_ddminitQ).Switched to
args[nm] <- list(NULL)so the entry ispreserved.
rhat(): name collision withposterior::rhatcausedcmdstanr's$summary("rhat", ...)to recurse into hBayesDM's ownrhat. Now bindsposterior::rhatto a local symbol and passes by value.vb=True: dict inits were being passed tocmdstanpy.variational(), which only acceptsOptional[float]. Inits arenow dropped on the VB branch.
idata: was usingstan_variables()(variational means) and
producing 1-D arrays. Now uses
stan_variables(mean=False)for the
variational sample matrix.
Tests
tests/test_user_facing.{py,R}— fits one small model(
dd_hyperbolic)and exercises plotting (
dist/trace/simple),plot_ind,rhat,extract_ic,print_fit, HDI helpers, plusgng_m1formodel_regressorand
dd_hyperbolic(vb=TRUE)for the VB path.tests/test_<model>.{py,R}unchanged.
Docs
R/man-roxygen/model-documentation.R—fitdescriptionupdated to
CmdStanMCMC/CmdStanVB; first-fit compile note added. All68
R/man/*.Rdregenerated via roxygen2.
R/README.Rmd,Python/README.rst, top-levelREADME.md—install
instructions, prerequisites, Python/R version requirements.
R/NEWS.md— 2.0 entry with breaking changes and migrationsnippets.
R/vignettes/getting_started.Rmd— full pass: install steps,fitting
walkthrough, console output, post-fit object description,
Section 3 plotting
rewritten around
bayesplot, Section 6 VB pointing atcmdstanr.
R/vignettes/hgf_tutorial.Rmd— link fix.R/cran-comments.md— refreshed for 2.0 submission story.Python/docs/{requirements.txt,conf.py}and.readthedocs.yml— bumped toPython 3.13 + arviz ≥ 0.20.
CI/CD
.travis.ymlandtravis/(xenial, Python3.6–3.8, poetry,
unmaintained). Travis ran
R CMD check --no-testsand onlyone Python test.
.github/workflows/R.yaml— Ubuntu, R 4.4, cachedCmdStan,
R CMD check+test_user_facing.R, codecov upload..github/workflows/Python.yaml— Ubuntu + macOS,Python 3.13 via
uv, cached CmdStan, ruff +
test_user_facing.py+ 2representative model
smoke tests.
pkgdown.yaml— pinned R 4.4, installs cmdstanrso vignettes
can re-render in CI.
workflows.
Repo hygiene
CLAUDE.mdat repo root: layout, toolchain, conventions,gotchas
(
additional_argsplumbing, therhatname collision, VBinits / sample
matrix), and the dev loop.
comments now
describe current behavior only; history lives in
NEWS.mdand git log.
Test plan
cd Python && uv run pytest tests/test_user_facing.py(15/15 pass)
NOT_CRAN=true Rscript -e 'testthat::test_file("R/tests/testthat/test_user_facing.R")'(42/42 pass)
R CMD INSTALL --no-docs --no-test-load R(clean)roxygen2::roxygenize("R")regenerates man pages withouterrors
rmarkdown::render("R/vignettes/getting_started.Rmd")builds
rmarkdown::render("R/vignettes/hgf_tutorial.Rmd")builds
green on a real run