From 2399b2710367680f0e77dbe9dacb650fef10ae3d Mon Sep 17 00:00:00 2001 From: aloctavodia Date: Wed, 6 May 2026 08:16:46 +0300 Subject: [PATCH 1/2] use bambi from main --- kulprit/projection/arviz_io.py | 4 ++-- kulprit/projection/solver.py | 2 +- kulprit/projector.py | 8 ++++---- pyproject.toml | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/kulprit/projection/arviz_io.py b/kulprit/projection/arviz_io.py index 5bcb63e..ec068a5 100644 --- a/kulprit/projection/arviz_io.py +++ b/kulprit/projection/arviz_io.py @@ -80,7 +80,7 @@ def check_idata(idata, model, rng): raise UserWarning("Incompatible model and inference data.") # check if we have the log_likelihood group - if "log_likelihood" not in idata.groups(): + if "log_likelihood" not in idata.groups: warnings.warn( "log_likelihood group is missing from idata, it will be computed.\n" "To avoid this message, please run Bambi's fit method with the option " @@ -89,7 +89,7 @@ def check_idata(idata, model, rng): model.compute_log_likelihood(idata) # check if we have the posterior_predictive group - if "posterior_predictive" not in idata.groups(): + if "posterior_predictive" not in idata.groups: model.predict(idata, kind="response", inplace=True, random_seed=rng) return idata diff --git a/kulprit/projection/solver.py b/kulprit/projection/solver.py index e9086c0..9580aca 100644 --- a/kulprit/projection/solver.py +++ b/kulprit/projection/solver.py @@ -62,7 +62,7 @@ def solve(neg_log_likelihood, preds, initial_guess, var_info, weights, tolerance posterior_dict[key] = transformation(posterior_dict[key]) size += new_size - new_idata = from_dict(posterior=posterior_dict) + new_idata = from_dict({"posterior": posterior_dict}) loss = np.mean(objectives) * 0.5 else: new_idata = None diff --git a/kulprit/projector.py b/kulprit/projector.py index 0f5bf8c..0bdb8d8 100644 --- a/kulprit/projector.py +++ b/kulprit/projector.py @@ -334,15 +334,15 @@ def _project(self, term_names, clusters=True): # Add observed data and log-likelihood to the projected InferenceData object # We only do this for the selected projected model, not the intermediate ones if new_idata is not None: - new_idata.add_groups(observed_data=self._observed_dataset) - new_idata.add_groups(log_likelihood=compute_llk(new_idata, self._pymc_model)) + new_idata["observed_data"] = self._observed_dataset + new_idata["log_likelihood"] = compute_llk(new_idata, self._pymc_model) # remove the variables that are not in the submodel vars_to_drop = [ var - for var in new_idata.posterior.data_vars + for var in new_idata["posterior"].ds.data_vars if var not in (term_names + self._base_terms) ] - new_idata.posterior = new_idata.posterior.drop_vars(vars_to_drop) + new_idata["posterior"] = new_idata["posterior"].ds.drop_vars(vars_to_drop) # build SubModel object and return sub_model = SubModel( diff --git a/pyproject.toml b/pyproject.toml index 79c1d15..8ae5bd1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,8 +24,8 @@ classifiers = [ dynamic = ["version"] description = "Kullback-Leibler projections for Bayesian model selection." dependencies = [ - "arviz_plots >=0.7.0", - "bambi >=0.16", + "arviz_plots >=1.1.0", + "bambi @ git+https://github.com/bambinos/bambi.git", "scikit-learn>=1.0.2" ] From 03db3ccb1184454f12f78af813deb694111f8550 Mon Sep 17 00:00:00 2001 From: aloctavodia Date: Wed, 6 May 2026 08:23:09 +0300 Subject: [PATCH 2/2] update python versions --- .github/workflows/test.yml | 2 +- README.md | 2 +- docs/index.rst | 4 ++-- pyproject.toml | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index be887d6..2dd99cb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.11", "3.12", "3.13"] + python-version: ["3.12", "3.13", "3.14"] name: Set up Python ${{ matrix.python-version }} steps: diff --git a/README.md b/README.md index c354dbb..f8e6d15 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ If you find any bugs or have any feature requests, please open an [issue](https: ## Installation -Kulprit requires a working Python interpreter (3.11+). +Kulprit requires a working Python interpreter (3.12+). Assuming a standard Python environment is installed on your machine (including pip), Kulprit itself can be installed in one line using: diff --git a/docs/index.rst b/docs/index.rst index 7ec7a70..02922d2 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -26,7 +26,7 @@ If you find any bugs or have any feature requests, please open an `issue `_, which has one-click installers available on all major platforms. +Kulprit requires a working Python interpreter (3.12+). We recommend installing Python and key numerical libraries using the `Anaconda Distribution `_, which has one-click installers available on all major platforms. Assuming a standard Python environment is installed on your machine (including pip), Kulprit itself can be installed in one line using pip: @@ -59,7 +59,7 @@ Alternatively, if you want the bleeding-edge version of the package, you can ins Dependencies ============ -Kulprit is tested on Python 3.11+. Dependencies are listed in `pyproject.toml` and should all be installed by the Kulprit installer; no further action should be required. +Kulprit is tested on Python 3.12+. Dependencies are listed in `pyproject.toml` and should all be installed by the Kulprit installer; no further action should be required. Contributing diff --git a/pyproject.toml b/pyproject.toml index 8ae5bd1..3c654dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,9 +17,9 @@ classifiers = [ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", ] dynamic = ["version"] description = "Kullback-Leibler projections for Bayesian model selection."