From 689b7c7600f8306b213e1b848badb16b94509cc0 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Tue, 26 May 2026 11:59:55 -0400 Subject: [PATCH 1/3] Update Stan to 2.39 --- Makefile | 2 +- clients/R/R/zzz.R | 2 +- clients/julia/src/model.jl | 2 +- clients/python/tinystan/model.py | 14 +++----------- stan | 2 +- 5 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Makefile b/Makefile index 1ba1250..9bf4e44 100644 --- a/Makefile +++ b/Makefile @@ -169,7 +169,7 @@ print-% : ; @echo $* = $($*) ; STANC_DL_RETRY = 5 STANC_DL_DELAY = 10 STANC3_TEST_BIN_URL ?= -STANC3_VERSION ?= v2.38.0 +STANC3_VERSION ?= v2.39.0 ifeq ($(OS),Windows_NT) OS_TAG := windows diff --git a/clients/R/R/zzz.R b/clients/R/R/zzz.R index 90b7400..6da5c62 100644 --- a/clients/R/R/zzz.R +++ b/clients/R/R/zzz.R @@ -10,7 +10,7 @@ HMC_SAMPLER_VARIABLES = c( PATHFINDER_VARIABLES = c("lp_approx__", "lp__", "path__") -OPTIMIZATION_VARIABLES = c("lp__") +OPTIMIZATION_VARIABLES = c("lp__", "converged__") LAPLACE_VARIABLES = c("log_p__", "log_g__") diff --git a/clients/julia/src/model.jl b/clients/julia/src/model.jl index a9a8259..0c431e7 100644 --- a/clients/julia/src/model.jl +++ b/clients/julia/src/model.jl @@ -34,7 +34,7 @@ const HMC_SAMPLER_VARIABLES = [ const PATHFINDER_VARIABLES = ["lp_approx__", "lp__", "path__"] -const OPTIMIZE_VARIABLES = ["lp__"] +const OPTIMIZE_VARIABLES = ["lp__", "converged__"] const LAPLACE_VARIABLES = ["log_p__", "log_q__"] diff --git a/clients/python/tinystan/model.py b/clients/python/tinystan/model.py index a197c88..e91d1bb 100644 --- a/clients/python/tinystan/model.py +++ b/clients/python/tinystan/model.py @@ -66,19 +66,11 @@ def print_callback(msg, size, is_error): PATHFINDER_VARIABLES = ["lp_approx__", "lp__", "path__"] -OPTIMIZE_VARIABLES = [ - "lp__", -] +OPTIMIZE_VARIABLES = ["lp__", "converged__"] -LAPLACE_VARIABLES = [ - "log_p__", - "log_q__", -] +LAPLACE_VARIABLES = ["log_p__", "log_q__"] -FIXED_SAMPLER_VARIABLES = [ - "lp__", - "accept_stat__", -] +FIXED_SAMPLER_VARIABLES = ["lp__", "accept_stat__"] class HMCMetric(Enum): diff --git a/stan b/stan index d13c50c..44be14e 160000 --- a/stan +++ b/stan @@ -1 +1 @@ -Subproject commit d13c50c0fe7e4a4c387b727b81246cee2541a320 +Subproject commit 44be14e28e8a677719eb821447d37765b3295f7a From 16089b62ce6a6041aa9b8cd3c13aff1847bdd041 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Tue, 26 May 2026 12:16:41 -0400 Subject: [PATCH 2/3] Fix tests --- clients/julia/test/test_laplace.jl | 4 ++-- clients/julia/test/test_optimize.jl | 2 +- clients/python/tests/test_optimize.py | 2 +- clients/python/tinystan/model.py | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/clients/julia/test/test_laplace.jl b/clients/julia/test/test_laplace.jl index 88726eb..b4fd305 100644 --- a/clients/julia/test/test_laplace.jl +++ b/clients/julia/test/test_laplace.jl @@ -44,8 +44,8 @@ @testset "Jacobian" begin @testset for jacobian in [true, false] out_opt = - optimize(simple_jacobian_model; jacobian = jacobian, seed = UInt32(12345)) - mode_array = out_opt.draws[2:end] + optmize(simple_jacobian_model; jacobian = jacobian, seed = UInt32(12345)) + mode_array = out_opt.draws[3:end] out = laplace_sample( simple_jacobian_model, mode_array; diff --git a/clients/julia/test/test_optimize.jl b/clients/julia/test/test_optimize.jl index ad82d55..57c029d 100644 --- a/clients/julia/test/test_optimize.jl +++ b/clients/julia/test/test_optimize.jl @@ -96,7 +96,7 @@ @testset "Model without parameters" begin out = optimize(empty_model) - @test length(out.names) == 1 # lp + @test length(out.names) == 2 # lp, converged end diff --git a/clients/python/tests/test_optimize.py b/clients/python/tests/test_optimize.py index 4f0a0ec..7501e46 100644 --- a/clients/python/tests/test_optimize.py +++ b/clients/python/tests/test_optimize.py @@ -107,7 +107,7 @@ def test_bad_init(bernoulli_model): def test_model_no_params(empty_model): out = empty_model.optimize() - assert len(out.parameters) == 1 # lp + assert len(out.parameters) == 2 # lp, converged @pytest.mark.parametrize( diff --git a/clients/python/tinystan/model.py b/clients/python/tinystan/model.py index e91d1bb..f41a895 100644 --- a/clients/python/tinystan/model.py +++ b/clients/python/tinystan/model.py @@ -114,7 +114,7 @@ def preprocess_laplace_inputs( if isinstance(mode, StanOutput): # handle case of passing optimization output directly if len(mode.data.shape) == 1: - mode = mode.data[1:] + mode = mode.data[len(OPTIMIZE_VARIABLES) :] else: raise ValueError("Laplace can only be used with Optimization output") # mode = mode.create_inits(chains=1, seed=seed) From decb6e5f4510725ea6065daebf08f58737b62568 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Tue, 26 May 2026 12:26:15 -0400 Subject: [PATCH 3/3] Typo fix --- clients/julia/test/test_laplace.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clients/julia/test/test_laplace.jl b/clients/julia/test/test_laplace.jl index b4fd305..a9ace56 100644 --- a/clients/julia/test/test_laplace.jl +++ b/clients/julia/test/test_laplace.jl @@ -44,7 +44,7 @@ @testset "Jacobian" begin @testset for jacobian in [true, false] out_opt = - optmize(simple_jacobian_model; jacobian = jacobian, seed = UInt32(12345)) + optimize(simple_jacobian_model; jacobian = jacobian, seed = UInt32(12345)) mode_array = out_opt.draws[3:end] out = laplace_sample( simple_jacobian_model,