Skip to content

Commit 2e24ec8

Browse files
authored
Merge pull request #634 from stan-dev/v0.5.0
CmdStanR v0.5.0
2 parents ac5a448 + ca84b71 commit 2e24ec8

File tree

103 files changed

+6559
-2615
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+6559
-2615
lines changed

DESCRIPTION

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: cmdstanr
22
Title: R Interface to 'CmdStan'
3-
Version: 0.4.0.9001
4-
Date: 2021-04-15
3+
Version: 0.5.0
4+
Date: 2022-03-17
55
Authors@R:
66
c(person(given = "Jonah", family = "Gabry", role = c("aut", "cre"),
77
email = "[email protected]"),

NEWS.md

Lines changed: 32 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# cmdstanr 0.4.0.9000
1+
# cmdstanr 0.5.0
22

33
### Bug fixes
44

@@ -19,59 +19,62 @@ will continue to be supported until version 1.0 but `install_cmdstan()` will now
1919
default to `.cmdstan` and CmdStanR will first look for `.cmdstan` before falling
2020
back on `.cmdstanr`. (#454)
2121

22-
* Expose CmdStan's `diagnose` method that compares Stan's gradient computations
23-
to gradients computed via finite differences. (#485)
24-
25-
* `write_stan_file()` now choose file names deterministically based on the code
26-
so that models do not get unnecessarily recompiled when calling the function
27-
multiple times with the same code. (#495, @martinmodrak)
22+
* New method `diagnose()` for CmdstanModel objects exposes CmdStan's `diagnose`
23+
method for comparing Stan's gradient computations to gradients computed via
24+
finite differences. (#485)
2825

2926
* New method `$variables()` for CmdstanModel objects that returns a list of
3027
variables in the Stan model, their types and number of dimensions. Does
3128
not require the model to be compiled. (#519)
3229

33-
* `write_stan_json()` now handles data of class `"table"`. Tables are converted
34-
to vector, matrix, or array depending on the dimensions of the table. (#528)
35-
36-
* `install_cmdstan()` now automatically installs the Linux ARM CmdStan when
37-
Linux distributions running on ARM CPUs are detected. (#531)
38-
39-
* The `dir` argument for `write_stan_file()` can now be set with a global
40-
option. (#537)
41-
42-
* Improved processing of named lists supplied to the `data` argument to JSON
43-
data files: checking whether the list includes all required elements/Stan
44-
variables; improved differentiating arrays/vectors of length 1 and scalars
45-
when generating JSON data files; generating floating point numbers with
46-
decimal points to fix issue with parsing large numbers. (#538)
30+
* New method `$format()` for auto-formatting and canonicalizing the Stan models. (#625)
4731

4832
* Added the option to create `CmdStanModel` from the executable only with the
4933
`exe_file` argument. (#564)
5034

5135
* Added a convenience argument `user_header` to `$compile()` and `cmdstan_model()`
5236
that simplifies the use of an external .hpp file to compile with the model.
5337

38+
* Added the `cmdstanr_force_recompile` global option that is used for forcing
39+
recompilation of Stan models. (#580)
40+
5441
* New method `$code()` for all fitted model objects that returns the Stan code
5542
associated with the fitted model. (#575)
5643

57-
* Added the `cmdstanr_force_recompile` global option that is used for forcing
58-
recompilation of Stan models. (#580)
44+
* New method `$diagnostic_summary()` for CmdStanMCMC objects that summarizes the
45+
sampler diagnostics (divergences, treedepth, ebfmi) and can regenerate the
46+
related warning messages. (#205)
47+
48+
* New `diagnostics` argument for the `$sample()` method to specify which
49+
diagnostics are checked after sampling. Replaces `validate_csv` argument. (#205)
50+
51+
* Added E-BFMI checks that run automatically post sampling. (#500, @jsocolar)
5952

6053
* New methods for `posterior::as_draws()` for CmdStanR fitted model objects.
6154
These are just wrappers around the `$draws()` method provided for convenience. (#532)
6255

63-
* Added E-BFMI checks that run automatically post sampling. (#500, @jsocolar)
56+
* `write_stan_file()` now choose file names deterministically based on the code
57+
so that models do not get unnecessarily recompiled when calling the function
58+
multiple times with the same code. (#495, @martinmodrak)
6459

65-
* New method `$diagnostic_summary()` that summarizes the sampler diagnostics
66-
(divergences, treedepth, ebfmi) and can regenerate the related warning messages. (#205)
60+
* The `dir` argument for `write_stan_file()` can now be set with a global
61+
option. (#537)
6762

68-
* New `diagnostics` argument for the `$sample()` method to specify which
69-
diagnostics are checked after sampling. Replaces `validate_csv` argument. (#205)
63+
* `write_stan_json()` now handles data of class `"table"`. Tables are converted
64+
to vector, matrix, or array depending on the dimensions of the table. (#528)
65+
66+
* Improved processing of named lists supplied to the `data` argument to JSON
67+
data files: checking whether the list includes all required elements/Stan
68+
variables; improved differentiating arrays/vectors of length 1 and scalars
69+
when generating JSON data files; generating floating point numbers with
70+
decimal points to fix issue with parsing large numbers. (#538)
71+
72+
* `install_cmdstan()` now automatically installs the Linux ARM CmdStan when
73+
Linux distributions running on ARM CPUs are detected. (#531)
7074

7175
* New function `as_mcmc.list()` for converting CmdStanMCMC objects to mcmc.list
7276
objects from the coda package. (#584, @MatsuuraKentaro)
7377

74-
* New method `$format()` for auto-formatting and canonicalizing the Stan models.
7578

7679
# cmdstanr 0.4.0
7780

R/model.R

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
#' Create a new CmdStanModel object
22
#'
3-
#' @description \if{html}{\figure{logo.png}{options: width="25px"
4-
#' alt="https://mc-stan.org/about/logo/"}} Create a new [`CmdStanModel`]
5-
#' object from a file containing a Stan program or from an existing Stan
6-
#' executable. The [`CmdStanModel`] object stores the path to a Stan program
7-
#' and compiled executable (once created), and provides methods for fitting
8-
#' the model using Stan's algorithms.
3+
#' @description \if{html}{\figure{logo.png}{options: width="25"}}
4+
#' Create a new [`CmdStanModel`] object from a file containing a Stan program
5+
#' or from an existing Stan executable. The [`CmdStanModel`] object stores the
6+
#' path to a Stan program and compiled executable (once created), and provides
7+
#' methods for fitting the model using Stan's algorithms.
98
#'
109
#' See the `compile` and `...` arguments for control over whether and how
1110
#' compilation happens.
@@ -444,7 +443,7 @@ compile <- function(quiet = TRUE,
444443
if (is.null(include_paths) && !is.null(private$precompile_include_paths_)) {
445444
include_paths <- private$precompile_include_paths_
446445
}
447-
private$include_paths_ <- include_paths
446+
private$include_paths_ <- include_paths
448447
if (is.null(dir) && !is.null(private$dir_)) {
449448
dir <- absolute_path(private$dir_)
450449
} else if (!is.null(dir)) {
@@ -772,7 +771,7 @@ check_syntax <- function(pedantic = FALSE,
772771
}
773772
CmdStanModel$set("public", name = "check_syntax", value = check_syntax)
774773

775-
#' Run stanc's auto-formatter on the model code.
774+
#' Run stanc's auto-formatter on the model code.
776775
#'
777776
#' @name model-method-format
778777
#' @aliases format
@@ -815,7 +814,7 @@ CmdStanModel$set("public", name = "check_syntax", value = check_syntax)
815814
#' real lambda;
816815
#' }
817816
#' model {
818-
#' target +=
817+
#' target +=
819818
#' poisson_log(y | lambda);
820819
#' }
821820
#' ")
@@ -851,7 +850,7 @@ format <- function(overwrite_file = FALSE,
851850
max_line_length,
852851
lower = 1, len = 1, null.ok = TRUE
853852
)
854-
stanc_options <- private$precompile_stanc_options_
853+
stanc_options <- private$precompile_stanc_options_
855854
stancflags_val <- include_paths_stanc3_args(private$precompile_include_paths_)
856855
stanc_options["auto-format"] <- TRUE
857856
if (!is.null(max_line_length)) {
@@ -915,7 +914,7 @@ format <- function(overwrite_file = FALSE,
915914
out_file <- self$stan_file()
916915
}
917916
cat(run_log$stdout, file = out_file, sep = "\n")
918-
917+
919918
invisible(TRUE)
920919
}
921920
CmdStanModel$set("public", name = "format", value = format)

_pkgdown.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ reference:
101101
- CmdStanMLE
102102
- CmdStanVB
103103
- CmdStanGQ
104+
- CmdStanDiagnose
104105
- starts_with("fit-method")
105106
- title: "Other tools for working with CmdStan"
106107
contents:

docs/404.html

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/LICENSE-text.html

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/LICENSE.html

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/articles/articles-online-only/opencl.html

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)