Skip to content

Commit

Permalink
Merge pull request #634 from stan-dev/v0.5.0
Browse files Browse the repository at this point in the history
CmdStanR v0.5.0
  • Loading branch information
rok-cesnovar committed Mar 20, 2022
2 parents ac5a448 + ca84b71 commit 2e24ec8
Show file tree
Hide file tree
Showing 103 changed files with 6,559 additions and 2,615 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: cmdstanr
Title: R Interface to 'CmdStan'
Version: 0.4.0.9001
Date: 2021-04-15
Version: 0.5.0
Date: 2022-03-17
Authors@R:
c(person(given = "Jonah", family = "Gabry", role = c("aut", "cre"),
email = "[email protected]"),
Expand Down
61 changes: 32 additions & 29 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# cmdstanr 0.4.0.9000
# cmdstanr 0.5.0

### Bug fixes

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

* Expose CmdStan's `diagnose` method that compares Stan's gradient computations
to gradients computed via finite differences. (#485)

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

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

* `write_stan_json()` now handles data of class `"table"`. Tables are converted
to vector, matrix, or array depending on the dimensions of the table. (#528)

* `install_cmdstan()` now automatically installs the Linux ARM CmdStan when
Linux distributions running on ARM CPUs are detected. (#531)

* The `dir` argument for `write_stan_file()` can now be set with a global
option. (#537)

* Improved processing of named lists supplied to the `data` argument to JSON
data files: checking whether the list includes all required elements/Stan
variables; improved differentiating arrays/vectors of length 1 and scalars
when generating JSON data files; generating floating point numbers with
decimal points to fix issue with parsing large numbers. (#538)
* New method `$format()` for auto-formatting and canonicalizing the Stan models. (#625)

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

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

* Added the `cmdstanr_force_recompile` global option that is used for forcing
recompilation of Stan models. (#580)

* New method `$code()` for all fitted model objects that returns the Stan code
associated with the fitted model. (#575)

* Added the `cmdstanr_force_recompile` global option that is used for forcing
recompilation of Stan models. (#580)
* New method `$diagnostic_summary()` for CmdStanMCMC objects that summarizes the
sampler diagnostics (divergences, treedepth, ebfmi) and can regenerate the
related warning messages. (#205)

* New `diagnostics` argument for the `$sample()` method to specify which
diagnostics are checked after sampling. Replaces `validate_csv` argument. (#205)

* Added E-BFMI checks that run automatically post sampling. (#500, @jsocolar)

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

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

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

* New `diagnostics` argument for the `$sample()` method to specify which
diagnostics are checked after sampling. Replaces `validate_csv` argument. (#205)
* `write_stan_json()` now handles data of class `"table"`. Tables are converted
to vector, matrix, or array depending on the dimensions of the table. (#528)

* Improved processing of named lists supplied to the `data` argument to JSON
data files: checking whether the list includes all required elements/Stan
variables; improved differentiating arrays/vectors of length 1 and scalars
when generating JSON data files; generating floating point numbers with
decimal points to fix issue with parsing large numbers. (#538)

* `install_cmdstan()` now automatically installs the Linux ARM CmdStan when
Linux distributions running on ARM CPUs are detected. (#531)

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

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

# cmdstanr 0.4.0

Expand Down
21 changes: 10 additions & 11 deletions R/model.R
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#' Create a new CmdStanModel object
#'
#' @description \if{html}{\figure{logo.png}{options: width="25px"
#' alt="https://mc-stan.org/about/logo/"}} Create a new [`CmdStanModel`]
#' object from a file containing a Stan program or from an existing Stan
#' executable. The [`CmdStanModel`] object stores the path to a Stan program
#' and compiled executable (once created), and provides methods for fitting
#' the model using Stan's algorithms.
#' @description \if{html}{\figure{logo.png}{options: width="25"}}
#' Create a new [`CmdStanModel`] object from a file containing a Stan program
#' or from an existing Stan executable. The [`CmdStanModel`] object stores the
#' path to a Stan program and compiled executable (once created), and provides
#' methods for fitting the model using Stan's algorithms.
#'
#' See the `compile` and `...` arguments for control over whether and how
#' compilation happens.
Expand Down Expand Up @@ -444,7 +443,7 @@ compile <- function(quiet = TRUE,
if (is.null(include_paths) && !is.null(private$precompile_include_paths_)) {
include_paths <- private$precompile_include_paths_
}
private$include_paths_ <- include_paths
private$include_paths_ <- include_paths
if (is.null(dir) && !is.null(private$dir_)) {
dir <- absolute_path(private$dir_)
} else if (!is.null(dir)) {
Expand Down Expand Up @@ -772,7 +771,7 @@ check_syntax <- function(pedantic = FALSE,
}
CmdStanModel$set("public", name = "check_syntax", value = check_syntax)

#' Run stanc's auto-formatter on the model code.
#' Run stanc's auto-formatter on the model code.
#'
#' @name model-method-format
#' @aliases format
Expand Down Expand Up @@ -815,7 +814,7 @@ CmdStanModel$set("public", name = "check_syntax", value = check_syntax)
#' real lambda;
#' }
#' model {
#' target +=
#' target +=
#' poisson_log(y | lambda);
#' }
#' ")
Expand Down Expand Up @@ -851,7 +850,7 @@ format <- function(overwrite_file = FALSE,
max_line_length,
lower = 1, len = 1, null.ok = TRUE
)
stanc_options <- private$precompile_stanc_options_
stanc_options <- private$precompile_stanc_options_
stancflags_val <- include_paths_stanc3_args(private$precompile_include_paths_)
stanc_options["auto-format"] <- TRUE
if (!is.null(max_line_length)) {
Expand Down Expand Up @@ -915,7 +914,7 @@ format <- function(overwrite_file = FALSE,
out_file <- self$stan_file()
}
cat(run_log$stdout, file = out_file, sep = "\n")

invisible(TRUE)
}
CmdStanModel$set("public", name = "format", value = format)
Expand Down
1 change: 1 addition & 0 deletions _pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ reference:
- CmdStanMLE
- CmdStanVB
- CmdStanGQ
- CmdStanDiagnose
- starts_with("fit-method")
- title: "Other tools for working with CmdStan"
contents:
Expand Down
12 changes: 6 additions & 6 deletions docs/404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions docs/LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions docs/LICENSE.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions docs/articles/articles-online-only/opencl.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2e24ec8

Please sign in to comment.