diff options
| author | Ben Green <ben@SEASITs-MacBook-Pro.local> | 2015-06-20 18:33:48 -0400 |
|---|---|---|
| committer | Ben Green <ben@SEASITs-MacBook-Pro.local> | 2015-06-20 18:33:48 -0400 |
| commit | a473003961419502b66b5111374de26331bf4fc3 (patch) | |
| tree | 2357dbeb5be29506734fe811e02c3aadc9607952 /experiments/ml2.pyx | |
| parent | aaa2f530675f9f76bcd48e9641354f7a0e043012 (diff) | |
| download | criminal_cascades-a473003961419502b66b5111374de26331bf4fc3.tar.gz | |
More tests with ml2 to find optimal results
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()): |
