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/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..3c654dc 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,15 +17,15 @@ 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." 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" ]