summaryrefslogtreecommitdiffstats
path: root/experiments/ml.pyx
diff options
context:
space:
mode:
Diffstat (limited to 'experiments/ml.pyx')
-rw-r--r--experiments/ml.pyx6
1 files changed, 4 insertions, 2 deletions
diff --git a/experiments/ml.pyx b/experiments/ml.pyx
index 7eca30a..91536b5 100644
--- a/experiments/ml.pyx
+++ b/experiments/ml.pyx
@@ -10,7 +10,7 @@ cdef DTYPE_t weight_success(int dist, int dt, DTYPE_t alpha, DTYPE_t delta, DTYP
DTYPE_t t_scale, 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 = delta ** (dist**1)
# structural = delta/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda))
temporal = log(exp(alpha/t_scale)-1.) - alpha*dt/t_scale
# temporal = 1. / (1. + (dt - 1.)/alpha)**0.01 - 1. / (1. + dt/alpha)**0.01
@@ -21,11 +21,12 @@ cdef DTYPE_t weight_failure(int dist, int dt, DTYPE_t alpha, DTYPE_t delta, DTYP
DTYPE_t t_scale, DTYPE_t w1, DTYPE_t w2, DTYPE_t w3):
"""weight for failed infection, exponential time model"""
cdef DTYPE_t structural, temporal, result
- structural = delta ** dist
+ structural = delta ** (dist**1)
# structural = delta/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda))
temporal = exp(-alpha * dt/t_scale)
# temporal = 1. - 1. / (1. + dt/alpha)**0.01
result = log(1. - structural + structural * temporal)
+ # if dt>100: result=0
return result
def ml(dict root_victims, dict victims, dict non_victims,
@@ -65,6 +66,7 @@ def ml(dict root_victims, dict victims, dict non_victims,
probs[i] = prob
parent_dists[i] = dists[l]
parent_dts[i] = dts[l]
+ # probs_fail[i] = failures[l]
# loop through non-victims
for i, parents in enumerate(non_victims.itervalues()):