From c24af43717301c63091e0331bb070c9265868cbc Mon Sep 17 00:00:00 2001 From: Peng Zheng Date: Thu, 18 Jan 2024 10:18:52 -0800 Subject: [PATCH] V0.2.1 (#74) * Switch eig cals to eigh calls so we don't have issues with complex eigenvalues. Covariance is wrong right now anyways though I think * fix the versioin of jax * fix version of xspline * change version to 0.2.1 --------- Co-authored-by: Alexander Hsu --- pyproject.toml | 8 ++++---- src/regmod/models/model.py | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 3662f56..ab44e40 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "regmod" -version = "0.2.0" +version = "0.2.1" description = "General regression models" readme = "README.rst" requires-python = ">=3.10" @@ -16,10 +16,10 @@ dependencies = [ "numpy", "scipy", "pandas", - "xspline", + "xspline==0.0.7", "msca", - "jaxlib", - "jax[cpu]", + "jax[cpu]==0.4.5", + "jaxlib==0.4.4", ] [project.optional-dependencies] diff --git a/src/regmod/models/model.py b/src/regmod/models/model.py index d16e45f..795edc1 100644 --- a/src/regmod/models/model.py +++ b/src/regmod/models/model.py @@ -127,7 +127,8 @@ def get_vcov(self, coefs: ndarray) -> ndarray: hessian = self.hessian(coefs) if isinstance(hessian, Matrix): hessian = hessian.to_numpy() - eig_vals, eig_vecs = np.linalg.eig(hessian) + #We probably don't want to be eigendecomposing + eig_vals, eig_vecs = np.linalg.eigh(hessian) if np.isclose(eig_vals, 0.0).any(): raise ValueError("singular Hessian matrix, please add priors or " "reduce number of variables") @@ -136,7 +137,7 @@ def get_vcov(self, coefs: ndarray) -> ndarray: jacobian2 = self.jacobian2(coefs) if isinstance(jacobian2, Matrix): jacobian2 = jacobian2.to_numpy() - eig_vals = np.linalg.eigvals(jacobian2) + eig_vals = np.linalg.eigvalsh(jacobian2) if np.isclose(eig_vals, 0.0).any(): raise ValueError("singular Jacobian matrix, please add priors or " "reduce number of variables")