From a473003961419502b66b5111374de26331bf4fc3 Mon Sep 17 00:00:00 2001 From: Ben Green Date: Sat, 20 Jun 2015 18:33:48 -0400 Subject: More tests with ml2 to find optimal results --- experiments/ml2.pyx | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'experiments/ml2.pyx') 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()): -- cgit v1.2.3-70-g09d2