I am very happy to announce that the latest release candidates of Cmdstan and Stan are now available on Github!
This release cycle brings a new type - tuples, a new algorithm - Pathfinder, many new functions, 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.33 version will be released in about ten days.
Below are some of the highlights of the new release.
Tuples
The Stan language gains a new type: tuples!
For any sequence of types, Stan provides a tuple data type. For example,
tuple(real, array[5] int) xi;
declares xi
to be a tuple holding two values, the first of which is of type type real
and the second of which a 5-dimensional array of type int
. Tuples can be of arbitrary size. The values in a tuple can be of arbitrary type, but the component types must be declared along with the declaration of the tuple. Tuples can be manipulated as a whole, or their elements may be accessed and set individually.
Currently, the documentation is available here and here.
Pathfinder
A new Variational Inference algorithm is now available via CmdStan - Pathfinder!
Pathfinder is a variational method for approximately sampling from differentiable log densities. Starting from a random initialization, Pathfinder locates normal approximations to the target density along a quasi-Newton optimization path, with local covariance estimated using the inverse Hessian estimates produced by the L-BFGS optimizer. Pathfinder returns draws from the Gaussian approximation with the lowest estimated Kullback-Leibler (KL) divergence to the true posterior.
For more information see the preliminary documentation, the paper and Bob Carpenter’s tutorial.
New functions and function signatures
-
new functions
qr_thin
,eigendecompose_sym
,eigendecompose
,complex_schur_decompose
,svd
, andcsr_extract
are now available -
eigendecompose(A)
is equivalent to(eigenvectors(A), eigenvalues(A))
-
eigendecompose_sym(A)
is equivalent to(eigenvectors_sym(A), eigenvalues_sym(A))
-
qr_thin(A)
is equivalent to(qr_thin_Q(A), qr_thin_R(A))
-
qr(A)
is equivalent to(qr_Q(A), qr_R(A))
-
svd(A)
is equivalent to(svd_U(A), singular_values(A), svd_V(A))
-
csr_extract(A)
is equivalent to(csr_extract_w(a), csr_extract_v(a), csr_extract_u(a))
These functions all return tuples and have a lower computational cost due to the shared work to produce the multiple results.
- added vectorized signatures for
log_sum_exp
The function now supports all arguments that are typically supported in fully vectorized functions.
Deprecations
The following deprecations have been turned into errors this version:
-
The old array syntax, e.g.
int arr[5];
. Usearray[5] int arr;
instead. -
Distribution functions ending in
_log
. Use either_lpdf
or_lpmf
. -
The functions
binomial_coefficient_log
,multiply_log
, andcov_exp_quad
. Uselchoose
,lmultiply
, andgp_exp_quad_cov
respectively. -
The
if_else
function. Use the ternary operatorcond ? true_value : false_value
-
Use of CDFs with a
,
between the first and second argument. Use a|
. -
Comments beginning with
#
. Use//
. -
Use of
<-
for assignment. Use=
. -
The
increment_log_prob
function. Use thetarget +=
statement. -
The
get_lp()
function. Usetarget()
. -
The use of nested multi-indices on the left hand side of an assignment statement.
For this version, these can all be automatically updated with the --canonicalize=deprecations
argument to the autoformatter. This is not guaranteed to work for versions following this one.
Additionally, the following identifiers are now reserved words: array
, offset
, multiplier
, lower
, and upper
.
Other miscellaneous features
-
The
num_chains
argument for running multiple chains with a single executable is now available to all HMC variants other than thestatic
engine -
Improved accuracy of
matrix_exp_multiply
-
using the RDump input files now shows a warning - the RDump input files will not support tuples and are unlikely to support othew new types in the future. Please switch to the JSON input.
-
Return statements now follow the same type promotion rules as assignment and function argument passing.
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 1
If you are using cmdstanpy you can install the release candidate using
cmdstanpy.install_cmdstan(version='2.33.0-rc1')
With CmdStanR you can install the release candidate using
cmdstanr::install_cmdstan(version = "2.33.0-rc1", cores = 4)