diff options
Diffstat (limited to 'experiments/ml2.pyx')
| -rw-r--r-- | experiments/ml2.pyx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/experiments/ml2.pyx b/experiments/ml2.pyx index 9edc7e6..8974106 100644 --- a/experiments/ml2.pyx +++ b/experiments/ml2.pyx @@ -13,13 +13,13 @@ cdef DTYPE_t weight_success(int dist, int dt, DTYPE_t alpha, DTYPE_t delta, DTYPE_t w1, DTYPE_t w2, DTYPE_t w3): """weight for successful infection, exponential time model""" cdef DTYPE_t structural, temporal, result - structural = delta ** dist + structural = dist * log(delta) # structural = plogis(w1,delta) * plogis(w2,delta) * plogis(w3,delta) - temporal = exp(-alpha*dt) * (exp(alpha)-1.) + temporal = log(exp(alpha)-1.) - alpha*dt # temporal = 1 - exp(-alpha*dt) - if exp(-alpha*dt)==0.: print 'UNDERFLOW ERROR' + # if exp(-alpha*dt)==0.: print 'UNDERFLOW ERROR' # temporal = 1. / (1. + (dt - 1.)/alpha)**0.01 - 1. / (1. + dt/alpha)**0.01 - result = log(structural * temporal) + result = structural + temporal # print 'st', structural, temporal return result @@ -59,6 +59,7 @@ def ml2(dict root_victims, dict victims, dict non_victims, DTYPE_t age, for (dist, dt, w1, w2, w3) in parents] # find parent that maximizes log(p) - log(\tilde{p}) probs[i] = max(s - failures[l] for l, s in enumerate(successes)) + probs_data[i] = # loop through non-victims for i, parents in enumerate(non_victims.itervalues()): |
