You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: NEWS.md
+9-3Lines changed: 9 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,11 +8,17 @@ to be consistent with other methods.
8
8
keywords (@VisruthSK, #1154)
9
9
*`save_cmdstan_config` and `save_metric` default to `FALSE` but can be
10
10
set to `TRUE` for an entire R session via new global options. (#1159)
11
-
*`save_metric_files()` now gives an informative error when metric files were not created and keeps saved metric files after the fitted model is garbage-collected. (#1021)
11
+
*`save_metric_files()` now gives an informative error when metric files were
12
+
not created and keeps saved metric files after the fitted model is garbage-collected. (#1021)
12
13
*`cmdstan_model()` no longer fails when `MAKEFLAGS` enables directory-printing
13
14
output while reading `STANCFLAGS` from `make`. (#1163)
14
-
*`cmdstan_model()` now retains include paths when initialized with both a Stan file and a precompiled executable, fixing model introspection for programs that use `#include` (#1094).
15
-
*`$generate_quantities()` now reports per-process execution times with CmdStan 2.39 or newer, and `read_cmdstan_csv()` returns these times from standalone generated quantities CSV files. (#1168)
15
+
*`cmdstan_model()` now retains include paths when initialized with both a Stan file
16
+
and a precompiled executable (#1094).
17
+
*`$generate_quantities()` now also accepts `CmdStanMLE`, `CmdStanLaplace`,
18
+
and `CmdStanPathfinder` fitted model objects as `fitted_params`. (#1203)
19
+
*`$generate_quantities()` now reports per-process execution times with
20
+
CmdStan 2.39 or newer, and `read_cmdstan_csv()` returns these times from
Copy file name to clipboardExpand all lines: tests/testthat/test-data.R
+15-5Lines changed: 15 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -66,7 +66,11 @@ test_that("process_fitted_params() works with basic input types", {
66
66
})
67
67
68
68
test_that("process_fitted_params() errors with bad args", {
69
-
error_msg<-"'fitted_params' must be a list of paths to CSV files, a CmdStanMCMC/CmdStanVB object, a posterior::draws_array or a posterior::draws_matrix."
69
+
error_msg<- paste0(
70
+
"'fitted_params' must be a list of paths to CSV files, a CmdStanMCMC, ",
71
+
"CmdStanMLE, CmdStanLaplace, CmdStanVB, or CmdStanPathfinder object, ",
72
+
"a posterior::draws_array or a posterior::draws_matrix."
73
+
)
70
74
expect_error(
71
75
process_fitted_params(5),
72
76
error_msg
@@ -75,10 +79,6 @@ test_that("process_fitted_params() errors with bad args", {
75
79
process_fitted_params(NULL),
76
80
error_msg
77
81
)
78
-
expect_error(
79
-
process_fitted_params(fit_optimize),
80
-
error_msg
81
-
)
82
82
83
83
# WSL Tempdir not cleaned up with R gc
84
84
if (!os_is_wsl()) {
@@ -106,6 +106,16 @@ test_that("process_fitted_params() errors with bad args", {
106
106
}
107
107
})
108
108
109
+
test_that("process_fitted_params() works with CmdStanMLE", {
110
+
file<- process_fitted_params(fit_optimize)
111
+
fit_params<-data.table::fread(file, skip="lp__")
112
+
expect_equal(nrow(fit_params), 1)
113
+
expect_equal(
114
+
fit_params$theta,
115
+
as.numeric(fit_optimize$draws(variables="theta"))
116
+
)
117
+
})
118
+
109
119
test_that("process_fitted_params() works if output_files in fit do not exist", {
0 commit comments