From 3c33ce3705ac9b2900c0a1747ce785f7d6774c4b Mon Sep 17 00:00:00 2001 From: OttoVintola Date: Mon, 22 Jun 2026 16:01:37 +0300 Subject: [PATCH 1/3] Fixes #279 --- .gitignore | 1 + tests/test_bart.py | 14 ++++++++++++++ 2 files changed, 15 insertions(+) diff --git a/.gitignore b/.gitignore index 5e62ce3..beb8348 100644 --- a/.gitignore +++ b/.gitignore @@ -167,3 +167,4 @@ cython_debug/ **.csv tests/test_hmc.py +tests/bench_bart.py diff --git a/tests/test_bart.py b/tests/test_bart.py index 5883fb6..15857b3 100644 --- a/tests/test_bart.py +++ b/tests/test_bart.py @@ -239,3 +239,17 @@ def test_multiple_bart_variables_manual_step(): assert "mu2" in idata.posterior assert idata.posterior["mu1"].shape == (1, 20, 30) assert idata.posterior["mu2"].shape == (1, 20, 30) + + +def test_mutable_named_dim(): + """Test that BART variables can be created with mutable named dimensions and that sampling works.""" + rng = np.random.default_rng(0) + N = 50 + X = rng.normal(size=(N, 2)) + Y = rng.normal(size=N) + + with pm.Model(coords={"obs": np.arange(N), "feature": ["a", "b"]}) as model: + x = pm.Data("x", X, dims=("obs", "feature")) + mu = pmb.BART("mu", X=x, Y=Y, m=10, dims="obs") + pm.Normal("y", mu=mu, sigma=1.0, observed=Y, dims="obs") + idata = pm.sample(tune=20, draws=20, chains=1) \ No newline at end of file From 44612310eaea05df6e8d9ecfb43382db6af32fbc Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 22 Jun 2026 13:02:25 +0000 Subject: [PATCH 2/3] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/test_bart.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_bart.py b/tests/test_bart.py index 15857b3..843f200 100644 --- a/tests/test_bart.py +++ b/tests/test_bart.py @@ -252,4 +252,4 @@ def test_mutable_named_dim(): x = pm.Data("x", X, dims=("obs", "feature")) mu = pmb.BART("mu", X=x, Y=Y, m=10, dims="obs") pm.Normal("y", mu=mu, sigma=1.0, observed=Y, dims="obs") - idata = pm.sample(tune=20, draws=20, chains=1) \ No newline at end of file + idata = pm.sample(tune=20, draws=20, chains=1) From 10b1e54a052488cacae9d168537b50df6db26d85 Mon Sep 17 00:00:00 2001 From: OttoVintola Date: Mon, 22 Jun 2026 16:09:52 +0300 Subject: [PATCH 3/3] fix precommit --- tests/test_bart.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/test_bart.py b/tests/test_bart.py index 15857b3..1c23dce 100644 --- a/tests/test_bart.py +++ b/tests/test_bart.py @@ -242,7 +242,8 @@ def test_multiple_bart_variables_manual_step(): def test_mutable_named_dim(): - """Test that BART variables can be created with mutable named dimensions and that sampling works.""" + """Test that BART variables can be created with + mutable named dimensions and that sampling works.""" rng = np.random.default_rng(0) N = 50 X = rng.normal(size=(N, 2))