Skip to content

Instantly share code, notes, and snippets.

@WardBrian
Created January 8, 2024 16:24
Show Gist options
  • Save WardBrian/1ba59bfd0037d3a721efac8934e4ad36 to your computer and use it in GitHub Desktop.
Save WardBrian/1ba59bfd0037d3a721efac8934e4ad36 to your computer and use it in GitHub Desktop.

I am happy to announce that the latest release candidates of Cmdstan and Stan are now available on Github!

This release cycle brings several improvements to the headline features of the last release - tuple types and the Pathfinder algorithm, new distributions, and other improvements.

You can find the release candidate for cmdstan here. Instructions for installing are given at the bottom of this post.

Please test the release candidate with your models and report if you experience any problems. We also kindly invite you to test the new features and provide feedback. If you feel some of the new features could be improved or should be changed before the release, please do not hesitate to comment.

The Stan development team appreciates your time and help in making Stan more efficient while maintaining a high level of reliability.

If everything goes according to plan, the 2.34 version will be released next week.

Below are some of the highlights of the new release.

Tuple "unpacking"

A new feature has been added that will be familiar to users of Python and other languages. Tuple-like items can now appear on the left hand side of an = in assignment, in a feature known as "unpacking".

For example, the following is now valid:

parameters {
  matrix[N, M] A;
}
model {
  matrix[N, M] Q;
  matrix[M, M] R;
  (Q, R) = qr_thin(A); // qr_thin returns a tuple(matrix, matrix)
}

Improved CmdStan outputs

Several new output options are available for CmdStan to produce JSON files for easier processing.

  • output save_cmdstan_config=1 will produce a JSON file which contains a serialized copy of the configuration for this run of CmdStan. This should be equivalent to what is currently printed as comments at the top of the CSV file.
  • For sampling algorithms, the argument adaptation save_metric=1 will produce a JSON file that contains the adapted step size and inverse metric. This file can be used with the pre-existing metric argument to initialize later runs.

Additionally, several bugs in the way file names were constructed by CmdStan have been resolved. This should hopefully lead to a more predictable experience when using multi-chain sampling runs or when saving the outputs of individual paths of Pathfinder.

New distributions

This release saw the addition of two new distributions to Stan.

Deprecations

The ability to use a real value in a conditional was removed this version. To recreate the exact behavior, you can compare the value with 0 (e.g. x != 0). However, we recommend pausing and re-considering such conditionals. Due to things like numerical error, it may be preferrable to instead test that x is greater than some small value.

Other changes

This release also contains a large number of bug fixes across all levels of the Stan ecosystem. Some details are available in the preliminary release notes

How to install?

Download the tar.gz file from the link above, extract it and use it the way you use any Cmdstan release. We also have an online Cmdstan guide available at CmdStan User’s Guide

If you are using cmdstanpy you can install the release candidate using

cmdstanpy.install_cmdstan(version='2.34.0-rc1')

With CmdStanR you can install the release candidate using

cmdstanr::install_cmdstan(version = "2.34.0-rc1", cores = 4)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment