From a52b93a5b1144b14ec4d1b1d0dd2198f3921294a Mon Sep 17 00:00:00 2001 From: Tomas Capretto Date: Fri, 25 Oct 2024 09:58:22 -0300 Subject: [PATCH 1/3] Check if is an attribute before trying to access it --- bambi/priors/scaler.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bambi/priors/scaler.py b/bambi/priors/scaler.py index fc03c6b8..caa0a1b3 100644 --- a/bambi/priors/scaler.py +++ b/bambi/priors/scaler.py @@ -55,11 +55,19 @@ def scale_response(self): # Here we would add cases for other families if we wanted if isinstance(self.model.family, (Gaussian, StudentT)): sigma = self.model.components["sigma"] - if isinstance(sigma, ConstantComponent) and sigma.prior.auto_scale: + if ( + isinstance(sigma, ConstantComponent) + and hasattr(sigma.prior, "auto_scale") # not available when `.prior` is a scalar + and sigma.prior.auto_scale + ): sigma.prior = Prior("HalfStudentT", nu=4, sigma=self.response_std) elif isinstance(self.model.family, VonMises): kappa = self.model.components["kappa"] - if isinstance(kappa, ConstantComponent) and kappa.prior.auto_scale: + if ( + isinstance(kappa, ConstantComponent) + and hasattr(kappa.prior, "auto_scale") # not available when `.prior` is a scalar + and kappa.prior.auto_scale + ): kappa.prior = Prior("HalfStudentT", nu=4, sigma=self.response_std) def scale_intercept(self, term): From 4bacf130a3d4f219caecaeae9b404c5e5db4ae9a Mon Sep 17 00:00:00 2001 From: Tomas Capretto Date: Sun, 27 Oct 2024 10:43:11 -0300 Subject: [PATCH 2/3] Code format --- bambi/priors/scaler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bambi/priors/scaler.py b/bambi/priors/scaler.py index caa0a1b3..149d9e67 100644 --- a/bambi/priors/scaler.py +++ b/bambi/priors/scaler.py @@ -65,7 +65,7 @@ def scale_response(self): kappa = self.model.components["kappa"] if ( isinstance(kappa, ConstantComponent) - and hasattr(kappa.prior, "auto_scale") # not available when `.prior` is a scalar + and hasattr(kappa.prior, "auto_scale") # not available when `.prior` is a scalar and kappa.prior.auto_scale ): kappa.prior = Prior("HalfStudentT", nu=4, sigma=self.response_std) From daf4b851f1a3604d60e85bd573f22d0042f6993a Mon Sep 17 00:00:00 2001 From: Tomas Capretto Date: Tue, 29 Oct 2024 09:56:13 -0300 Subject: [PATCH 3/3] Add upper limit to JAX version --- pyproject.toml | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 596f9801..1fb5e450 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -40,6 +40,8 @@ dev = [ jax = [ "bayeux-ml>=0.1.13", + "jax<=0.4.33", + "jaxlib<=0.4.33", ] [project.urls] @@ -50,14 +52,14 @@ changelog = "https://github.com/bambinos/bambi/blob/main/docs/CHANGELOG.md" [tool.setuptools] packages = [ - "bambi", - "bambi.backend", - "bambi.data", - "bambi.defaults", + "bambi", + "bambi.backend", + "bambi.data", + "bambi.defaults", "bambi.families", - "bambi.interpret", - "bambi.priors", - "bambi.terms", + "bambi.interpret", + "bambi.priors", + "bambi.terms", ] [tool.black]