Skip to content

Commit

Permalink
bug squash: fixed indiv probabilities
Browse files Browse the repository at this point in the history
  • Loading branch information
jarathomas committed May 8, 2024
1 parent a814b3c commit 28083a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions src/insilicova/_sampler/sampler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -396,11 +396,11 @@ void Sampler::count_current(double *ptr_indic,
}
}

// loop over all inidviduals
// loop over all individuals
for (int n = 0; n < N; ++n) {
// cause of this death
int c_current = (int) y_new(n);
// add to toal counts
// add to total counts
ptr_count_c[c_current] += 1;
// loop over all symptoms
for (int s = 0; s < S; ++s) {
Expand Down Expand Up @@ -515,7 +515,7 @@ void Sampler::trunc_beta2(py::array_t<double> prior_a, double prior_b,
}
upper = std::min(upper, trunc_max);
}
// if range is invalide, use higher case
// if range is invalid, use higher case
if (lower >= upper) {
proxy_new_pbase(s, c.cast<int>()) = upper;
} else {
Expand Down Expand Up @@ -617,7 +617,7 @@ void Sampler::trunc_beta(py::array_t<double> prior_a, double prior_b,
}
upper = std::min(upper, trunc_max);
}
// if range is invalide, use higher case
// if range is invalid, use higher case
if (lower >= upper) {
proxy_new_pbase(s.cast<int>(), c) = upper;
} else {
Expand Down Expand Up @@ -893,7 +893,7 @@ void Sampler::fit(py::array_t<double> prior_a, double prior_b,
}
}

// reinitiate after checking impossible
// re-initiate after checking impossible
if (!is_added) {
for (int sub = 0; sub < N_sub; ++sub) {
int fix = 0;
Expand Down
4 changes: 2 additions & 2 deletions src/insilicova/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,6 @@ def _sample_posterior(self):
N_thin = int((N_gibbs - burn) / (thin))
probbase_gibbs = np.zeros((N_thin, S, C))
levels_gibbs = np.zeros((N_thin, N_level))
pnb_mean = np.zeros((N, C))
p_gibbs = np.zeros((N_thin, N_sub, C))
pnb_mean = np.zeros((N, C))
naccept = [0] * N_sub
Expand Down Expand Up @@ -1396,10 +1395,11 @@ def _sample_posterior(self):
# self.burnin = self.n_sim / 2
N_gibbs = int(np.trunc(N_gibbs * (2 ** (add - 1))))
burn = 0
N_thin = int((N_gibbs - burn) / (thin))
N_thin = int((N_gibbs - burn) / thin)
probbase_gibbs = np.zeros((N_thin, S, C))
levels_gibbs = np.zeros((N_thin, N_level))
p_gibbs = np.zeros((N_thin, N_sub, C))
pnb_mean = np.zeros((N, C))
warnings.warn(
f"Not all causes with CSMF > {self.conv_csmf} are "
f"convergent.\n Increase chain length with another "
Expand Down

0 comments on commit 28083a1

Please sign in to comment.