Skip to content

New cmdstan_defaults() method for getting CmdStan's default argument values#1167

Merged
jgabry merged 17 commits intomasterfrom
get_cmdstan_args
Apr 1, 2026
Merged

New cmdstan_defaults() method for getting CmdStan's default argument values#1167
jgabry merged 17 commits intomasterfrom
get_cmdstan_args

Conversation

@avehtari
Copy link
Copy Markdown
Member

@avehtari avehtari commented Mar 29, 2026

Closes #1133

Finding the CmdStan default arguments for different methods from the documentation is not easy, and many arguments are named differently in CmdStan and in CmdStanR. New model method $cmdstan_defaults() gets the defaults calling CmdStan itself and maps the argument names to those used by CmdStanR,

Copyright and Licensing

Please list the copyright holder for the work you are submitting
(this will be you or your assignee, such as a university or company):

Aki Vehtari

By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the following licenses:

@avehtari avehtari requested a review from jgabry March 29, 2026 12:04
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 29, 2026

Codecov Report

❌ Patch coverage is 99.23664% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 91.14%. Comparing base (5809552) to head (b807f16).
⚠️ Report is 7 commits behind head on master.

Files with missing lines Patch % Lines
R/model.R 99.23% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1167      +/-   ##
==========================================
+ Coverage   90.85%   91.14%   +0.29%     
==========================================
  Files          14       15       +1     
  Lines        5924     6065     +141     
==========================================
+ Hits         5382     5528     +146     
+ Misses        542      537       -5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@jgabry
Copy link
Copy Markdown
Member

jgabry commented Mar 30, 2026

Any idea what's up with the tests failing on some of the runs but not others?

@avehtari
Copy link
Copy Markdown
Member Author

All windows tests and one macOS test failing, but couldn't yet figure out why. Will investigate tomorrow

@jgabry
Copy link
Copy Markdown
Member

jgabry commented Mar 30, 2026

I think we can ignore the Mac failure, that’s unrelated. So yeah, it’s just the Windows tests. I don’t have Windows locally either, but maybe Claude will have some ideas.

@avehtari
Copy link
Copy Markdown
Member Author

maybe Claude will have some ideas.

Pointing Claude twice to the github Windows test report helped. The model call was missing tbb path, and the solution did already exist in run_info_cli in cpp_opts.R. The Windows tests are now also passing

Copy link
Copy Markdown
Member

@jgabry jgabry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's a first round of comments. I might have more after I take another look, but these are the first things I noticed.

@jgabry jgabry changed the title add get_cmdstan_args method New cmdstan_defaults() method for getting CmdStan's default argument values Mar 31, 2026
jgabry added 7 commits March 31, 2026 13:53
* remove redundant tests for type (we already use `identical` to test values so this covers types too)
* combine default values into a nested list so I could simplify the code to test them with a single `expect_cmdstan_defaults()` helper
Copy link
Copy Markdown
Member

@jgabry jgabry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made a few small changes (nothing that affects user-facing behavior) to slightly simplify some of the code and make a few parts easier to read (for a human at least). I think this is ready except for one thing: the name chains (instead of num_chains) is now correct, but the default number of chains in cmdstanr (4) and cmdstan (1) are different. So technically the new method is correct that the cmdstanr default is 1, but that's not very useful for the cmdstanr user. So maybe we should remove chains from the returned argument list since the default is already explicit in the sample method in cmdstanr? What do you think?

@avehtari
Copy link
Copy Markdown
Member Author

avehtari commented Apr 1, 2026

I had removed chains in 92d1b89, and I didn't notice that Claude put it back in baf13bc as part of the parser change which affected some CmdStan default keys. I did read through the diff, but not carefully enough and thought that the changes in the map code where only because of changes on the right hand side. Fixed now

@jgabry jgabry merged commit 286bab4 into master Apr 1, 2026
14 checks passed
@jgabry
Copy link
Copy Markdown
Member

jgabry commented Apr 1, 2026

Ok thanks, looks good to me. Merging now

@jgabry jgabry deleted the get_cmdstan_args branch April 1, 2026 16:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add function to get the algorithm option defaults

3 participants