From 45e070bebf1fbd285dc9df79e61404c3348f520e Mon Sep 17 00:00:00 2001 From: Stijn de Boer Date: Wed, 9 Aug 2023 15:59:35 +0200 Subject: [PATCH 1/3] Small but deadly bug fix --- pcntoolkit/model/SHASH.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pcntoolkit/model/SHASH.py b/pcntoolkit/model/SHASH.py index 1312020e..68bc8f69 100644 --- a/pcntoolkit/model/SHASH.py +++ b/pcntoolkit/model/SHASH.py @@ -330,7 +330,7 @@ def dist(cls, mu, sigma, epsilon, delta, **kwargs): def logp(value, mu, sigma, epsilon, delta): mean = m(epsilon, delta, 1) - var = m(epsilon, delta, 2) + var = m(epsilon, delta, 2) - mean**2 remapped_value = ((value - mu) / sigma) * np.sqrt(var) + mean this_S = S(remapped_value, epsilon, delta) this_S_sqr = np.square(this_S) From 4fe979ef7b633fa87b24c9fc55d4356430eb3d80 Mon Sep 17 00:00:00 2001 From: Stijn de Boer Date: Wed, 16 Aug 2023 10:55:05 +0200 Subject: [PATCH 2/3] Remove train data from idata --- pcntoolkit/model/hbr.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pcntoolkit/model/hbr.py b/pcntoolkit/model/hbr.py index f85748dd..69bc80b0 100644 --- a/pcntoolkit/model/hbr.py +++ b/pcntoolkit/model/hbr.py @@ -392,6 +392,8 @@ def estimate(self, X, y, batch_effects, **kwargs): dummy_array = xarray.DataArray(data = np.zeros((len(chain), len(draw), 1)), coords = {'chain':chain, 'draw':draw,'empty':np.array([0])}, name=j) self.idata.posterior[j] = dummy_array self.vars_to_sample.append(j) + self.idata.observed_data = None + self.idata.constant_data = None return self.idata def predict( From a13f907747491c0b87e665d0c0a649efb1f66c6c Mon Sep 17 00:00:00 2001 From: Stijn de Boer Date: Wed, 16 Aug 2023 13:11:51 +0200 Subject: [PATCH 3/3] Zero-out all data --- pcntoolkit/model/hbr.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pcntoolkit/model/hbr.py b/pcntoolkit/model/hbr.py index 69bc80b0..ca4dfc36 100644 --- a/pcntoolkit/model/hbr.py +++ b/pcntoolkit/model/hbr.py @@ -392,8 +392,13 @@ def estimate(self, X, y, batch_effects, **kwargs): dummy_array = xarray.DataArray(data = np.zeros((len(chain), len(draw), 1)), coords = {'chain':chain, 'draw':draw,'empty':np.array([0])}, name=j) self.idata.posterior[j] = dummy_array self.vars_to_sample.append(j) - self.idata.observed_data = None - self.idata.constant_data = None + + # zero-out all data + for i in self.idata.constant_data.data_vars: + self.idata.constant_data[i] *= 0 + for i in self.idata.observed_data.data_vars: + self.idata.observed_data[i] *= 0 + return self.idata def predict(