Skip to content

Commit 6eb2a34

Browse files
committed
reverted estimate_tau to maximize marginalized tau
1 parent d817d4a commit 6eb2a34

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

basicrta/gibbs.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -714,16 +714,17 @@ def estimate_tau(self):
714714
taus = 1 / rp.rates[rp.labels == index]
715715
wts = rp.weights[rp.labels == index]
716716
ci = confidence_interval(taus)
717-
#h = np.histogram(taus, bins='sqrt')
718-
#indmax = h[0].argmax()
719-
#val = 0.5 * (h[1][:-1][indmax] + h[1][1:][indmax])
720-
721-
wbins = np.histogram_bin_edges(wts, bins=bintype)
722-
rbins = np.histogram_bin_edges(taus, bins=bintype)
723-
vals, ws, rs = np.histogram2d(wts, taus, bins=[wbins,rbins])
724-
indmax = np.unravel_index(vals.argmax(), vals.shape)
725-
rval = 0.5 * (rs[:-1] + rs[1:])[indmax[1]]
726-
return [ci[0], rval, ci[1]]
717+
h = np.histogram(taus, bins='sqrt')
718+
indmax = h[0].argmax()
719+
val = 0.5 * (h[1][:-1][indmax] + h[1][1:][indmax])
720+
721+
# Used for finding maximum of weight vs tau 2d distribution
722+
#wbins = np.histogram_bin_edges(wts, bins=bintype)
723+
#rbins = np.histogram_bin_edges(taus, bins=bintype)
724+
#vals, ws, rs = np.histogram2d(wts, taus, bins=[wbins,rbins])
725+
#indmax = np.unravel_index(vals.argmax(), vals.shape)
726+
#val = 0.5 * (rs[:-1] + rs[1:])[indmax[1]]
727+
return [ci[0], val, ci[1]]
727728

728729
def plot_surv(self, scale=1, remove_noise=False, save=False, xlim=None,
729730
ylim=(1e-6, 5), xmajor=None, xminor=None):

0 commit comments

Comments
 (0)