diff options
| author | Ben Green <ben@SEASITs-MacBook-Pro.local> | 2015-06-25 23:56:26 -0400 |
|---|---|---|
| committer | Ben Green <ben@SEASITs-MacBook-Pro.local> | 2015-06-25 23:56:26 -0400 |
| commit | 7167a81cfb8b872dd1547e5a8669004b191417db (patch) | |
| tree | dd160b9a7f438837118d8ca9fe83ae6c35a0d71a | |
| parent | c8fc620dda6096932707566dc8f20a3e65cb26b0 (diff) | |
| download | criminal_cascades-7167a81cfb8b872dd1547e5a8669004b191417db.tar.gz | |
Worked on process to generate cascades in R, recover them in ml2, and
compare true/recovered. Results look good: ml2 finds close-to-actual
parameters and gets ~60% of the infectors right. I will check how many
recovery gets in the top 2 or 3 infectors.
| -rw-r--r-- | R Scripts/generate-network.R | 78 | ||||
| -rwxr-xr-x | R Scripts/structural.R | 4 | ||||
| -rw-r--r-- | experiments/build/temp.macosx-10.6-x86_64-2.7/ml2.o | bin | 292772 -> 340864 bytes | |||
| -rw-r--r-- | experiments/build_network.py | 17 | ||||
| -rw-r--r-- | experiments/ml2.c | 2275 | ||||
| -rw-r--r-- | experiments/ml2.pyx | 35 | ||||
| -rwxr-xr-x | experiments/ml2.so | bin | 106020 -> 123652 bytes | |||
| -rw-r--r-- | experiments/out.log | 915 | ||||
| -rw-r--r-- | experiments/process.py | 36 |
9 files changed, 2149 insertions, 1211 deletions
diff --git a/R Scripts/generate-network.R b/R Scripts/generate-network.R new file mode 100644 index 0000000..dc4a4f8 --- /dev/null +++ b/R Scripts/generate-network.R @@ -0,0 +1,78 @@ +library(igraph) +setwd("~/Documents/Cascade Project/") +source('criminal_cascades/R Scripts/temporal.R') +source('criminal_cascades/R Scripts/structural.R') + +alpha = 1/100 +beta = 0.02 +delta = 0.15 +# lmbda = 1/10 +t_max = 1000 + +# g = watts.strogatz.game(1, 100, 3, 0.25) +N = 5000 +g = forest.fire.game(nodes=N, fw.prob=0.3, ambs=1, directed=F) +plot(g, vertex.size=5, vertex.label=NA) + +V(g)$seed = runif(vcount(g))<beta +seeds = which(V(g)$seed) +V(g)$vic = V(g)$seed +V(g)$vic.day[V(g)$seed] = sample(1:t_max, sum(V(g)$seed)) +V(g)$spawn.date = 0 +V(g)$infector = NA + +for (day in 1:t_max){ + day.vics = match(day,V(g)$vic.day) + if (is.na(day.vics)) next + for (vic in day.vics){ + neighbors = (unlist(neighborhood(g,3,vic)))[-1] + dists = as.numeric(shortest.paths(g,vic,neighbors)) + infected = neighbors[which(runif(length(neighbors))<structural(delta, dists))] + infected = setdiff(infected,seeds) # don't try to infect seeds + inf.days = day + ceiling(alpha*rexp(length(infected),alpha)) + V(g)$vic[infected] = TRUE + infects = (inf.days < V(g)$vic.day[infected]) %in% c(NA,T) + V(g)$vic.day[infected[infects]] = inf.days[infects] + V(g)$infector[infected[infects]] = vic + } +} + +vic_ids = which(V(g)$vic) +cols = rep('lightblue',N); cols[V(g)$vic]='red'; cols[V(g)$seed]='darkred' +plot(g, vertex.size=5, vertex.label=NA, vertex.color=cols) + +##### generate dag_dat +dag_dat_test = data.frame(matrix(nrow=1,ncol=10)) +ei = 1 +for (u in vic_ids){ + if ((which(vic_ids==u) %% 1000)==0) print(which(vic_ids==u)) + tu = V(g)$vic.day[u] + u_spawn = V(g)$spawn.date[u] + nbhd = (unlist(neighborhood(g,nodes=u,order=3)))[-1] # get nodes within neighborhood + tvs = V(g)$vic.day[nbhd] + v_spawn = V(g)$spawn.date[nbhd] + nbhd = nbhd[tu>v_spawn & (is.na(tvs) | tu<tvs)] + tvs = V(g)$vic.day[nbhd] + dists = as.numeric(shortest.paths(g,u,nbhd)) + + weights = matrix(1,nrow=length(nbhd),ncol=3) + + #will be faster to pre-allocate and fill in rather than rbind each time + dag_dat_test[ei:(ei+length(nbhd)-1),] = data.frame(rep(u,length(nbhd)), nbhd, + rep(tu,length(nbhd)), tvs, dists, + weights, rep(u_spawn,length(nbhd)), + rep(0,length(nbhd)), row.names=NULL) + ei = ei + length(nbhd) +} +colnames(dag_dat_test) = c('from','to','t1','t2','dist','w1','w2','w3','spawn1','spawn2') +rownames(dag_dat_test) = NULL + +write.csv(dag_dat_test, file='Results/dag_dat_test.csv') + +##### analyze performance of recovery algorithm +recovered = read.csv('Results/infectors.csv',header=F,col.names=c('victim','infector')) +recovered = recovered[order(recovered$victim),] +infectors = cbind(setdiff(vic_ids,seeds), + V(g)$infector[setdiff(vic_ids,seeds)], + recovered$infector[recovered$victim %in% setdiff(vic_ids,seeds)]) +mean(infectors[,2]==infectors[,3]) diff --git a/R Scripts/structural.R b/R Scripts/structural.R index 132aa6c..b68711c 100755 --- a/R Scripts/structural.R +++ b/R Scripts/structural.R @@ -1,5 +1,5 @@ -# structural = function(w1,w2,w3,gamma){ -# return (plogis(w1,scale=gamma) * plogis(w2,scale=gamma) * plogis(w3,scale=gamma)) +# structural = function(delta,lmbda,w1,w2,w3){ +# return (delta/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda))) # } structural = function(delta,dist){ diff --git a/experiments/build/temp.macosx-10.6-x86_64-2.7/ml2.o b/experiments/build/temp.macosx-10.6-x86_64-2.7/ml2.o Binary files differindex d3704b1..285f8be 100644 --- a/experiments/build/temp.macosx-10.6-x86_64-2.7/ml2.o +++ b/experiments/build/temp.macosx-10.6-x86_64-2.7/ml2.o diff --git a/experiments/build_network.py b/experiments/build_network.py index 6cb994c..0e912b0 100644 --- a/experiments/build_network.py +++ b/experiments/build_network.py @@ -14,12 +14,12 @@ def build_network(filename): from_, to = int(float(row["from"])), int(float(row["to"])) dist = int(row["dist"]) w1, w2, w3 = float(row["w1"]), float(row["w2"]), float(row["w3"]) - if int(float(row["dist"])) > 1: - continue + # if int(float(row["dist"])) > 1: + # continue # 'to' is a victim if row["t2"] != "NA": dt = int(row["t2"]) - int(row["t1"]) - parent = (dist, dt, w1, w2, w3) + parent = (from_, dist, dt, w1, w2, w3) if to not in victims: age += int(row["t2"]) - int(row["spawn2"]) victims[to] = [] @@ -29,8 +29,8 @@ def build_network(filename): victims[from_] = [] # 'to' is not a victim else: - dt = 3012 - int(row["t1"]) - parent = (dist, dt, w1, w2, w3) + dt = 1000 - int(row["t1"]) + parent = (from_, dist, dt, w1, w2, w3) if to not in non_victims: # age += 3012 - int(row["spawn2"]) non_victims[to] = [] @@ -39,13 +39,14 @@ def build_network(filename): age += int(row["t1"]) - int(row["spawn1"]) victims[from_] = [] root_victims = {} - # print victims.keys() + print sorted(victims.keys()) + # print victims for victim in victims.keys(): if not victims[victim]: del victims[victim] root_victims[victim] = [] - # print root_victims.keys() - # print len(root_victims), len(victims), len(non_victims) + print sorted(root_victims.keys()) + print len(root_victims), len(victims), len(non_victims) return root_victims, victims, non_victims, age diff --git a/experiments/ml2.c b/experiments/ml2.c index 572a8c5..a61a0d3 100644 --- a/experiments/ml2.c +++ b/experiments/ml2.c @@ -947,10 +947,39 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( - PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** py_start, PyObject** py_stop, PyObject** py_slice, - int has_cstart, int has_cstop, int wraparound); +#if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000 +static CYTHON_INLINE PyObject* __Pyx_PyObject_LookupSpecial(PyObject* obj, PyObject* attr_name) { + PyObject *res; + PyTypeObject *tp = Py_TYPE(obj); +#if PY_MAJOR_VERSION < 3 + if (unlikely(PyInstance_Check(obj))) + return __Pyx_PyObject_GetAttrStr(obj, attr_name); +#endif + res = _PyType_Lookup(tp, attr_name); + if (likely(res)) { + descrgetfunc f = Py_TYPE(res)->tp_descr_get; + if (!f) { + Py_INCREF(res); + } else { + res = f(res, obj, (PyObject *)tp); + } + } else { + PyErr_SetObject(PyExc_AttributeError, attr_name); + } + return res; +} +#else +#define __Pyx_PyObject_LookupSpecial(o,n) __Pyx_PyObject_GetAttrStr(o,n) +#endif + +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg); + +static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d); + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); @@ -1025,14 +1054,6 @@ static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); -static int __Pyx_Print(PyObject*, PyObject *, int); -#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3 -static PyObject* __pyx_print = 0; -static PyObject* __pyx_print_kwargs = 0; -#endif - -static int __Pyx_PrintOne(PyObject* stream, PyObject *o); - #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) @@ -1191,6 +1212,7 @@ int __pyx_module_is_main_ml2 = 0; /* Implementation of 'ml2' */ static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_sum; +static PyObject *__pyx_builtin_open; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; @@ -1213,6 +1235,7 @@ static char __pyx_k_l[] = "l"; static char __pyx_k_q[] = "q"; static char __pyx_k_s[] = "s"; static char __pyx_k_t[] = "t"; +static char __pyx_k_w[] = "w"; static char __pyx_k_Zd[] = "Zd"; static char __pyx_k_Zf[] = "Zf"; static char __pyx_k_Zg[] = "Zg"; @@ -1223,14 +1246,16 @@ static char __pyx_k_w1[] = "w1"; static char __pyx_k_w2[] = "w2"; static char __pyx_k_w3[] = "w3"; static char __pyx_k_dts[] = "dts"; -static char __pyx_k_end[] = "end"; static char __pyx_k_inf[] = "-inf"; static char __pyx_k_ml2[] = "ml2"; +static char __pyx_k_s_s[] = "%s, %s\n"; static char __pyx_k_sum[] = "sum"; static char __pyx_k_dist[] = "dist"; -static char __pyx_k_file[] = "file"; +static char __pyx_k_exit[] = "__exit__"; +static char __pyx_k_keys[] = "keys"; static char __pyx_k_main[] = "__main__"; -static char __pyx_k_mean[] = "mean"; +static char __pyx_k_open[] = "open"; +static char __pyx_k_prnt[] = "prnt"; static char __pyx_k_prob[] = "prob"; static char __pyx_k_test[] = "__test__"; static char __pyx_k_DTYPE[] = "DTYPE"; @@ -1238,12 +1263,14 @@ static char __pyx_k_alpha[] = "alpha"; static char __pyx_k_delta[] = "delta"; static char __pyx_k_dists[] = "dists"; static char __pyx_k_dtype[] = "dtype"; +static char __pyx_k_enter[] = "__enter__"; static char __pyx_k_lmbda[] = "lmbda"; static char __pyx_k_numpy[] = "numpy"; -static char __pyx_k_print[] = "print"; +static char __pyx_k_prnts[] = "prnts"; static char __pyx_k_probs[] = "probs"; static char __pyx_k_range[] = "range"; static char __pyx_k_roots[] = "roots"; +static char __pyx_k_write[] = "write"; static char __pyx_k_zeros[] = "zeros"; static char __pyx_k_import[] = "__import__"; static char __pyx_k_float64[] = "float64"; @@ -1251,8 +1278,10 @@ static char __pyx_k_n_roots[] = "n_roots"; static char __pyx_k_parents[] = "parents"; static char __pyx_k_victims[] = "victims"; static char __pyx_k_failures[] = "failures"; +static char __pyx_k_infector[] = "infector"; static char __pyx_k_probs_nv[] = "probs_nv"; static char __pyx_k_enumerate[] = "enumerate"; +static char __pyx_k_infectors[] = "infectors"; static char __pyx_k_n_victims[] = "n_victims"; static char __pyx_k_successes[] = "successes"; static char __pyx_k_ValueError[] = "ValueError"; @@ -1263,6 +1292,8 @@ static char __pyx_k_non_victims[] = "non_victims"; static char __pyx_k_RuntimeError[] = "RuntimeError"; static char __pyx_k_parent_dists[] = "parent_dists"; static char __pyx_k_root_victims[] = "root_victims"; +static char __pyx_k_infectors_file[] = "infectors_file"; +static char __pyx_k_Results_infectors_csv[] = "../../Results/infectors.csv"; static char __pyx_k_ndarray_is_not_C_contiguous[] = "ndarray is not C contiguous"; static char __pyx_k_Users_ben_Documents_Cascade_Pro[] = "/Users/ben/Documents/Cascade Project/criminal_cascades/experiments/ml2.pyx"; static char __pyx_k_unknown_dtype_code_in_numpy_pxd[] = "unknown dtype code in numpy.pxd (%d)"; @@ -1274,6 +1305,7 @@ static PyObject *__pyx_n_s_DTYPE; static PyObject *__pyx_kp_u_Format_string_allocated_too_shor; static PyObject *__pyx_kp_u_Format_string_allocated_too_shor_2; static PyObject *__pyx_kp_u_Non_native_byte_order_not_suppor; +static PyObject *__pyx_kp_s_Results_infectors_csv; static PyObject *__pyx_n_s_RuntimeError; static PyObject *__pyx_kp_s_Users_ben_Documents_Cascade_Pro; static PyObject *__pyx_n_s_ValueError; @@ -1284,20 +1316,23 @@ static PyObject *__pyx_n_s_dists; static PyObject *__pyx_n_s_dt; static PyObject *__pyx_n_s_dts; static PyObject *__pyx_n_s_dtype; -static PyObject *__pyx_n_s_end; +static PyObject *__pyx_n_s_enter; static PyObject *__pyx_n_s_enumerate; +static PyObject *__pyx_n_s_exit; static PyObject *__pyx_n_s_failures; -static PyObject *__pyx_n_s_file; static PyObject *__pyx_n_s_float64; static PyObject *__pyx_n_s_i; static PyObject *__pyx_n_s_import; static PyObject *__pyx_kp_s_inf; +static PyObject *__pyx_n_s_infector; +static PyObject *__pyx_n_s_infectors; +static PyObject *__pyx_n_s_infectors_file; static PyObject *__pyx_n_s_itervalues; +static PyObject *__pyx_n_s_keys; static PyObject *__pyx_n_s_l; static PyObject *__pyx_n_s_ll; static PyObject *__pyx_n_s_lmbda; static PyObject *__pyx_n_s_main; -static PyObject *__pyx_n_s_mean; static PyObject *__pyx_n_s_ml2; static PyObject *__pyx_n_s_n_roots; static PyObject *__pyx_n_s_n_victims; @@ -1306,10 +1341,12 @@ static PyObject *__pyx_kp_u_ndarray_is_not_Fortran_contiguou; static PyObject *__pyx_n_s_non_victims; static PyObject *__pyx_n_s_np; static PyObject *__pyx_n_s_numpy; +static PyObject *__pyx_n_s_open; static PyObject *__pyx_n_s_parent_dists; static PyObject *__pyx_n_s_parent_dts; static PyObject *__pyx_n_s_parents; -static PyObject *__pyx_n_s_print; +static PyObject *__pyx_n_s_prnt; +static PyObject *__pyx_n_s_prnts; static PyObject *__pyx_n_s_prob; static PyObject *__pyx_n_s_probs; static PyObject *__pyx_n_s_probs_fail; @@ -1318,20 +1355,21 @@ static PyObject *__pyx_n_s_range; static PyObject *__pyx_n_s_root_victims; static PyObject *__pyx_n_s_roots; static PyObject *__pyx_n_s_s; +static PyObject *__pyx_kp_s_s_s; static PyObject *__pyx_n_s_successes; static PyObject *__pyx_n_s_sum; static PyObject *__pyx_n_s_t; static PyObject *__pyx_n_s_test; static PyObject *__pyx_kp_u_unknown_dtype_code_in_numpy_pxd; static PyObject *__pyx_n_s_victims; +static PyObject *__pyx_n_s_w; static PyObject *__pyx_n_s_w1; static PyObject *__pyx_n_s_w2; static PyObject *__pyx_n_s_w3; +static PyObject *__pyx_n_s_write; static PyObject *__pyx_n_s_zeros; -static PyObject *__pyx_int_1; -static PyObject *__pyx_int_100; -static PyObject *__pyx_slice_; -static PyObject *__pyx_slice__2; +static PyObject *__pyx_tuple_; +static PyObject *__pyx_tuple__2; static PyObject *__pyx_tuple__3; static PyObject *__pyx_tuple__4; static PyObject *__pyx_tuple__5; @@ -1349,7 +1387,7 @@ static PyObject *__pyx_codeobj__10; * """weight for successful infection, exponential time model""" */ -static __pyx_t_3ml2_DTYPE_t __pyx_f_3ml2_weight_success(CYTHON_UNUSED int __pyx_v_dist, int __pyx_v_dt, __pyx_t_3ml2_DTYPE_t __pyx_v_alpha, __pyx_t_3ml2_DTYPE_t __pyx_v_delta, __pyx_t_3ml2_DTYPE_t __pyx_v_lmbda, __pyx_t_3ml2_DTYPE_t __pyx_v_w1, __pyx_t_3ml2_DTYPE_t __pyx_v_w2, __pyx_t_3ml2_DTYPE_t __pyx_v_w3) { +static __pyx_t_3ml2_DTYPE_t __pyx_f_3ml2_weight_success(int __pyx_v_dist, int __pyx_v_dt, __pyx_t_3ml2_DTYPE_t __pyx_v_alpha, __pyx_t_3ml2_DTYPE_t __pyx_v_delta, CYTHON_UNUSED __pyx_t_3ml2_DTYPE_t __pyx_v_lmbda, CYTHON_UNUSED __pyx_t_3ml2_DTYPE_t __pyx_v_w1, CYTHON_UNUSED __pyx_t_3ml2_DTYPE_t __pyx_v_w2, CYTHON_UNUSED __pyx_t_3ml2_DTYPE_t __pyx_v_w3) { __pyx_t_3ml2_DTYPE_t __pyx_v_structural; __pyx_t_3ml2_DTYPE_t __pyx_v_temporal; __pyx_t_3ml2_DTYPE_t __pyx_v_result; @@ -1357,26 +1395,26 @@ static __pyx_t_3ml2_DTYPE_t __pyx_f_3ml2_weight_success(CYTHON_UNUSED int __pyx_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("weight_success", 0); - /* "ml2.pyx":14 + /* "ml2.pyx":13 + * """weight for successful infection, exponential time model""" * cdef DTYPE_t structural, temporal, result - * # structural = delta ** dist - * structural = delta/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda)) # <<<<<<<<<<<<<< + * structural = delta ** dist # <<<<<<<<<<<<<< + * # structural = delta/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda)) * temporal = log(exp(alpha)-1.) - alpha*dt - * # temporal = 1 - exp(-alpha*dt) */ - __pyx_v_structural = (__pyx_v_delta / (((1. + (1. / (__pyx_v_w1 * __pyx_v_lmbda))) + (1. / (__pyx_v_w2 * __pyx_v_lmbda))) + (1. / (__pyx_v_w3 * __pyx_v_lmbda)))); + __pyx_v_structural = pow(__pyx_v_delta, ((__pyx_t_3ml2_DTYPE_t)__pyx_v_dist)); /* "ml2.pyx":15 - * # structural = delta ** dist - * structural = delta/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda)) + * structural = delta ** dist + * # structural = delta/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda)) * temporal = log(exp(alpha)-1.) - alpha*dt # <<<<<<<<<<<<<< - * # temporal = 1 - exp(-alpha*dt) - * # 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 */ __pyx_v_temporal = (log((exp(__pyx_v_alpha) - 1.)) - (__pyx_v_alpha * __pyx_v_dt)); - /* "ml2.pyx":19 - * # if exp(-alpha*dt)==0.: print 'UNDERFLOW ERROR' + /* "ml2.pyx":17 + * temporal = log(exp(alpha)-1.) - alpha*dt * # temporal = 1. / (1. + (dt - 1.)/alpha)**0.01 - 1. / (1. + dt/alpha)**0.01 * result = log(structural) + temporal # <<<<<<<<<<<<<< * # print 'st', structural, temporal @@ -1384,7 +1422,7 @@ static __pyx_t_3ml2_DTYPE_t __pyx_f_3ml2_weight_success(CYTHON_UNUSED int __pyx_ */ __pyx_v_result = (log(__pyx_v_structural) + __pyx_v_temporal); - /* "ml2.pyx":21 + /* "ml2.pyx":19 * result = log(structural) + temporal * # print 'st', structural, temporal * return result # <<<<<<<<<<<<<< @@ -1408,7 +1446,7 @@ static __pyx_t_3ml2_DTYPE_t __pyx_f_3ml2_weight_success(CYTHON_UNUSED int __pyx_ return __pyx_r; } -/* "ml2.pyx":23 +/* "ml2.pyx":21 * return result * * cdef DTYPE_t weight_failure(int dist, int dt, DTYPE_t alpha, DTYPE_t delta, DTYPE_t lmbda, # <<<<<<<<<<<<<< @@ -1416,7 +1454,7 @@ static __pyx_t_3ml2_DTYPE_t __pyx_f_3ml2_weight_success(CYTHON_UNUSED int __pyx_ * """weight for failed infection, exponential time model""" */ -static __pyx_t_3ml2_DTYPE_t __pyx_f_3ml2_weight_failure(CYTHON_UNUSED int __pyx_v_dist, int __pyx_v_dt, __pyx_t_3ml2_DTYPE_t __pyx_v_alpha, __pyx_t_3ml2_DTYPE_t __pyx_v_delta, __pyx_t_3ml2_DTYPE_t __pyx_v_lmbda, __pyx_t_3ml2_DTYPE_t __pyx_v_w1, __pyx_t_3ml2_DTYPE_t __pyx_v_w2, __pyx_t_3ml2_DTYPE_t __pyx_v_w3) { +static __pyx_t_3ml2_DTYPE_t __pyx_f_3ml2_weight_failure(int __pyx_v_dist, int __pyx_v_dt, __pyx_t_3ml2_DTYPE_t __pyx_v_alpha, __pyx_t_3ml2_DTYPE_t __pyx_v_delta, CYTHON_UNUSED __pyx_t_3ml2_DTYPE_t __pyx_v_lmbda, CYTHON_UNUSED __pyx_t_3ml2_DTYPE_t __pyx_v_w1, CYTHON_UNUSED __pyx_t_3ml2_DTYPE_t __pyx_v_w2, CYTHON_UNUSED __pyx_t_3ml2_DTYPE_t __pyx_v_w3) { __pyx_t_3ml2_DTYPE_t __pyx_v_structural; __pyx_t_3ml2_DTYPE_t __pyx_v_temporal; __pyx_t_3ml2_DTYPE_t __pyx_v_result; @@ -1424,25 +1462,25 @@ static __pyx_t_3ml2_DTYPE_t __pyx_f_3ml2_weight_failure(CYTHON_UNUSED int __pyx_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("weight_failure", 0); - /* "ml2.pyx":28 + /* "ml2.pyx":25 + * """weight for failed infection, exponential time model""" * cdef DTYPE_t structural, temporal, result - * # structural = delta ** dist - * structural = delta/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda)) # <<<<<<<<<<<<<< + * structural = delta ** dist # <<<<<<<<<<<<<< + * # structural = delta/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda)) * temporal = exp(-alpha * dt) - * # temporal = 1. - 1. / (1. + dt/alpha)**0.01 */ - __pyx_v_structural = (__pyx_v_delta / (((1. + (1. / (__pyx_v_w1 * __pyx_v_lmbda))) + (1. / (__pyx_v_w2 * __pyx_v_lmbda))) + (1. / (__pyx_v_w3 * __pyx_v_lmbda)))); + __pyx_v_structural = pow(__pyx_v_delta, ((__pyx_t_3ml2_DTYPE_t)__pyx_v_dist)); - /* "ml2.pyx":29 - * # structural = delta ** dist - * structural = delta/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda)) + /* "ml2.pyx":27 + * structural = delta ** dist + * # structural = delta/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda)) * temporal = exp(-alpha * dt) # <<<<<<<<<<<<<< * # temporal = 1. - 1. / (1. + dt/alpha)**0.01 * result = log(1. - structural + structural * temporal) */ __pyx_v_temporal = exp(((-__pyx_v_alpha) * __pyx_v_dt)); - /* "ml2.pyx":31 + /* "ml2.pyx":29 * temporal = exp(-alpha * dt) * # temporal = 1. - 1. / (1. + dt/alpha)**0.01 * result = log(1. - structural + structural * temporal) # <<<<<<<<<<<<<< @@ -1451,7 +1489,7 @@ static __pyx_t_3ml2_DTYPE_t __pyx_f_3ml2_weight_failure(CYTHON_UNUSED int __pyx_ */ __pyx_v_result = log(((1. - __pyx_v_structural) + (__pyx_v_structural * __pyx_v_temporal))); - /* "ml2.pyx":33 + /* "ml2.pyx":31 * result = log(1. - structural + structural * temporal) * # print 'stnv', structural, temporal * return result # <<<<<<<<<<<<<< @@ -1461,7 +1499,7 @@ static __pyx_t_3ml2_DTYPE_t __pyx_f_3ml2_weight_failure(CYTHON_UNUSED int __pyx_ __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "ml2.pyx":23 + /* "ml2.pyx":21 * return result * * cdef DTYPE_t weight_failure(int dist, int dt, DTYPE_t alpha, DTYPE_t delta, DTYPE_t lmbda, # <<<<<<<<<<<<<< @@ -1475,7 +1513,7 @@ static __pyx_t_3ml2_DTYPE_t __pyx_f_3ml2_weight_failure(CYTHON_UNUSED int __pyx_ return __pyx_r; } -/* "ml2.pyx":35 +/* "ml2.pyx":33 * return result * * def ml2(dict root_victims, dict victims, dict non_victims, # <<<<<<<<<<<<<< @@ -1523,31 +1561,31 @@ static PyObject *__pyx_pw_3ml2_1ml2(PyObject *__pyx_self, PyObject *__pyx_args, case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_victims)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("ml2", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("ml2", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_non_victims)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("ml2", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("ml2", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("ml2", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("ml2", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_delta)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("ml2", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("ml2", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lmbda)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("ml2", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("ml2", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ml2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ml2") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { goto __pyx_L5_argtuple_error; @@ -1562,21 +1600,21 @@ static PyObject *__pyx_pw_3ml2_1ml2(PyObject *__pyx_self, PyObject *__pyx_args, __pyx_v_root_victims = ((PyObject*)values[0]); __pyx_v_victims = ((PyObject*)values[1]); __pyx_v_non_victims = ((PyObject*)values[2]); - __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_alpha == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_delta = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_delta == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_lmbda = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_lmbda == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_alpha == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_delta = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_delta == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_lmbda = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_lmbda == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("ml2", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("ml2", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("ml2.ml2", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_root_victims), (&PyDict_Type), 1, "root_victims", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_victims), (&PyDict_Type), 1, "victims", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_non_victims), (&PyDict_Type), 1, "non_victims", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_root_victims), (&PyDict_Type), 1, "root_victims", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_victims), (&PyDict_Type), 1, "victims", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_non_victims), (&PyDict_Type), 1, "non_victims", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_3ml2_ml2(__pyx_self, __pyx_v_root_victims, __pyx_v_victims, __pyx_v_non_victims, __pyx_v_alpha, __pyx_v_delta, __pyx_v_lmbda); /* function exit code */ @@ -1605,13 +1643,20 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject PyArrayObject *__pyx_v_probs_nv = 0; PyArrayObject *__pyx_v_parent_dists = 0; PyArrayObject *__pyx_v_parent_dts = 0; + PyArrayObject *__pyx_v_infectors = 0; PyObject *__pyx_v_dists = NULL; PyObject *__pyx_v_dts = NULL; + PyObject *__pyx_v_prnts = NULL; PyObject *__pyx_v_s = NULL; PyObject *__pyx_v_prob = NULL; + PyObject *__pyx_v_infectors_file = NULL; + PyObject *__pyx_v_infector = NULL; + PyObject *__pyx_v_prnt = NULL; PyObject *__pyx_v_w1 = NULL; PyObject *__pyx_v_w2 = NULL; PyObject *__pyx_v_w3 = NULL; + __Pyx_LocalBuf_ND __pyx_pybuffernd_infectors; + __Pyx_Buffer __pyx_pybuffer_infectors; __Pyx_LocalBuf_ND __pyx_pybuffernd_parent_dists; __Pyx_Buffer __pyx_pybuffer_parent_dists; __Pyx_LocalBuf_ND __pyx_pybuffernd_parent_dts; @@ -1635,29 +1680,39 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject PyArrayObject *__pyx_t_9 = NULL; PyArrayObject *__pyx_t_10 = NULL; PyArrayObject *__pyx_t_11 = NULL; - int __pyx_t_12; + PyArrayObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_t_14; - Py_ssize_t __pyx_t_15; - PyObject *__pyx_t_16 = NULL; + int __pyx_t_15; + Py_ssize_t __pyx_t_16; PyObject *__pyx_t_17 = NULL; PyObject *__pyx_t_18 = NULL; PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; - PyObject *(*__pyx_t_22)(PyObject *); - int __pyx_t_23; - __pyx_t_3ml2_DTYPE_t __pyx_t_24; - __pyx_t_3ml2_DTYPE_t __pyx_t_25; + PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; + PyObject *(*__pyx_t_24)(PyObject *); + int __pyx_t_25; __pyx_t_3ml2_DTYPE_t __pyx_t_26; - int __pyx_t_27; - double __pyx_t_28; + __pyx_t_3ml2_DTYPE_t __pyx_t_27; + __pyx_t_3ml2_DTYPE_t __pyx_t_28; int __pyx_t_29; - int __pyx_t_30; + double __pyx_t_30; int __pyx_t_31; int __pyx_t_32; int __pyx_t_33; int __pyx_t_34; + int __pyx_t_35; + int __pyx_t_36; + int __pyx_t_37; + PyObject *__pyx_t_38 = NULL; + PyObject *__pyx_t_39 = NULL; + PyObject *__pyx_t_40 = NULL; + PyObject *__pyx_t_41 = NULL; + PyObject *(*__pyx_t_42)(PyObject *); + PyObject *__pyx_t_43 = NULL; + int __pyx_t_44; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -1682,8 +1737,12 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject __pyx_pybuffer_parent_dts.refcount = 0; __pyx_pybuffernd_parent_dts.data = NULL; __pyx_pybuffernd_parent_dts.rcbuffer = &__pyx_pybuffer_parent_dts; + __pyx_pybuffer_infectors.pybuffer.buf = NULL; + __pyx_pybuffer_infectors.refcount = 0; + __pyx_pybuffernd_infectors.data = NULL; + __pyx_pybuffernd_infectors.rcbuffer = &__pyx_pybuffer_infectors; - /* "ml2.pyx":41 + /* "ml2.pyx":39 * DTYPE_t ll * list parents, failures, successes * n_roots, n_victims = len(root_victims), len(victims) # <<<<<<<<<<<<<< @@ -1692,54 +1751,54 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject */ if (unlikely(__pyx_v_root_victims == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = PyDict_Size(__pyx_v_root_victims); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_Size(__pyx_v_root_victims); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(__pyx_v_victims == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = PyDict_Size(__pyx_v_victims); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_Size(__pyx_v_victims); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n_roots = __pyx_t_1; __pyx_v_n_victims = __pyx_t_2; - /* "ml2.pyx":43 + /* "ml2.pyx":41 * n_roots, n_victims = len(root_victims), len(victims) * cdef: * np.ndarray[DTYPE_t] probs = np.zeros(n_victims, dtype=DTYPE) # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t] probs_fail = np.zeros(n_victims, dtype=DTYPE) * np.ndarray[DTYPE_t] probs_nv = np.zeros(len(non_victims), dtype=DTYPE) */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_victims); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_victims); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probs.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_3ml2_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_probs = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_probs.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_probs.diminfo[0].strides = __pyx_pybuffernd_probs.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probs.diminfo[0].shape = __pyx_pybuffernd_probs.rcbuffer->pybuffer.shape[0]; } } @@ -1747,43 +1806,43 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject __pyx_v_probs = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "ml2.pyx":44 + /* "ml2.pyx":42 * cdef: * np.ndarray[DTYPE_t] probs = np.zeros(n_victims, dtype=DTYPE) * np.ndarray[DTYPE_t] probs_fail = np.zeros(n_victims, dtype=DTYPE) # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t] probs_nv = np.zeros(len(non_victims), dtype=DTYPE) * np.ndarray[DTYPE_t] parent_dists = np.zeros(n_victims, dtype=DTYPE) */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_victims); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_victims); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probs_fail.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_3ml2_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_probs_fail = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_probs_fail.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_probs_fail.diminfo[0].strides = __pyx_pybuffernd_probs_fail.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probs_fail.diminfo[0].shape = __pyx_pybuffernd_probs_fail.rcbuffer->pybuffer.shape[0]; } } @@ -1791,48 +1850,48 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject __pyx_v_probs_fail = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "ml2.pyx":45 + /* "ml2.pyx":43 * np.ndarray[DTYPE_t] probs = np.zeros(n_victims, dtype=DTYPE) * np.ndarray[DTYPE_t] probs_fail = np.zeros(n_victims, dtype=DTYPE) * np.ndarray[DTYPE_t] probs_nv = np.zeros(len(non_victims), dtype=DTYPE) # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t] parent_dists = np.zeros(n_victims, dtype=DTYPE) * np.ndarray[DTYPE_t] parent_dts = np.zeros(n_victims, dtype=DTYPE) */ - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (unlikely(__pyx_v_non_victims == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = PyDict_Size(__pyx_v_non_victims); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_Size(__pyx_v_non_victims); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_probs_nv.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_3ml2_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_probs_nv = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_probs_nv.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_probs_nv.diminfo[0].strides = __pyx_pybuffernd_probs_nv.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_probs_nv.diminfo[0].shape = __pyx_pybuffernd_probs_nv.rcbuffer->pybuffer.shape[0]; } } @@ -1840,43 +1899,43 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject __pyx_v_probs_nv = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "ml2.pyx":46 + /* "ml2.pyx":44 * np.ndarray[DTYPE_t] probs_fail = np.zeros(n_victims, dtype=DTYPE) * np.ndarray[DTYPE_t] probs_nv = np.zeros(len(non_victims), dtype=DTYPE) * np.ndarray[DTYPE_t] parent_dists = np.zeros(n_victims, dtype=DTYPE) # <<<<<<<<<<<<<< * np.ndarray[DTYPE_t] parent_dts = np.zeros(n_victims, dtype=DTYPE) - * + * np.ndarray[DTYPE_t] infectors = np.zeros(n_victims, dtype=DTYPE) */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_zeros); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_victims); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_n_victims); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_dtype, __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_6); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_parent_dists.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_3ml2_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_parent_dists = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_parent_dists.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_parent_dists.diminfo[0].strides = __pyx_pybuffernd_parent_dists.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_parent_dists.diminfo[0].shape = __pyx_pybuffernd_parent_dists.rcbuffer->pybuffer.shape[0]; } } @@ -1884,43 +1943,43 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject __pyx_v_parent_dists = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "ml2.pyx":47 + /* "ml2.pyx":45 * np.ndarray[DTYPE_t] probs_nv = np.zeros(len(non_victims), dtype=DTYPE) * np.ndarray[DTYPE_t] parent_dists = np.zeros(n_victims, dtype=DTYPE) * np.ndarray[DTYPE_t] parent_dts = np.zeros(n_victims, dtype=DTYPE) # <<<<<<<<<<<<<< + * np.ndarray[DTYPE_t] infectors = np.zeros(n_victims, dtype=DTYPE) * - * # loop through victims */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_victims); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_victims); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_dtype, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_parent_dts.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_3ml2_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_parent_dts = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_parent_dts.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_parent_dts.diminfo[0].strides = __pyx_pybuffernd_parent_dts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_parent_dts.diminfo[0].shape = __pyx_pybuffernd_parent_dts.rcbuffer->pybuffer.shape[0]; } } @@ -1928,542 +1987,716 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject __pyx_v_parent_dts = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "ml2.pyx":50 + /* "ml2.pyx":46 + * np.ndarray[DTYPE_t] parent_dists = np.zeros(n_victims, dtype=DTYPE) + * np.ndarray[DTYPE_t] parent_dts = np.zeros(n_victims, dtype=DTYPE) + * np.ndarray[DTYPE_t] infectors = np.zeros(n_victims, dtype=DTYPE) # <<<<<<<<<<<<<< + * + * # loop through victims + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n_victims); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_DTYPE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_4, __pyx_n_s_dtype, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = ((PyArrayObject *)__pyx_t_3); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_infectors.rcbuffer->pybuffer, (PyObject*)__pyx_t_12, &__Pyx_TypeInfo_nn___pyx_t_3ml2_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_infectors = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_infectors.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_infectors.diminfo[0].strides = __pyx_pybuffernd_infectors.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_infectors.diminfo[0].shape = __pyx_pybuffernd_infectors.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_12 = 0; + __pyx_v_infectors = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "ml2.pyx":49 * * # loop through victims * for i, parents in enumerate(victims.itervalues()): # <<<<<<<<<<<<<< * # for each victim node i, compute the probability that all its parents * # fail to infect it, also computes the probability that its most */ - __pyx_t_12 = 0; + __pyx_t_13 = 0; __pyx_t_2 = 0; if (unlikely(__pyx_v_victims == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "itervalues"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_6 = __Pyx_dict_iterator(__pyx_v_victims, 1, __pyx_n_s_itervalues, (&__pyx_t_1), (&__pyx_t_13)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_4); - __pyx_t_4 = __pyx_t_6; - __pyx_t_6 = 0; + __pyx_t_4 = __Pyx_dict_iterator(__pyx_v_victims, 1, __pyx_n_s_itervalues, (&__pyx_t_1), (&__pyx_t_14)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_3); + __pyx_t_3 = __pyx_t_4; + __pyx_t_4 = 0; while (1) { - __pyx_t_14 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_1, &__pyx_t_2, NULL, &__pyx_t_6, NULL, __pyx_t_13); - if (unlikely(__pyx_t_14 == 0)) break; - if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - if (!(likely(PyList_CheckExact(__pyx_t_6))||((__pyx_t_6) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_6)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF_SET(__pyx_v_parents, ((PyObject*)__pyx_t_6)); - __pyx_t_6 = 0; - __pyx_v_i = __pyx_t_12; - __pyx_t_12 = (__pyx_t_12 + 1); + __pyx_t_15 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_1, &__pyx_t_2, NULL, &__pyx_t_4, NULL, __pyx_t_14); + if (unlikely(__pyx_t_15 == 0)) break; + if (unlikely(__pyx_t_15 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + if (!(likely(PyList_CheckExact(__pyx_t_4))||((__pyx_t_4) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_4)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF_SET(__pyx_v_parents, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; + __pyx_v_i = __pyx_t_13; + __pyx_t_13 = (__pyx_t_13 + 1); - /* "ml2.pyx":54 + /* "ml2.pyx":53 * # fail to infect it, also computes the probability that its most * # likely parent infects it * failures = [weight_failure(dist, dt, alpha, delta, lmbda, w1, w2, w3) # <<<<<<<<<<<<<< - * for (dist, dt, w1, w2, w3) in parents] + * for (prnt, dist, dt, w1, w2, w3) in parents] * probs_fail[i] = sum(failures) */ - __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); - /* "ml2.pyx":55 + /* "ml2.pyx":54 * # likely parent infects it * failures = [weight_failure(dist, dt, alpha, delta, lmbda, w1, w2, w3) - * for (dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< + * for (prnt, dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< * probs_fail[i] = sum(failures) * successes = [weight_success(dist, dt, alpha, delta, lmbda, w1, w2, w3) */ if (unlikely(__pyx_v_parents == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_5 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_5); __pyx_t_15 = 0; + __pyx_t_5 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_5); __pyx_t_16 = 0; for (;;) { - if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_5)) break; + if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_5)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_15); __Pyx_INCREF(__pyx_t_3); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_16); __Pyx_INCREF(__pyx_t_6); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif - if (unlikely(size != 5)) { - if (size > 5) __Pyx_RaiseTooManyValuesError(5); + if (unlikely(size != 6)) { + if (size > 6) __Pyx_RaiseTooManyValuesError(6); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_16 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_17 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_18 = PyTuple_GET_ITEM(sequence, 2); - __pyx_t_19 = PyTuple_GET_ITEM(sequence, 3); - __pyx_t_20 = PyTuple_GET_ITEM(sequence, 4); + __pyx_t_17 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_18 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_19 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_20 = PyTuple_GET_ITEM(sequence, 3); + __pyx_t_21 = PyTuple_GET_ITEM(sequence, 4); + __pyx_t_22 = PyTuple_GET_ITEM(sequence, 5); } else { - __pyx_t_16 = PyList_GET_ITEM(sequence, 0); - __pyx_t_17 = PyList_GET_ITEM(sequence, 1); - __pyx_t_18 = PyList_GET_ITEM(sequence, 2); - __pyx_t_19 = PyList_GET_ITEM(sequence, 3); - __pyx_t_20 = PyList_GET_ITEM(sequence, 4); + __pyx_t_17 = PyList_GET_ITEM(sequence, 0); + __pyx_t_18 = PyList_GET_ITEM(sequence, 1); + __pyx_t_19 = PyList_GET_ITEM(sequence, 2); + __pyx_t_20 = PyList_GET_ITEM(sequence, 3); + __pyx_t_21 = PyList_GET_ITEM(sequence, 4); + __pyx_t_22 = PyList_GET_ITEM(sequence, 5); } - __Pyx_INCREF(__pyx_t_16); __Pyx_INCREF(__pyx_t_17); __Pyx_INCREF(__pyx_t_18); __Pyx_INCREF(__pyx_t_19); __Pyx_INCREF(__pyx_t_20); + __Pyx_INCREF(__pyx_t_21); + __Pyx_INCREF(__pyx_t_22); #else { Py_ssize_t i; - PyObject** temps[5] = {&__pyx_t_16,&__pyx_t_17,&__pyx_t_18,&__pyx_t_19,&__pyx_t_20}; - for (i=0; i < 5; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject** temps[6] = {&__pyx_t_17,&__pyx_t_18,&__pyx_t_19,&__pyx_t_20,&__pyx_t_21,&__pyx_t_22}; + for (i=0; i < 6; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(item); *(temps[i]) = item; } } #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { Py_ssize_t index = -1; - PyObject** temps[5] = {&__pyx_t_16,&__pyx_t_17,&__pyx_t_18,&__pyx_t_19,&__pyx_t_20}; - __pyx_t_21 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_21); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_22 = Py_TYPE(__pyx_t_21)->tp_iternext; - for (index=0; index < 5; index++) { - PyObject* item = __pyx_t_22(__pyx_t_21); if (unlikely(!item)) goto __pyx_L7_unpacking_failed; + PyObject** temps[6] = {&__pyx_t_17,&__pyx_t_18,&__pyx_t_19,&__pyx_t_20,&__pyx_t_21,&__pyx_t_22}; + __pyx_t_23 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_24 = Py_TYPE(__pyx_t_23)->tp_iternext; + for (index=0; index < 6; index++) { + PyObject* item = __pyx_t_24(__pyx_t_23); if (unlikely(!item)) goto __pyx_L7_unpacking_failed; __Pyx_GOTREF(item); *(temps[index]) = item; } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_21), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_22 = NULL; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + if (__Pyx_IternextUnpackEndCheck(__pyx_t_24(__pyx_t_23), 6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_24 = NULL; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; goto __pyx_L8_unpacking_done; __pyx_L7_unpacking_failed:; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __pyx_t_22 = NULL; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __pyx_t_24 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L8_unpacking_done:; } - __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_16); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_23 = __Pyx_PyInt_As_int(__pyx_t_17); if (unlikely((__pyx_t_23 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_v_dist = __pyx_t_14; - __pyx_v_dt = __pyx_t_23; - __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_18); - __pyx_t_18 = 0; - __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_19); - __pyx_t_19 = 0; - __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_20); + __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_18); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_25 = __Pyx_PyInt_As_int(__pyx_t_19); if (unlikely((__pyx_t_25 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF_SET(__pyx_v_prnt, __pyx_t_17); + __pyx_t_17 = 0; + __pyx_v_dist = __pyx_t_15; + __pyx_v_dt = __pyx_t_25; + __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_20); __pyx_t_20 = 0; + __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_21); + __pyx_t_21 = 0; + __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_22); + __pyx_t_22 = 0; - /* "ml2.pyx":54 + /* "ml2.pyx":53 * # fail to infect it, also computes the probability that its most * # likely parent infects it * failures = [weight_failure(dist, dt, alpha, delta, lmbda, w1, w2, w3) # <<<<<<<<<<<<<< - * for (dist, dt, w1, w2, w3) in parents] + * for (prnt, dist, dt, w1, w2, w3) in parents] * probs_fail[i] = sum(failures) */ - __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_v_w1); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_v_w2); if (unlikely((__pyx_t_25 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_v_w3); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyFloat_FromDouble(__pyx_f_3ml2_weight_failure(__pyx_v_dist, __pyx_v_dt, __pyx_v_alpha, __pyx_v_delta, __pyx_v_lmbda, __pyx_t_24, __pyx_t_25, __pyx_t_26)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_v_w1); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_27 = __pyx_PyFloat_AsDouble(__pyx_v_w2); if (unlikely((__pyx_t_27 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_v_w3); if (unlikely((__pyx_t_28 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyFloat_FromDouble(__pyx_f_3ml2_weight_failure(__pyx_v_dist, __pyx_v_dt, __pyx_v_alpha, __pyx_v_delta, __pyx_v_lmbda, __pyx_t_26, __pyx_t_27, __pyx_t_28)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_4, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "ml2.pyx":55 + /* "ml2.pyx":54 * # likely parent infects it * failures = [weight_failure(dist, dt, alpha, delta, lmbda, w1, w2, w3) - * for (dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< + * for (prnt, dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< * probs_fail[i] = sum(failures) * successes = [weight_success(dist, dt, alpha, delta, lmbda, w1, w2, w3) */ } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_XDECREF_SET(__pyx_v_failures, ((PyObject*)__pyx_t_6)); - __pyx_t_6 = 0; + __Pyx_XDECREF_SET(__pyx_v_failures, ((PyObject*)__pyx_t_4)); + __pyx_t_4 = 0; - /* "ml2.pyx":56 + /* "ml2.pyx":55 * failures = [weight_failure(dist, dt, alpha, delta, lmbda, w1, w2, w3) - * for (dist, dt, w1, w2, w3) in parents] + * for (prnt, dist, dt, w1, w2, w3) in parents] * probs_fail[i] = sum(failures) # <<<<<<<<<<<<<< * successes = [weight_success(dist, dt, alpha, delta, lmbda, w1, w2, w3) - * for (dist, dt, w1, w2, w3) in parents] + * for (prnt, dist, dt, w1, w2, w3) in parents] */ - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_failures); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_failures); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_failures); __Pyx_GIVEREF(__pyx_v_failures); - __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_sum, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_sum, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_28 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_23 = __pyx_v_i; - if (__pyx_t_23 < 0) __pyx_t_23 += __pyx_pybuffernd_probs_fail.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_probs_fail.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_probs_fail.diminfo[0].strides) = __pyx_t_26; + __pyx_t_25 = __pyx_v_i; + if (__pyx_t_25 < 0) __pyx_t_25 += __pyx_pybuffernd_probs_fail.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_probs_fail.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_probs_fail.diminfo[0].strides) = __pyx_t_28; - /* "ml2.pyx":57 - * for (dist, dt, w1, w2, w3) in parents] + /* "ml2.pyx":56 + * for (prnt, dist, dt, w1, w2, w3) in parents] * probs_fail[i] = sum(failures) * successes = [weight_success(dist, dt, alpha, delta, lmbda, w1, w2, w3) # <<<<<<<<<<<<<< - * for (dist, dt, w1, w2, w3) in parents] - * dists = [dist for (dist, dt, w1, w2, w3) in parents] + * for (prnt, dist, dt, w1, w2, w3) in parents] + * dists = [dist for (prnt, dist, dt, w1, w2, w3) in parents] */ - __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - /* "ml2.pyx":58 + /* "ml2.pyx":57 * probs_fail[i] = sum(failures) * successes = [weight_success(dist, dt, alpha, delta, lmbda, w1, w2, w3) - * for (dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< - * dists = [dist for (dist, dt, w1, w2, w3) in parents] - * dts = [dt for (dist, dt, w1, w2, w3) in parents] + * for (prnt, dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< + * dists = [dist for (prnt, dist, dt, w1, w2, w3) in parents] + * dts = [dt for (prnt, dist, dt, w1, w2, w3) in parents] */ if (unlikely(__pyx_v_parents == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_6 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_6); __pyx_t_15 = 0; + __pyx_t_4 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_4); __pyx_t_16 = 0; for (;;) { - if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_6)) break; + if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_15); __Pyx_INCREF(__pyx_t_3); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_16); __Pyx_INCREF(__pyx_t_6); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif - if (unlikely(size != 5)) { - if (size > 5) __Pyx_RaiseTooManyValuesError(5); + if (unlikely(size != 6)) { + if (size > 6) __Pyx_RaiseTooManyValuesError(6); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_20 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_19 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_18 = PyTuple_GET_ITEM(sequence, 2); - __pyx_t_17 = PyTuple_GET_ITEM(sequence, 3); - __pyx_t_16 = PyTuple_GET_ITEM(sequence, 4); + __pyx_t_22 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_21 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_20 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_19 = PyTuple_GET_ITEM(sequence, 3); + __pyx_t_18 = PyTuple_GET_ITEM(sequence, 4); + __pyx_t_17 = PyTuple_GET_ITEM(sequence, 5); } else { - __pyx_t_20 = PyList_GET_ITEM(sequence, 0); - __pyx_t_19 = PyList_GET_ITEM(sequence, 1); - __pyx_t_18 = PyList_GET_ITEM(sequence, 2); - __pyx_t_17 = PyList_GET_ITEM(sequence, 3); - __pyx_t_16 = PyList_GET_ITEM(sequence, 4); + __pyx_t_22 = PyList_GET_ITEM(sequence, 0); + __pyx_t_21 = PyList_GET_ITEM(sequence, 1); + __pyx_t_20 = PyList_GET_ITEM(sequence, 2); + __pyx_t_19 = PyList_GET_ITEM(sequence, 3); + __pyx_t_18 = PyList_GET_ITEM(sequence, 4); + __pyx_t_17 = PyList_GET_ITEM(sequence, 5); } + __Pyx_INCREF(__pyx_t_22); + __Pyx_INCREF(__pyx_t_21); __Pyx_INCREF(__pyx_t_20); __Pyx_INCREF(__pyx_t_19); __Pyx_INCREF(__pyx_t_18); __Pyx_INCREF(__pyx_t_17); - __Pyx_INCREF(__pyx_t_16); #else { Py_ssize_t i; - PyObject** temps[5] = {&__pyx_t_20,&__pyx_t_19,&__pyx_t_18,&__pyx_t_17,&__pyx_t_16}; - for (i=0; i < 5; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject** temps[6] = {&__pyx_t_22,&__pyx_t_21,&__pyx_t_20,&__pyx_t_19,&__pyx_t_18,&__pyx_t_17}; + for (i=0; i < 6; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(item); *(temps[i]) = item; } } #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { Py_ssize_t index = -1; - PyObject** temps[5] = {&__pyx_t_20,&__pyx_t_19,&__pyx_t_18,&__pyx_t_17,&__pyx_t_16}; - __pyx_t_21 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_21); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_22 = Py_TYPE(__pyx_t_21)->tp_iternext; - for (index=0; index < 5; index++) { - PyObject* item = __pyx_t_22(__pyx_t_21); if (unlikely(!item)) goto __pyx_L11_unpacking_failed; + PyObject** temps[6] = {&__pyx_t_22,&__pyx_t_21,&__pyx_t_20,&__pyx_t_19,&__pyx_t_18,&__pyx_t_17}; + __pyx_t_23 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_24 = Py_TYPE(__pyx_t_23)->tp_iternext; + for (index=0; index < 6; index++) { + PyObject* item = __pyx_t_24(__pyx_t_23); if (unlikely(!item)) goto __pyx_L11_unpacking_failed; __Pyx_GOTREF(item); *(temps[index]) = item; } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_21), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_22 = NULL; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + if (__Pyx_IternextUnpackEndCheck(__pyx_t_24(__pyx_t_23), 6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_24 = NULL; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; goto __pyx_L12_unpacking_done; __pyx_L11_unpacking_failed:; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __pyx_t_22 = NULL; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __pyx_t_24 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L12_unpacking_done:; } - __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_20); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_21); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_29 = __Pyx_PyInt_As_int(__pyx_t_20); if (unlikely((__pyx_t_29 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __pyx_t_27 = __Pyx_PyInt_As_int(__pyx_t_19); if (unlikely((__pyx_t_27 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_v_dist = __pyx_t_14; - __pyx_v_dt = __pyx_t_27; - __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_18); + __Pyx_XDECREF_SET(__pyx_v_prnt, __pyx_t_22); + __pyx_t_22 = 0; + __pyx_v_dist = __pyx_t_15; + __pyx_v_dt = __pyx_t_29; + __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_19); + __pyx_t_19 = 0; + __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_18); __pyx_t_18 = 0; - __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_17); + __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_17); __pyx_t_17 = 0; - __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_16); - __pyx_t_16 = 0; - /* "ml2.pyx":57 - * for (dist, dt, w1, w2, w3) in parents] + /* "ml2.pyx":56 + * for (prnt, dist, dt, w1, w2, w3) in parents] * probs_fail[i] = sum(failures) * successes = [weight_success(dist, dt, alpha, delta, lmbda, w1, w2, w3) # <<<<<<<<<<<<<< - * for (dist, dt, w1, w2, w3) in parents] - * dists = [dist for (dist, dt, w1, w2, w3) in parents] + * for (prnt, dist, dt, w1, w2, w3) in parents] + * dists = [dist for (prnt, dist, dt, w1, w2, w3) in parents] */ - __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_v_w1); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_v_w2); if (unlikely((__pyx_t_25 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_v_w3); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyFloat_FromDouble(__pyx_f_3ml2_weight_success(__pyx_v_dist, __pyx_v_dt, __pyx_v_alpha, __pyx_v_delta, __pyx_v_lmbda, __pyx_t_26, __pyx_t_25, __pyx_t_24)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_v_w1); if (unlikely((__pyx_t_28 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_27 = __pyx_PyFloat_AsDouble(__pyx_v_w2); if (unlikely((__pyx_t_27 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_v_w3); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyFloat_FromDouble(__pyx_f_3ml2_weight_success(__pyx_v_dist, __pyx_v_dt, __pyx_v_alpha, __pyx_v_delta, __pyx_v_lmbda, __pyx_t_28, __pyx_t_27, __pyx_t_26)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "ml2.pyx":58 + /* "ml2.pyx":57 * probs_fail[i] = sum(failures) * successes = [weight_success(dist, dt, alpha, delta, lmbda, w1, w2, w3) - * for (dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< - * dists = [dist for (dist, dt, w1, w2, w3) in parents] - * dts = [dt for (dist, dt, w1, w2, w3) in parents] + * for (prnt, dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< + * dists = [dist for (prnt, dist, dt, w1, w2, w3) in parents] + * dts = [dt for (prnt, dist, dt, w1, w2, w3) in parents] */ } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF_SET(__pyx_v_successes, ((PyObject*)__pyx_t_5)); __pyx_t_5 = 0; - /* "ml2.pyx":59 + /* "ml2.pyx":58 * successes = [weight_success(dist, dt, alpha, delta, lmbda, w1, w2, w3) - * for (dist, dt, w1, w2, w3) in parents] - * dists = [dist for (dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< - * dts = [dt for (dist, dt, w1, w2, w3) in parents] - * # find parent that maximizes log(p) - log(\tilde{p}) + * for (prnt, dist, dt, w1, w2, w3) in parents] + * dists = [dist for (prnt, dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< + * dts = [dt for (prnt, dist, dt, w1, w2, w3) in parents] + * prnts = [prnt for (prnt, dist, dt, w1, w2, w3) in parents] */ - __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); if (unlikely(__pyx_v_parents == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_6 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_6); __pyx_t_15 = 0; + __pyx_t_4 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_4); __pyx_t_16 = 0; for (;;) { - if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_6)) break; + if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_15); __Pyx_INCREF(__pyx_t_3); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_16); __Pyx_INCREF(__pyx_t_6); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif - if (unlikely(size != 5)) { - if (size > 5) __Pyx_RaiseTooManyValuesError(5); + if (unlikely(size != 6)) { + if (size > 6) __Pyx_RaiseTooManyValuesError(6); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_16 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_17 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_18 = PyTuple_GET_ITEM(sequence, 2); - __pyx_t_19 = PyTuple_GET_ITEM(sequence, 3); - __pyx_t_20 = PyTuple_GET_ITEM(sequence, 4); + __pyx_t_17 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_18 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_19 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_20 = PyTuple_GET_ITEM(sequence, 3); + __pyx_t_21 = PyTuple_GET_ITEM(sequence, 4); + __pyx_t_22 = PyTuple_GET_ITEM(sequence, 5); } else { - __pyx_t_16 = PyList_GET_ITEM(sequence, 0); - __pyx_t_17 = PyList_GET_ITEM(sequence, 1); - __pyx_t_18 = PyList_GET_ITEM(sequence, 2); - __pyx_t_19 = PyList_GET_ITEM(sequence, 3); - __pyx_t_20 = PyList_GET_ITEM(sequence, 4); + __pyx_t_17 = PyList_GET_ITEM(sequence, 0); + __pyx_t_18 = PyList_GET_ITEM(sequence, 1); + __pyx_t_19 = PyList_GET_ITEM(sequence, 2); + __pyx_t_20 = PyList_GET_ITEM(sequence, 3); + __pyx_t_21 = PyList_GET_ITEM(sequence, 4); + __pyx_t_22 = PyList_GET_ITEM(sequence, 5); } - __Pyx_INCREF(__pyx_t_16); __Pyx_INCREF(__pyx_t_17); __Pyx_INCREF(__pyx_t_18); __Pyx_INCREF(__pyx_t_19); __Pyx_INCREF(__pyx_t_20); + __Pyx_INCREF(__pyx_t_21); + __Pyx_INCREF(__pyx_t_22); #else { Py_ssize_t i; - PyObject** temps[5] = {&__pyx_t_16,&__pyx_t_17,&__pyx_t_18,&__pyx_t_19,&__pyx_t_20}; - for (i=0; i < 5; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject** temps[6] = {&__pyx_t_17,&__pyx_t_18,&__pyx_t_19,&__pyx_t_20,&__pyx_t_21,&__pyx_t_22}; + for (i=0; i < 6; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(item); *(temps[i]) = item; } } #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { Py_ssize_t index = -1; - PyObject** temps[5] = {&__pyx_t_16,&__pyx_t_17,&__pyx_t_18,&__pyx_t_19,&__pyx_t_20}; - __pyx_t_21 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_21); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_22 = Py_TYPE(__pyx_t_21)->tp_iternext; - for (index=0; index < 5; index++) { - PyObject* item = __pyx_t_22(__pyx_t_21); if (unlikely(!item)) goto __pyx_L15_unpacking_failed; + PyObject** temps[6] = {&__pyx_t_17,&__pyx_t_18,&__pyx_t_19,&__pyx_t_20,&__pyx_t_21,&__pyx_t_22}; + __pyx_t_23 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_24 = Py_TYPE(__pyx_t_23)->tp_iternext; + for (index=0; index < 6; index++) { + PyObject* item = __pyx_t_24(__pyx_t_23); if (unlikely(!item)) goto __pyx_L15_unpacking_failed; __Pyx_GOTREF(item); *(temps[index]) = item; } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_21), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_22 = NULL; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + if (__Pyx_IternextUnpackEndCheck(__pyx_t_24(__pyx_t_23), 6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_24 = NULL; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; goto __pyx_L16_unpacking_done; __pyx_L15_unpacking_failed:; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __pyx_t_22 = NULL; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __pyx_t_24 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L16_unpacking_done:; } - __pyx_t_27 = __Pyx_PyInt_As_int(__pyx_t_16); if (unlikely((__pyx_t_27 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_17); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_v_dist = __pyx_t_27; - __pyx_v_dt = __pyx_t_14; - __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_18); - __pyx_t_18 = 0; - __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_19); - __pyx_t_19 = 0; - __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_20); + __pyx_t_29 = __Pyx_PyInt_As_int(__pyx_t_18); if (unlikely((__pyx_t_29 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_19); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF_SET(__pyx_v_prnt, __pyx_t_17); + __pyx_t_17 = 0; + __pyx_v_dist = __pyx_t_29; + __pyx_v_dt = __pyx_t_15; + __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_20); __pyx_t_20 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dist); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_21); + __pyx_t_21 = 0; + __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_22); + __pyx_t_22 = 0; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_dist); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF_SET(__pyx_v_dists, ((PyObject*)__pyx_t_5)); __pyx_t_5 = 0; - /* "ml2.pyx":60 - * for (dist, dt, w1, w2, w3) in parents] - * dists = [dist for (dist, dt, w1, w2, w3) in parents] - * dts = [dt for (dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< + /* "ml2.pyx":59 + * for (prnt, dist, dt, w1, w2, w3) in parents] + * dists = [dist for (prnt, dist, dt, w1, w2, w3) in parents] + * dts = [dt for (prnt, dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< + * prnts = [prnt for (prnt, 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)) */ - __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); if (unlikely(__pyx_v_parents == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_6 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_6); __pyx_t_15 = 0; + __pyx_t_4 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_4); __pyx_t_16 = 0; for (;;) { - if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_6)) break; + if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_15); __Pyx_INCREF(__pyx_t_3); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_16); __Pyx_INCREF(__pyx_t_6); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif - if (unlikely(size != 5)) { - if (size > 5) __Pyx_RaiseTooManyValuesError(5); + if (unlikely(size != 6)) { + if (size > 6) __Pyx_RaiseTooManyValuesError(6); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_20 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_19 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_18 = PyTuple_GET_ITEM(sequence, 2); - __pyx_t_17 = PyTuple_GET_ITEM(sequence, 3); - __pyx_t_16 = PyTuple_GET_ITEM(sequence, 4); + __pyx_t_22 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_21 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_20 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_19 = PyTuple_GET_ITEM(sequence, 3); + __pyx_t_18 = PyTuple_GET_ITEM(sequence, 4); + __pyx_t_17 = PyTuple_GET_ITEM(sequence, 5); } else { - __pyx_t_20 = PyList_GET_ITEM(sequence, 0); - __pyx_t_19 = PyList_GET_ITEM(sequence, 1); - __pyx_t_18 = PyList_GET_ITEM(sequence, 2); - __pyx_t_17 = PyList_GET_ITEM(sequence, 3); - __pyx_t_16 = PyList_GET_ITEM(sequence, 4); + __pyx_t_22 = PyList_GET_ITEM(sequence, 0); + __pyx_t_21 = PyList_GET_ITEM(sequence, 1); + __pyx_t_20 = PyList_GET_ITEM(sequence, 2); + __pyx_t_19 = PyList_GET_ITEM(sequence, 3); + __pyx_t_18 = PyList_GET_ITEM(sequence, 4); + __pyx_t_17 = PyList_GET_ITEM(sequence, 5); } + __Pyx_INCREF(__pyx_t_22); + __Pyx_INCREF(__pyx_t_21); __Pyx_INCREF(__pyx_t_20); __Pyx_INCREF(__pyx_t_19); __Pyx_INCREF(__pyx_t_18); __Pyx_INCREF(__pyx_t_17); - __Pyx_INCREF(__pyx_t_16); #else { Py_ssize_t i; - PyObject** temps[5] = {&__pyx_t_20,&__pyx_t_19,&__pyx_t_18,&__pyx_t_17,&__pyx_t_16}; - for (i=0; i < 5; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject** temps[6] = {&__pyx_t_22,&__pyx_t_21,&__pyx_t_20,&__pyx_t_19,&__pyx_t_18,&__pyx_t_17}; + for (i=0; i < 6; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(item); *(temps[i]) = item; } } #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { Py_ssize_t index = -1; - PyObject** temps[5] = {&__pyx_t_20,&__pyx_t_19,&__pyx_t_18,&__pyx_t_17,&__pyx_t_16}; - __pyx_t_21 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_21); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_22 = Py_TYPE(__pyx_t_21)->tp_iternext; - for (index=0; index < 5; index++) { - PyObject* item = __pyx_t_22(__pyx_t_21); if (unlikely(!item)) goto __pyx_L19_unpacking_failed; + PyObject** temps[6] = {&__pyx_t_22,&__pyx_t_21,&__pyx_t_20,&__pyx_t_19,&__pyx_t_18,&__pyx_t_17}; + __pyx_t_23 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_24 = Py_TYPE(__pyx_t_23)->tp_iternext; + for (index=0; index < 6; index++) { + PyObject* item = __pyx_t_24(__pyx_t_23); if (unlikely(!item)) goto __pyx_L19_unpacking_failed; __Pyx_GOTREF(item); *(temps[index]) = item; } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_21), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_22 = NULL; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + if (__Pyx_IternextUnpackEndCheck(__pyx_t_24(__pyx_t_23), 6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_24 = NULL; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; goto __pyx_L20_unpacking_done; __pyx_L19_unpacking_failed:; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __pyx_t_22 = NULL; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __pyx_t_24 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L20_unpacking_done:; } - __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_20); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_21); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_29 = __Pyx_PyInt_As_int(__pyx_t_20); if (unlikely((__pyx_t_29 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; - __pyx_t_27 = __Pyx_PyInt_As_int(__pyx_t_19); if (unlikely((__pyx_t_27 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; - __pyx_v_dist = __pyx_t_14; - __pyx_v_dt = __pyx_t_27; - __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_18); + __Pyx_XDECREF_SET(__pyx_v_prnt, __pyx_t_22); + __pyx_t_22 = 0; + __pyx_v_dist = __pyx_t_15; + __pyx_v_dt = __pyx_t_29; + __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_19); + __pyx_t_19 = 0; + __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_18); __pyx_t_18 = 0; - __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_17); + __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_17); __pyx_t_17 = 0; - __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_16); - __pyx_t_16 = 0; - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_dt); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF_SET(__pyx_v_dts, ((PyObject*)__pyx_t_5)); __pyx_t_5 = 0; + /* "ml2.pyx":60 + * dists = [dist for (prnt, dist, dt, w1, w2, w3) in parents] + * dts = [dt for (prnt, dist, dt, w1, w2, w3) in parents] + * prnts = [prnt for (prnt, 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)) + */ + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__pyx_v_parents == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_4); __pyx_t_16 = 0; + for (;;) { + if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_4)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_16); __Pyx_INCREF(__pyx_t_6); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 6)) { + if (size > 6) __Pyx_RaiseTooManyValuesError(6); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_17 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_18 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_19 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_20 = PyTuple_GET_ITEM(sequence, 3); + __pyx_t_21 = PyTuple_GET_ITEM(sequence, 4); + __pyx_t_22 = PyTuple_GET_ITEM(sequence, 5); + } else { + __pyx_t_17 = PyList_GET_ITEM(sequence, 0); + __pyx_t_18 = PyList_GET_ITEM(sequence, 1); + __pyx_t_19 = PyList_GET_ITEM(sequence, 2); + __pyx_t_20 = PyList_GET_ITEM(sequence, 3); + __pyx_t_21 = PyList_GET_ITEM(sequence, 4); + __pyx_t_22 = PyList_GET_ITEM(sequence, 5); + } + __Pyx_INCREF(__pyx_t_17); + __Pyx_INCREF(__pyx_t_18); + __Pyx_INCREF(__pyx_t_19); + __Pyx_INCREF(__pyx_t_20); + __Pyx_INCREF(__pyx_t_21); + __Pyx_INCREF(__pyx_t_22); + #else + { + Py_ssize_t i; + PyObject** temps[6] = {&__pyx_t_17,&__pyx_t_18,&__pyx_t_19,&__pyx_t_20,&__pyx_t_21,&__pyx_t_22}; + for (i=0; i < 6; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(item); + *(temps[i]) = item; + } + } + #endif + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + Py_ssize_t index = -1; + PyObject** temps[6] = {&__pyx_t_17,&__pyx_t_18,&__pyx_t_19,&__pyx_t_20,&__pyx_t_21,&__pyx_t_22}; + __pyx_t_23 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_24 = Py_TYPE(__pyx_t_23)->tp_iternext; + for (index=0; index < 6; index++) { + PyObject* item = __pyx_t_24(__pyx_t_23); if (unlikely(!item)) goto __pyx_L23_unpacking_failed; + __Pyx_GOTREF(item); + *(temps[index]) = item; + } + if (__Pyx_IternextUnpackEndCheck(__pyx_t_24(__pyx_t_23), 6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_24 = NULL; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + goto __pyx_L24_unpacking_done; + __pyx_L23_unpacking_failed:; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __pyx_t_24 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L24_unpacking_done:; + } + __pyx_t_29 = __Pyx_PyInt_As_int(__pyx_t_18); if (unlikely((__pyx_t_29 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + __pyx_t_15 = __Pyx_PyInt_As_int(__pyx_t_19); if (unlikely((__pyx_t_15 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF_SET(__pyx_v_prnt, __pyx_t_17); + __pyx_t_17 = 0; + __pyx_v_dist = __pyx_t_29; + __pyx_v_dt = __pyx_t_15; + __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_20); + __pyx_t_20 = 0; + __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_21); + __pyx_t_21 = 0; + __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_22); + __pyx_t_22 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_v_prnt))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_prnts, ((PyObject*)__pyx_t_5)); + __pyx_t_5 = 0; + /* "ml2.pyx":63 * # find parent that maximizes log(p) - log(\tilde{p}) * # probs[i] = max(s - failures[l] for l, s in enumerate(successes)) @@ -2471,10 +2704,10 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject * for l, s in enumerate(successes): * prob = s - failures[l] */ - __pyx_t_28 = __Pyx_PyObject_AsDouble(__pyx_kp_s_inf); if (unlikely(__pyx_t_28 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_27 = __pyx_v_i; - if (__pyx_t_27 < 0) __pyx_t_27 += __pyx_pybuffernd_probs.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_probs.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_probs.diminfo[0].strides) = __pyx_t_28; + __pyx_t_30 = __Pyx_PyObject_AsDouble(__pyx_kp_s_inf); if (unlikely(__pyx_t_30 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __pyx_v_i; + if (__pyx_t_15 < 0) __pyx_t_15 += __pyx_pybuffernd_probs.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_probs.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_probs.diminfo[0].strides) = __pyx_t_30; /* "ml2.pyx":64 * # probs[i] = max(s - failures[l] for l, s in enumerate(successes)) @@ -2483,19 +2716,19 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject * prob = s - failures[l] * if prob > probs[i]: */ - __pyx_t_14 = 0; - __pyx_t_5 = __pyx_v_successes; __Pyx_INCREF(__pyx_t_5); __pyx_t_15 = 0; + __pyx_t_29 = 0; + __pyx_t_5 = __pyx_v_successes; __Pyx_INCREF(__pyx_t_5); __pyx_t_16 = 0; for (;;) { - if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_5)) break; + if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_5)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_15); __Pyx_INCREF(__pyx_t_6); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_16); __Pyx_INCREF(__pyx_t_4); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_6); - __pyx_t_6 = 0; - __pyx_v_l = __pyx_t_14; - __pyx_t_14 = (__pyx_t_14 + 1); + __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_4); + __pyx_t_4 = 0; + __pyx_v_l = __pyx_t_29; + __pyx_t_29 = (__pyx_t_29 + 1); /* "ml2.pyx":65 * probs[i] = float("-inf") @@ -2504,75 +2737,90 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject * if prob > probs[i]: * probs[i] = prob */ - __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_failures, __pyx_v_l, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_failures, __pyx_v_l, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyNumber_Subtract(__pyx_v_s, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyNumber_Subtract(__pyx_v_s, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_XDECREF_SET(__pyx_v_prob, __pyx_t_3); - __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF_SET(__pyx_v_prob, __pyx_t_6); + __pyx_t_6 = 0; /* "ml2.pyx":66 * for l, s in enumerate(successes): * prob = s - failures[l] * if prob > probs[i]: # <<<<<<<<<<<<<< * probs[i] = prob - * parent_dists[i] = dists[l] + * infectors[i] = prnts[l] */ - __pyx_t_29 = __pyx_v_i; - if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_pybuffernd_probs.diminfo[0].shape; - __pyx_t_3 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_probs.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_probs.diminfo[0].strides))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyObject_RichCompare(__pyx_v_prob, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_30 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_30 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_31 = __pyx_v_i; + if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_pybuffernd_probs.diminfo[0].shape; + __pyx_t_6 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_probs.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_probs.diminfo[0].strides))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = PyObject_RichCompare(__pyx_v_prob, __pyx_t_6, Py_GT); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (__pyx_t_30) { + __pyx_t_32 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_32 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_32) { /* "ml2.pyx":67 * prob = s - failures[l] * if prob > probs[i]: * probs[i] = prob # <<<<<<<<<<<<<< + * infectors[i] = prnts[l] * parent_dists[i] = dists[l] - * parent_dts[i] = dts[l] */ - __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_v_prob); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_31 = __pyx_v_i; - if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_pybuffernd_probs.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_probs.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_probs.diminfo[0].strides) = __pyx_t_24; + __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_v_prob); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_33 = __pyx_v_i; + if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_pybuffernd_probs.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_probs.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_probs.diminfo[0].strides) = __pyx_t_26; /* "ml2.pyx":68 * if prob > probs[i]: * probs[i] = prob - * parent_dists[i] = dists[l] # <<<<<<<<<<<<<< + * infectors[i] = prnts[l] # <<<<<<<<<<<<<< + * parent_dists[i] = dists[l] * parent_dts[i] = dts[l] - * */ - __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_dists, __pyx_v_l, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_32 = __pyx_v_i; - if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_pybuffernd_parent_dists.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_parent_dists.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_parent_dists.diminfo[0].strides) = __pyx_t_24; + __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_prnts, __pyx_v_l, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_34 = __pyx_v_i; + if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_pybuffernd_infectors.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_infectors.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_infectors.diminfo[0].strides) = __pyx_t_26; /* "ml2.pyx":69 * probs[i] = prob + * infectors[i] = prnts[l] + * parent_dists[i] = dists[l] # <<<<<<<<<<<<<< + * parent_dts[i] = dts[l] + * + */ + __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_dists, __pyx_v_l, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_35 = __pyx_v_i; + if (__pyx_t_35 < 0) __pyx_t_35 += __pyx_pybuffernd_parent_dists.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_parent_dists.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_parent_dists.diminfo[0].strides) = __pyx_t_26; + + /* "ml2.pyx":70 + * infectors[i] = prnts[l] * parent_dists[i] = dists[l] * parent_dts[i] = dts[l] # <<<<<<<<<<<<<< * * # loop through non-victims */ - __pyx_t_6 = __Pyx_GetItemInt_List(__pyx_v_dts, __pyx_v_l, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_33 = __pyx_v_i; - if (__pyx_t_33 < 0) __pyx_t_33 += __pyx_pybuffernd_parent_dts.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_parent_dts.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_parent_dts.diminfo[0].strides) = __pyx_t_24; - goto __pyx_L23; + __pyx_t_4 = __Pyx_GetItemInt_List(__pyx_v_dts, __pyx_v_l, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_36 = __pyx_v_i; + if (__pyx_t_36 < 0) __pyx_t_36 += __pyx_pybuffernd_parent_dts.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_parent_dts.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_parent_dts.diminfo[0].strides) = __pyx_t_26; + goto __pyx_L27; } - __pyx_L23:; + __pyx_L27:; /* "ml2.pyx":64 * # probs[i] = max(s - failures[l] for l, s in enumerate(successes)) @@ -2584,440 +2832,591 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ml2.pyx":72 + /* "ml2.pyx":73 * * # loop through non-victims * for i, parents in enumerate(non_victims.itervalues()): # <<<<<<<<<<<<<< * # for each non victim node, compute the probability that all its * # parents fail to infect it */ - __pyx_t_12 = 0; + __pyx_t_13 = 0; __pyx_t_1 = 0; if (unlikely(__pyx_v_non_victims == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "itervalues"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_non_victims, 1, __pyx_n_s_itervalues, (&__pyx_t_2), (&__pyx_t_13)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_dict_iterator(__pyx_v_non_victims, 1, __pyx_n_s_itervalues, (&__pyx_t_2), (&__pyx_t_14)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_t_4); - __pyx_t_4 = __pyx_t_5; + __Pyx_XDECREF(__pyx_t_3); + __pyx_t_3 = __pyx_t_5; __pyx_t_5 = 0; while (1) { - __pyx_t_14 = __Pyx_dict_iter_next(__pyx_t_4, __pyx_t_2, &__pyx_t_1, NULL, &__pyx_t_5, NULL, __pyx_t_13); - if (unlikely(__pyx_t_14 == 0)) break; - if (unlikely(__pyx_t_14 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = __Pyx_dict_iter_next(__pyx_t_3, __pyx_t_2, &__pyx_t_1, NULL, &__pyx_t_5, NULL, __pyx_t_14); + if (unlikely(__pyx_t_29 == 0)) break; + if (unlikely(__pyx_t_29 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyList_CheckExact(__pyx_t_5))||((__pyx_t_5) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_5)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF_SET(__pyx_v_parents, ((PyObject*)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_v_i = __pyx_t_12; - __pyx_t_12 = (__pyx_t_12 + 1); + __pyx_v_i = __pyx_t_13; + __pyx_t_13 = (__pyx_t_13 + 1); - /* "ml2.pyx":75 + /* "ml2.pyx":76 * # for each non victim node, compute the probability that all its * # parents fail to infect it * failures = [weight_failure(dist, dt, alpha, delta, lmbda, w1, w2, w3) # <<<<<<<<<<<<<< - * for (dist, dt, w1, w2, w3) in parents] + * for (prnt, dist, dt, w1, w2, w3) in parents] * probs_nv[i] = sum(failures) */ - __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - /* "ml2.pyx":76 + /* "ml2.pyx":77 * # parents fail to infect it * failures = [weight_failure(dist, dt, alpha, delta, lmbda, w1, w2, w3) - * for (dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< + * for (prnt, dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< * probs_nv[i] = sum(failures) * */ if (unlikely(__pyx_v_parents == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_6 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_6); __pyx_t_15 = 0; + __pyx_t_4 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_4); __pyx_t_16 = 0; for (;;) { - if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_6)) break; + if (__pyx_t_16 >= PyList_GET_SIZE(__pyx_t_4)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_15); __Pyx_INCREF(__pyx_t_3); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_16); __Pyx_INCREF(__pyx_t_6); __pyx_t_16++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_6, __pyx_t_15); __pyx_t_15++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PySequence_ITEM(__pyx_t_4, __pyx_t_16); __pyx_t_16++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) { - PyObject* sequence = __pyx_t_3; + if ((likely(PyTuple_CheckExact(__pyx_t_6))) || (PyList_CheckExact(__pyx_t_6))) { + PyObject* sequence = __pyx_t_6; #if CYTHON_COMPILING_IN_CPYTHON Py_ssize_t size = Py_SIZE(sequence); #else Py_ssize_t size = PySequence_Size(sequence); #endif - if (unlikely(size != 5)) { - if (size > 5) __Pyx_RaiseTooManyValuesError(5); + if (unlikely(size != 6)) { + if (size > 6) __Pyx_RaiseTooManyValuesError(6); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { - __pyx_t_16 = PyTuple_GET_ITEM(sequence, 0); - __pyx_t_17 = PyTuple_GET_ITEM(sequence, 1); - __pyx_t_18 = PyTuple_GET_ITEM(sequence, 2); + __pyx_t_22 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_21 = PyTuple_GET_ITEM(sequence, 1); + __pyx_t_20 = PyTuple_GET_ITEM(sequence, 2); __pyx_t_19 = PyTuple_GET_ITEM(sequence, 3); - __pyx_t_20 = PyTuple_GET_ITEM(sequence, 4); + __pyx_t_18 = PyTuple_GET_ITEM(sequence, 4); + __pyx_t_17 = PyTuple_GET_ITEM(sequence, 5); } else { - __pyx_t_16 = PyList_GET_ITEM(sequence, 0); - __pyx_t_17 = PyList_GET_ITEM(sequence, 1); - __pyx_t_18 = PyList_GET_ITEM(sequence, 2); + __pyx_t_22 = PyList_GET_ITEM(sequence, 0); + __pyx_t_21 = PyList_GET_ITEM(sequence, 1); + __pyx_t_20 = PyList_GET_ITEM(sequence, 2); __pyx_t_19 = PyList_GET_ITEM(sequence, 3); - __pyx_t_20 = PyList_GET_ITEM(sequence, 4); + __pyx_t_18 = PyList_GET_ITEM(sequence, 4); + __pyx_t_17 = PyList_GET_ITEM(sequence, 5); } - __Pyx_INCREF(__pyx_t_16); - __Pyx_INCREF(__pyx_t_17); - __Pyx_INCREF(__pyx_t_18); - __Pyx_INCREF(__pyx_t_19); + __Pyx_INCREF(__pyx_t_22); + __Pyx_INCREF(__pyx_t_21); __Pyx_INCREF(__pyx_t_20); + __Pyx_INCREF(__pyx_t_19); + __Pyx_INCREF(__pyx_t_18); + __Pyx_INCREF(__pyx_t_17); #else { Py_ssize_t i; - PyObject** temps[5] = {&__pyx_t_16,&__pyx_t_17,&__pyx_t_18,&__pyx_t_19,&__pyx_t_20}; - for (i=0; i < 5; i++) { - PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyObject** temps[6] = {&__pyx_t_22,&__pyx_t_21,&__pyx_t_20,&__pyx_t_19,&__pyx_t_18,&__pyx_t_17}; + for (i=0; i < 6; i++) { + PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(item); *(temps[i]) = item; } } #endif - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { Py_ssize_t index = -1; - PyObject** temps[5] = {&__pyx_t_16,&__pyx_t_17,&__pyx_t_18,&__pyx_t_19,&__pyx_t_20}; - __pyx_t_21 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_21); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_22 = Py_TYPE(__pyx_t_21)->tp_iternext; - for (index=0; index < 5; index++) { - PyObject* item = __pyx_t_22(__pyx_t_21); if (unlikely(!item)) goto __pyx_L28_unpacking_failed; + PyObject** temps[6] = {&__pyx_t_22,&__pyx_t_21,&__pyx_t_20,&__pyx_t_19,&__pyx_t_18,&__pyx_t_17}; + __pyx_t_23 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_24 = Py_TYPE(__pyx_t_23)->tp_iternext; + for (index=0; index < 6; index++) { + PyObject* item = __pyx_t_24(__pyx_t_23); if (unlikely(!item)) goto __pyx_L32_unpacking_failed; __Pyx_GOTREF(item); *(temps[index]) = item; } - if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_21), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_22 = NULL; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - goto __pyx_L29_unpacking_done; - __pyx_L28_unpacking_failed:; - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __pyx_t_22 = NULL; + if (__Pyx_IternextUnpackEndCheck(__pyx_t_24(__pyx_t_23), 6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_24 = NULL; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + goto __pyx_L33_unpacking_done; + __pyx_L32_unpacking_failed:; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __pyx_t_24 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_L29_unpacking_done:; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L33_unpacking_done:; } - __pyx_t_14 = __Pyx_PyInt_As_int(__pyx_t_16); if (unlikely((__pyx_t_14 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0; - __pyx_t_34 = __Pyx_PyInt_As_int(__pyx_t_17); if (unlikely((__pyx_t_34 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; - __pyx_v_dist = __pyx_t_14; - __pyx_v_dt = __pyx_t_34; - __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_18); - __pyx_t_18 = 0; - __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_19); + __pyx_t_29 = __Pyx_PyInt_As_int(__pyx_t_21); if (unlikely((__pyx_t_29 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_37 = __Pyx_PyInt_As_int(__pyx_t_20); if (unlikely((__pyx_t_37 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_XDECREF_SET(__pyx_v_prnt, __pyx_t_22); + __pyx_t_22 = 0; + __pyx_v_dist = __pyx_t_29; + __pyx_v_dt = __pyx_t_37; + __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_19); __pyx_t_19 = 0; - __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_20); - __pyx_t_20 = 0; + __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_18); + __pyx_t_18 = 0; + __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_17); + __pyx_t_17 = 0; - /* "ml2.pyx":75 + /* "ml2.pyx":76 * # for each non victim node, compute the probability that all its * # parents fail to infect it * failures = [weight_failure(dist, dt, alpha, delta, lmbda, w1, w2, w3) # <<<<<<<<<<<<<< - * for (dist, dt, w1, w2, w3) in parents] + * for (prnt, dist, dt, w1, w2, w3) in parents] * probs_nv[i] = sum(failures) */ - __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_v_w1); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_v_w2); if (unlikely((__pyx_t_25 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_v_w3); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyFloat_FromDouble(__pyx_f_3ml2_weight_failure(__pyx_v_dist, __pyx_v_dt, __pyx_v_alpha, __pyx_v_delta, __pyx_v_lmbda, __pyx_t_24, __pyx_t_25, __pyx_t_26)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_v_w1); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_27 = __pyx_PyFloat_AsDouble(__pyx_v_w2); if (unlikely((__pyx_t_27 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_v_w3); if (unlikely((__pyx_t_28 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyFloat_FromDouble(__pyx_f_3ml2_weight_failure(__pyx_v_dist, __pyx_v_dt, __pyx_v_alpha, __pyx_v_delta, __pyx_v_lmbda, __pyx_t_26, __pyx_t_27, __pyx_t_28)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_6))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "ml2.pyx":76 + /* "ml2.pyx":77 * # parents fail to infect it * failures = [weight_failure(dist, dt, alpha, delta, lmbda, w1, w2, w3) - * for (dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< + * for (prnt, dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<< * probs_nv[i] = sum(failures) * */ } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_XDECREF_SET(__pyx_v_failures, ((PyObject*)__pyx_t_5)); __pyx_t_5 = 0; - /* "ml2.pyx":77 + /* "ml2.pyx":78 * failures = [weight_failure(dist, dt, alpha, delta, lmbda, w1, w2, w3) - * for (dist, dt, w1, w2, w3) in parents] + * for (prnt, dist, dt, w1, w2, w3) in parents] * probs_nv[i] = sum(failures) # <<<<<<<<<<<<<< * * # calculate log likelihood */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_failures); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_failures); __Pyx_GIVEREF(__pyx_v_failures); - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_sum, __pyx_t_5, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_sum, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_34 = __pyx_v_i; - if (__pyx_t_34 < 0) __pyx_t_34 += __pyx_pybuffernd_probs_nv.diminfo[0].shape; - *__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_probs_nv.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_probs_nv.diminfo[0].strides) = __pyx_t_26; + __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_28 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_37 = __pyx_v_i; + if (__pyx_t_37 < 0) __pyx_t_37 += __pyx_pybuffernd_probs_nv.diminfo[0].shape; + *__Pyx_BufPtrStrided1d(__pyx_t_3ml2_DTYPE_t *, __pyx_pybuffernd_probs_nv.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_probs_nv.diminfo[0].strides) = __pyx_t_28; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ml2.pyx":80 + /* "ml2.pyx":81 * * # calculate log likelihood * ll = probs_fail.sum() # add probability that all edges to victims fail # <<<<<<<<<<<<<< * ll += probs_nv.sum() # add probability that all edges to non_victims fail * ll += probs.sum() # add probability for realized edges and subtract probability these edges fail */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_probs_fail), __pyx_n_s_sum); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_probs_fail), __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_6); + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4); if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6); + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); __Pyx_INCREF(__pyx_t_5); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_6, function); + __Pyx_DECREF_SET(__pyx_t_4, function); } } if (__pyx_t_5) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } else { - __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ll = __pyx_t_26; + __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_28 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_ll = __pyx_t_28; - /* "ml2.pyx":81 + /* "ml2.pyx":82 * # calculate log likelihood * ll = probs_fail.sum() # add probability that all edges to victims fail * ll += probs_nv.sum() # add probability that all edges to non_victims fail # <<<<<<<<<<<<<< * ll += probs.sum() # add probability for realized edges and subtract probability these edges fail * */ - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_ll); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_probs_nv), __pyx_n_s_sum); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_ll); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_probs_nv), __pyx_n_s_sum); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = NULL; + __pyx_t_6 = NULL; if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_3)) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_5, function); } } - if (__pyx_t_3) { - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { - __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_28 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_v_ll = __pyx_t_26; + __pyx_v_ll = __pyx_t_28; - /* "ml2.pyx":82 + /* "ml2.pyx":83 * ll = probs_fail.sum() # add probability that all edges to victims fail * ll += probs_nv.sum() # add probability that all edges to non_victims fail * ll += probs.sum() # add probability for realized edges and subtract probability these edges fail # <<<<<<<<<<<<<< * * roots = n_roots */ - __pyx_t_5 = PyFloat_FromDouble(__pyx_v_ll); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_ll); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_probs), __pyx_n_s_sum); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_4); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); - __Pyx_INCREF(__pyx_t_3); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_probs), __pyx_n_s_sum); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_3); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); + __Pyx_INCREF(__pyx_t_6); __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_4, function); + __Pyx_DECREF_SET(__pyx_t_3, function); } } - if (__pyx_t_3) { - __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } else { - __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_26 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_26 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_v_ll = __pyx_t_26; + __pyx_t_28 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_28 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_ll = __pyx_t_28; - /* "ml2.pyx":84 + /* "ml2.pyx":85 * ll += probs.sum() # add probability for realized edges and subtract probability these edges fail * * roots = n_roots # <<<<<<<<<<<<<< * # print n_nodes, n_roots, n_victims, max_i, roots - * print parent_dists[1:100] + * # print parent_dists[1:100] */ __pyx_v_roots = __pyx_v_n_roots; - /* "ml2.pyx":86 - * roots = n_roots - * # print n_nodes, n_roots, n_victims, max_i, roots - * print parent_dists[1:100] # <<<<<<<<<<<<<< - * print parent_dts[1:100] - * print np.mean(parent_dists) + /* "ml2.pyx":94 + * # print np.mean(parent_dts) + * + * with open('../../Results/infectors.csv', 'w') as infectors_file: # <<<<<<<<<<<<<< + * for i, infector in enumerate(infectors): + * infectors_file.write("%s, %s\n" % ((victims.keys())[i], infector)) */ - __pyx_t_4 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_parent_dists), 1, 100, NULL, NULL, &__pyx_slice_, 1, 1, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_PrintOne(0, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + /*with:*/ { + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_open, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_38 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_exit); if (unlikely(!__pyx_t_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_38); + __pyx_t_5 = __Pyx_PyObject_LookupSpecial(__pyx_t_3, __pyx_n_s_enter); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L34_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_5, function); + } + } + if (__pyx_t_6) { + __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L34_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } else { + __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L34_error;} + } + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + /*try:*/ { + { + __Pyx_ExceptionSave(&__pyx_t_39, &__pyx_t_40, &__pyx_t_41); + __Pyx_XGOTREF(__pyx_t_39); + __Pyx_XGOTREF(__pyx_t_40); + __Pyx_XGOTREF(__pyx_t_41); + /*try:*/ { + __pyx_v_infectors_file = __pyx_t_5; + __pyx_t_5 = 0; - /* "ml2.pyx":87 - * # print n_nodes, n_roots, n_victims, max_i, roots - * print parent_dists[1:100] - * print parent_dts[1:100] # <<<<<<<<<<<<<< - * print np.mean(parent_dists) - * print np.mean(parent_dts) + /* "ml2.pyx":95 + * + * with open('../../Results/infectors.csv', 'w') as infectors_file: + * for i, infector in enumerate(infectors): # <<<<<<<<<<<<<< + * infectors_file.write("%s, %s\n" % ((victims.keys())[i], infector)) + * return (lmbda, roots, ll) */ - __pyx_t_4 = __Pyx_PyObject_GetSlice(((PyObject *)__pyx_v_parent_dts), 1, 100, NULL, NULL, &__pyx_slice__2, 1, 1, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_PrintOne(0, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_13 = 0; + if (likely(PyList_CheckExact(((PyObject *)__pyx_v_infectors))) || PyTuple_CheckExact(((PyObject *)__pyx_v_infectors))) { + __pyx_t_5 = ((PyObject *)__pyx_v_infectors); __Pyx_INCREF(__pyx_t_5); __pyx_t_2 = 0; + __pyx_t_42 = NULL; + } else { + __pyx_t_2 = -1; __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_infectors)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_42 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_42)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + } + for (;;) { + if (likely(!__pyx_t_42)) { + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + #endif + } else { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + #endif + } + } else { + __pyx_t_3 = __pyx_t_42(__pyx_t_5); + if (unlikely(!__pyx_t_3)) { + PyObject* exc_type = PyErr_Occurred(); + if (exc_type) { + if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF_SET(__pyx_v_infector, __pyx_t_3); + __pyx_t_3 = 0; + __pyx_v_i = __pyx_t_13; + __pyx_t_13 = (__pyx_t_13 + 1); - /* "ml2.pyx":88 - * print parent_dists[1:100] - * print parent_dts[1:100] - * print np.mean(parent_dists) # <<<<<<<<<<<<<< - * print np.mean(parent_dts) + /* "ml2.pyx":96 + * with open('../../Results/infectors.csv', 'w') as infectors_file: + * for i, infector in enumerate(infectors): + * infectors_file.write("%s, %s\n" % ((victims.keys())[i], infector)) # <<<<<<<<<<<<<< * return (lmbda, roots, ll) */ - __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_mean); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_5, function); - } - } - if (!__pyx_t_6) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, ((PyObject *)__pyx_v_parent_dists)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - } else { - __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_parent_dists)); - PyTuple_SET_ITEM(__pyx_t_3, 0+1, ((PyObject *)__pyx_v_parent_dists)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_parent_dists)); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - } - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (__Pyx_PrintOne(0, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_infectors_file, __pyx_n_s_write); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + __Pyx_GOTREF(__pyx_t_4); + if (unlikely(__pyx_v_victims == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "keys"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + } + __pyx_t_6 = __Pyx_PyDict_Keys(__pyx_v_victims); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_17 = __Pyx_GetItemInt(__pyx_t_6, __pyx_v_i, int, 1, __Pyx_PyInt_From_int, 0, 1, 0); if (unlikely(__pyx_t_17 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L38_error;}; + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_17); + __Pyx_INCREF(__pyx_v_infector); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_infector); + __Pyx_GIVEREF(__pyx_v_infector); + __pyx_t_17 = 0; + __pyx_t_17 = __Pyx_PyString_Format(__pyx_kp_s_s_s, __pyx_t_6); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + __Pyx_GOTREF(__pyx_t_17); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = NULL; + if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_4))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_4); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_4, function); + } + } + if (!__pyx_t_6) { + __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_t_17); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_GOTREF(__pyx_t_3); + } else { + __pyx_t_18 = PyTuple_New(1+1); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + __Pyx_GOTREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); __pyx_t_6 = NULL; + PyTuple_SET_ITEM(__pyx_t_18, 0+1, __pyx_t_17); + __Pyx_GIVEREF(__pyx_t_17); + __pyx_t_17 = 0; + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_18, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L38_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + } + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "ml2.pyx":89 - * print parent_dts[1:100] - * print np.mean(parent_dists) - * print np.mean(parent_dts) # <<<<<<<<<<<<<< + /* "ml2.pyx":95 + * + * with open('../../Results/infectors.csv', 'w') as infectors_file: + * for i, infector in enumerate(infectors): # <<<<<<<<<<<<<< + * infectors_file.write("%s, %s\n" % ((victims.keys())[i], infector)) * return (lmbda, roots, ll) */ - __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_mean); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = NULL; - if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) { - __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3); - if (likely(__pyx_t_5)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3); - __Pyx_INCREF(__pyx_t_5); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_3, function); + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_XDECREF(__pyx_t_39); __pyx_t_39 = 0; + __Pyx_XDECREF(__pyx_t_40); __pyx_t_40 = 0; + __Pyx_XDECREF(__pyx_t_41); __pyx_t_41 = 0; + goto __pyx_L45_try_end; + __pyx_L38_error:; + __Pyx_XDECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_XDECREF(__pyx_t_22); __pyx_t_22 = 0; + __Pyx_XDECREF(__pyx_t_21); __pyx_t_21 = 0; + __Pyx_XDECREF(__pyx_t_20); __pyx_t_20 = 0; + __Pyx_XDECREF(__pyx_t_19); __pyx_t_19 = 0; + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_XDECREF(__pyx_t_17); __pyx_t_17 = 0; + __Pyx_XDECREF(__pyx_t_18); __pyx_t_18 = 0; + __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "ml2.pyx":94 + * # print np.mean(parent_dts) + * + * with open('../../Results/infectors.csv', 'w') as infectors_file: # <<<<<<<<<<<<<< + * for i, infector in enumerate(infectors): + * infectors_file.write("%s, %s\n" % ((victims.keys())[i], infector)) + */ + /*except:*/ { + __Pyx_AddTraceback("ml2.ml2", __pyx_clineno, __pyx_lineno, __pyx_filename); + if (__Pyx_GetException(&__pyx_t_5, &__pyx_t_3, &__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L40_except_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_18 = PyTuple_Pack(3, __pyx_t_5, __pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L40_except_error;} + __Pyx_GOTREF(__pyx_t_18); + __pyx_t_43 = __Pyx_PyObject_Call(__pyx_t_38, __pyx_t_18, NULL); + __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0; + __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0; + if (unlikely(!__pyx_t_43)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L40_except_error;} + __Pyx_GOTREF(__pyx_t_43); + __pyx_t_32 = __Pyx_PyObject_IsTrue(__pyx_t_43); + __Pyx_DECREF(__pyx_t_43); __pyx_t_43 = 0; + if (__pyx_t_32 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L40_except_error;} + __pyx_t_44 = ((!(__pyx_t_32 != 0)) != 0); + if (__pyx_t_44) { + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_XGIVEREF(__pyx_t_4); + __Pyx_ErrRestore(__pyx_t_5, __pyx_t_3, __pyx_t_4); + __pyx_t_5 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L40_except_error;} + } + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + goto __pyx_L39_exception_handled; + } + __pyx_L40_except_error:; + __Pyx_XGIVEREF(__pyx_t_39); + __Pyx_XGIVEREF(__pyx_t_40); + __Pyx_XGIVEREF(__pyx_t_41); + __Pyx_ExceptionReset(__pyx_t_39, __pyx_t_40, __pyx_t_41); + goto __pyx_L1_error; + __pyx_L39_exception_handled:; + __Pyx_XGIVEREF(__pyx_t_39); + __Pyx_XGIVEREF(__pyx_t_40); + __Pyx_XGIVEREF(__pyx_t_41); + __Pyx_ExceptionReset(__pyx_t_39, __pyx_t_40, __pyx_t_41); + __pyx_L45_try_end:; + } } + /*finally:*/ { + /*normal exit:*/{ + if (__pyx_t_38) { + __pyx_t_41 = __Pyx_PyObject_Call(__pyx_t_38, __pyx_tuple__2, NULL); + __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0; + if (unlikely(!__pyx_t_41)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_41); + __Pyx_DECREF(__pyx_t_41); __pyx_t_41 = 0; + } + goto __pyx_L37; + } + __pyx_L37:; + } + goto __pyx_L51; + __pyx_L34_error:; + __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0; + goto __pyx_L1_error; + __pyx_L51:; } - if (!__pyx_t_5) { - __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_3, ((PyObject *)__pyx_v_parent_dts)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - } else { - __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = NULL; - __Pyx_INCREF(((PyObject *)__pyx_v_parent_dts)); - PyTuple_SET_ITEM(__pyx_t_6, 0+1, ((PyObject *)__pyx_v_parent_dts)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_parent_dts)); - __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_PrintOne(0, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "ml2.pyx":90 - * print np.mean(parent_dists) - * print np.mean(parent_dts) + /* "ml2.pyx":97 + * for i, infector in enumerate(infectors): + * infectors_file.write("%s, %s\n" % ((victims.keys())[i], infector)) * return (lmbda, roots, ll) # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_lmbda); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_lmbda); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_roots); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_roots); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyFloat_FromDouble(__pyx_v_ll); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyFloat_FromDouble(__pyx_v_ll); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __pyx_t_18 = PyTuple_New(3); if (unlikely(!__pyx_t_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_18, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_18, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_18, 2, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); __pyx_t_4 = 0; __pyx_t_3 = 0; - __pyx_t_6 = 0; - __pyx_r = __pyx_t_5; __pyx_t_5 = 0; + __pyx_r = __pyx_t_18; + __pyx_t_18 = 0; goto __pyx_L0; - /* "ml2.pyx":35 + /* "ml2.pyx":33 * return result * * def ml2(dict root_victims, dict victims, dict non_victims, # <<<<<<<<<<<<<< @@ -3031,14 +3430,16 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_XDECREF(__pyx_t_16); __Pyx_XDECREF(__pyx_t_17); __Pyx_XDECREF(__pyx_t_18); __Pyx_XDECREF(__pyx_t_19); __Pyx_XDECREF(__pyx_t_20); __Pyx_XDECREF(__pyx_t_21); + __Pyx_XDECREF(__pyx_t_22); + __Pyx_XDECREF(__pyx_t_23); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_infectors.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_parent_dists.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_parent_dts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_probs.rcbuffer->pybuffer); @@ -3049,6 +3450,7 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_infectors.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_parent_dists.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_parent_dts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_probs.rcbuffer->pybuffer); @@ -3063,10 +3465,15 @@ static PyObject *__pyx_pf_3ml2_ml2(CYTHON_UNUSED PyObject *__pyx_self, PyObject __Pyx_XDECREF((PyObject *)__pyx_v_probs_nv); __Pyx_XDECREF((PyObject *)__pyx_v_parent_dists); __Pyx_XDECREF((PyObject *)__pyx_v_parent_dts); + __Pyx_XDECREF((PyObject *)__pyx_v_infectors); __Pyx_XDECREF(__pyx_v_dists); __Pyx_XDECREF(__pyx_v_dts); + __Pyx_XDECREF(__pyx_v_prnts); __Pyx_XDECREF(__pyx_v_s); __Pyx_XDECREF(__pyx_v_prob); + __Pyx_XDECREF(__pyx_v_infectors_file); + __Pyx_XDECREF(__pyx_v_infector); + __Pyx_XDECREF(__pyx_v_prnt); __Pyx_XDECREF(__pyx_v_w1); __Pyx_XDECREF(__pyx_v_w2); __Pyx_XDECREF(__pyx_v_w3); @@ -5104,6 +5511,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_Format_string_allocated_too_shor, __pyx_k_Format_string_allocated_too_shor, sizeof(__pyx_k_Format_string_allocated_too_shor), 0, 1, 0, 0}, {&__pyx_kp_u_Format_string_allocated_too_shor_2, __pyx_k_Format_string_allocated_too_shor_2, sizeof(__pyx_k_Format_string_allocated_too_shor_2), 0, 1, 0, 0}, {&__pyx_kp_u_Non_native_byte_order_not_suppor, __pyx_k_Non_native_byte_order_not_suppor, sizeof(__pyx_k_Non_native_byte_order_not_suppor), 0, 1, 0, 0}, + {&__pyx_kp_s_Results_infectors_csv, __pyx_k_Results_infectors_csv, sizeof(__pyx_k_Results_infectors_csv), 0, 0, 1, 0}, {&__pyx_n_s_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 0, 0, 1, 1}, {&__pyx_kp_s_Users_ben_Documents_Cascade_Pro, __pyx_k_Users_ben_Documents_Cascade_Pro, sizeof(__pyx_k_Users_ben_Documents_Cascade_Pro), 0, 0, 1, 0}, {&__pyx_n_s_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 0, 0, 1, 1}, @@ -5114,20 +5522,23 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_dt, __pyx_k_dt, sizeof(__pyx_k_dt), 0, 0, 1, 1}, {&__pyx_n_s_dts, __pyx_k_dts, sizeof(__pyx_k_dts), 0, 0, 1, 1}, {&__pyx_n_s_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 0, 0, 1, 1}, - {&__pyx_n_s_end, __pyx_k_end, sizeof(__pyx_k_end), 0, 0, 1, 1}, + {&__pyx_n_s_enter, __pyx_k_enter, sizeof(__pyx_k_enter), 0, 0, 1, 1}, {&__pyx_n_s_enumerate, __pyx_k_enumerate, sizeof(__pyx_k_enumerate), 0, 0, 1, 1}, + {&__pyx_n_s_exit, __pyx_k_exit, sizeof(__pyx_k_exit), 0, 0, 1, 1}, {&__pyx_n_s_failures, __pyx_k_failures, sizeof(__pyx_k_failures), 0, 0, 1, 1}, - {&__pyx_n_s_file, __pyx_k_file, sizeof(__pyx_k_file), 0, 0, 1, 1}, {&__pyx_n_s_float64, __pyx_k_float64, sizeof(__pyx_k_float64), 0, 0, 1, 1}, {&__pyx_n_s_i, __pyx_k_i, sizeof(__pyx_k_i), 0, 0, 1, 1}, {&__pyx_n_s_import, __pyx_k_import, sizeof(__pyx_k_import), 0, 0, 1, 1}, {&__pyx_kp_s_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 0, 0, 1, 0}, + {&__pyx_n_s_infector, __pyx_k_infector, sizeof(__pyx_k_infector), 0, 0, 1, 1}, + {&__pyx_n_s_infectors, __pyx_k_infectors, sizeof(__pyx_k_infectors), 0, 0, 1, 1}, + {&__pyx_n_s_infectors_file, __pyx_k_infectors_file, sizeof(__pyx_k_infectors_file), 0, 0, 1, 1}, {&__pyx_n_s_itervalues, __pyx_k_itervalues, sizeof(__pyx_k_itervalues), 0, 0, 1, 1}, + {&__pyx_n_s_keys, __pyx_k_keys, sizeof(__pyx_k_keys), 0, 0, 1, 1}, {&__pyx_n_s_l, __pyx_k_l, sizeof(__pyx_k_l), 0, 0, 1, 1}, {&__pyx_n_s_ll, __pyx_k_ll, sizeof(__pyx_k_ll), 0, 0, 1, 1}, {&__pyx_n_s_lmbda, __pyx_k_lmbda, sizeof(__pyx_k_lmbda), 0, 0, 1, 1}, {&__pyx_n_s_main, __pyx_k_main, sizeof(__pyx_k_main), 0, 0, 1, 1}, - {&__pyx_n_s_mean, __pyx_k_mean, sizeof(__pyx_k_mean), 0, 0, 1, 1}, {&__pyx_n_s_ml2, __pyx_k_ml2, sizeof(__pyx_k_ml2), 0, 0, 1, 1}, {&__pyx_n_s_n_roots, __pyx_k_n_roots, sizeof(__pyx_k_n_roots), 0, 0, 1, 1}, {&__pyx_n_s_n_victims, __pyx_k_n_victims, sizeof(__pyx_k_n_victims), 0, 0, 1, 1}, @@ -5136,10 +5547,12 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_non_victims, __pyx_k_non_victims, sizeof(__pyx_k_non_victims), 0, 0, 1, 1}, {&__pyx_n_s_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 0, 1, 1}, {&__pyx_n_s_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 0, 0, 1, 1}, + {&__pyx_n_s_open, __pyx_k_open, sizeof(__pyx_k_open), 0, 0, 1, 1}, {&__pyx_n_s_parent_dists, __pyx_k_parent_dists, sizeof(__pyx_k_parent_dists), 0, 0, 1, 1}, {&__pyx_n_s_parent_dts, __pyx_k_parent_dts, sizeof(__pyx_k_parent_dts), 0, 0, 1, 1}, {&__pyx_n_s_parents, __pyx_k_parents, sizeof(__pyx_k_parents), 0, 0, 1, 1}, - {&__pyx_n_s_print, __pyx_k_print, sizeof(__pyx_k_print), 0, 0, 1, 1}, + {&__pyx_n_s_prnt, __pyx_k_prnt, sizeof(__pyx_k_prnt), 0, 0, 1, 1}, + {&__pyx_n_s_prnts, __pyx_k_prnts, sizeof(__pyx_k_prnts), 0, 0, 1, 1}, {&__pyx_n_s_prob, __pyx_k_prob, sizeof(__pyx_k_prob), 0, 0, 1, 1}, {&__pyx_n_s_probs, __pyx_k_probs, sizeof(__pyx_k_probs), 0, 0, 1, 1}, {&__pyx_n_s_probs_fail, __pyx_k_probs_fail, sizeof(__pyx_k_probs_fail), 0, 0, 1, 1}, @@ -5148,21 +5561,25 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s_root_victims, __pyx_k_root_victims, sizeof(__pyx_k_root_victims), 0, 0, 1, 1}, {&__pyx_n_s_roots, __pyx_k_roots, sizeof(__pyx_k_roots), 0, 0, 1, 1}, {&__pyx_n_s_s, __pyx_k_s, sizeof(__pyx_k_s), 0, 0, 1, 1}, + {&__pyx_kp_s_s_s, __pyx_k_s_s, sizeof(__pyx_k_s_s), 0, 0, 1, 0}, {&__pyx_n_s_successes, __pyx_k_successes, sizeof(__pyx_k_successes), 0, 0, 1, 1}, {&__pyx_n_s_sum, __pyx_k_sum, sizeof(__pyx_k_sum), 0, 0, 1, 1}, {&__pyx_n_s_t, __pyx_k_t, sizeof(__pyx_k_t), 0, 0, 1, 1}, {&__pyx_n_s_test, __pyx_k_test, sizeof(__pyx_k_test), 0, 0, 1, 1}, {&__pyx_kp_u_unknown_dtype_code_in_numpy_pxd, __pyx_k_unknown_dtype_code_in_numpy_pxd, sizeof(__pyx_k_unknown_dtype_code_in_numpy_pxd), 0, 1, 0, 0}, {&__pyx_n_s_victims, __pyx_k_victims, sizeof(__pyx_k_victims), 0, 0, 1, 1}, + {&__pyx_n_s_w, __pyx_k_w, sizeof(__pyx_k_w), 0, 0, 1, 1}, {&__pyx_n_s_w1, __pyx_k_w1, sizeof(__pyx_k_w1), 0, 0, 1, 1}, {&__pyx_n_s_w2, __pyx_k_w2, sizeof(__pyx_k_w2), 0, 0, 1, 1}, {&__pyx_n_s_w3, __pyx_k_w3, sizeof(__pyx_k_w3), 0, 0, 1, 1}, + {&__pyx_n_s_write, __pyx_k_write, sizeof(__pyx_k_write), 0, 0, 1, 1}, {&__pyx_n_s_zeros, __pyx_k_zeros, sizeof(__pyx_k_zeros), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_sum = __Pyx_GetBuiltinName(__pyx_n_s_sum); if (!__pyx_builtin_sum) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_sum = __Pyx_GetBuiltinName(__pyx_n_s_sum); if (!__pyx_builtin_sum) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_open = __Pyx_GetBuiltinName(__pyx_n_s_open); if (!__pyx_builtin_open) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -5175,27 +5592,19 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "ml2.pyx":86 - * roots = n_roots - * # print n_nodes, n_roots, n_victims, max_i, roots - * print parent_dists[1:100] # <<<<<<<<<<<<<< - * print parent_dts[1:100] - * print np.mean(parent_dists) - */ - __pyx_slice_ = PySlice_New(__pyx_int_1, __pyx_int_100, Py_None); if (unlikely(!__pyx_slice_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_slice_); - __Pyx_GIVEREF(__pyx_slice_); - - /* "ml2.pyx":87 - * # print n_nodes, n_roots, n_victims, max_i, roots - * print parent_dists[1:100] - * print parent_dts[1:100] # <<<<<<<<<<<<<< - * print np.mean(parent_dists) - * print np.mean(parent_dts) + /* "ml2.pyx":94 + * # print np.mean(parent_dts) + * + * with open('../../Results/infectors.csv', 'w') as infectors_file: # <<<<<<<<<<<<<< + * for i, infector in enumerate(infectors): + * infectors_file.write("%s, %s\n" % ((victims.keys())[i], infector)) */ - __pyx_slice__2 = PySlice_New(__pyx_int_1, __pyx_int_100, Py_None); if (unlikely(!__pyx_slice__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_slice__2); - __Pyx_GIVEREF(__pyx_slice__2); + __pyx_tuple_ = PyTuple_Pack(2, __pyx_kp_s_Results_infectors_csv, __pyx_n_s_w); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple_); + __Pyx_GIVEREF(__pyx_tuple_); + __pyx_tuple__2 = PyTuple_Pack(3, Py_None, Py_None, Py_None); if (unlikely(!__pyx_tuple__2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_tuple__2); + __Pyx_GIVEREF(__pyx_tuple__2); /* "../../../../Library/Enthought/Canopy_64bit/User/lib/python2.7/site-packages/Cython/Includes/numpy/__init__.pxd":218 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) @@ -5263,17 +5672,17 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__8); __Pyx_GIVEREF(__pyx_tuple__8); - /* "ml2.pyx":35 + /* "ml2.pyx":33 * return result * * def ml2(dict root_victims, dict victims, dict non_victims, # <<<<<<<<<<<<<< * DTYPE_t alpha, DTYPE_t delta, DTYPE_t lmbda): * cdef: */ - __pyx_tuple__9 = PyTuple_Pack(30, __pyx_n_s_root_victims, __pyx_n_s_victims, __pyx_n_s_non_victims, __pyx_n_s_alpha, __pyx_n_s_delta, __pyx_n_s_lmbda, __pyx_n_s_n_roots, __pyx_n_s_n_victims, __pyx_n_s_roots, __pyx_n_s_i, __pyx_n_s_dist, __pyx_n_s_dt, __pyx_n_s_t, __pyx_n_s_l, __pyx_n_s_ll, __pyx_n_s_parents, __pyx_n_s_failures, __pyx_n_s_successes, __pyx_n_s_probs, __pyx_n_s_probs_fail, __pyx_n_s_probs_nv, __pyx_n_s_parent_dists, __pyx_n_s_parent_dts, __pyx_n_s_dists, __pyx_n_s_dts, __pyx_n_s_s, __pyx_n_s_prob, __pyx_n_s_w1, __pyx_n_s_w2, __pyx_n_s_w3); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_tuple__9 = PyTuple_Pack(35, __pyx_n_s_root_victims, __pyx_n_s_victims, __pyx_n_s_non_victims, __pyx_n_s_alpha, __pyx_n_s_delta, __pyx_n_s_lmbda, __pyx_n_s_n_roots, __pyx_n_s_n_victims, __pyx_n_s_roots, __pyx_n_s_i, __pyx_n_s_dist, __pyx_n_s_dt, __pyx_n_s_t, __pyx_n_s_l, __pyx_n_s_ll, __pyx_n_s_parents, __pyx_n_s_failures, __pyx_n_s_successes, __pyx_n_s_probs, __pyx_n_s_probs_fail, __pyx_n_s_probs_nv, __pyx_n_s_parent_dists, __pyx_n_s_parent_dts, __pyx_n_s_infectors, __pyx_n_s_dists, __pyx_n_s_dts, __pyx_n_s_prnts, __pyx_n_s_s, __pyx_n_s_prob, __pyx_n_s_infectors_file, __pyx_n_s_infector, __pyx_n_s_prnt, __pyx_n_s_w1, __pyx_n_s_w2, __pyx_n_s_w3); if (unlikely(!__pyx_tuple__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_tuple__9); __Pyx_GIVEREF(__pyx_tuple__9); - __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(6, 0, 30, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ben_Documents_Cascade_Pro, __pyx_n_s_ml2, 35, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_codeobj__10 = (PyObject*)__Pyx_PyCode_New(6, 0, 35, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__9, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ben_Documents_Cascade_Pro, __pyx_n_s_ml2, 33, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -5283,8 +5692,6 @@ static int __Pyx_InitCachedConstants(void) { static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -5414,16 +5821,16 @@ PyMODINIT_FUNC PyInit_ml2(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s_DTYPE, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 6; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "ml2.pyx":35 + /* "ml2.pyx":33 * return result * * def ml2(dict root_victims, dict victims, dict non_victims, # <<<<<<<<<<<<<< * DTYPE_t alpha, DTYPE_t delta, DTYPE_t lmbda): * cdef: */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3ml2_1ml2, NULL, __pyx_n_s_ml2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_3ml2_1ml2, NULL, __pyx_n_s_ml2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_ml2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s_ml2, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "ml2.pyx":1 @@ -6671,101 +7078,130 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( - PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, - PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, - int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { +static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg) { + PyObject *method, *result = NULL; + method = __Pyx_PyObject_GetAttrStr(obj, method_name); + if (unlikely(!method)) goto bad; #if CYTHON_COMPILING_IN_CPYTHON - PyMappingMethods* mp; -#if PY_MAJOR_VERSION < 3 - PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; - if (likely(ms && ms->sq_slice)) { - if (!has_cstart) { - if (_py_start && (*_py_start != Py_None)) { - cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); - if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstart = 0; - } - if (!has_cstop) { - if (_py_stop && (*_py_stop != Py_None)) { - cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); - if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; - } else - cstop = PY_SSIZE_T_MAX; - } - if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { - Py_ssize_t l = ms->sq_length(obj); - if (likely(l >= 0)) { - if (cstop < 0) { - cstop += l; - if (cstop < 0) cstop = 0; - } - if (cstart < 0) { - cstart += l; - if (cstart < 0) cstart = 0; - } - } else { - if (PyErr_ExceptionMatches(PyExc_OverflowError)) - PyErr_Clear(); - else - goto bad; - } + if (likely(PyMethod_Check(method))) { + PyObject *self = PyMethod_GET_SELF(method); + if (likely(self)) { + PyObject *args; + PyObject *function = PyMethod_GET_FUNCTION(method); + args = PyTuple_New(2); + if (unlikely(!args)) goto bad; + Py_INCREF(self); + PyTuple_SET_ITEM(args, 0, self); + Py_INCREF(arg); + PyTuple_SET_ITEM(args, 1, arg); + Py_INCREF(function); + Py_DECREF(method); method = NULL; + result = __Pyx_PyObject_Call(function, args, NULL); + Py_DECREF(args); + Py_DECREF(function); + return result; } - return ms->sq_slice(obj, cstart, cstop); } #endif - mp = Py_TYPE(obj)->tp_as_mapping; - if (likely(mp && mp->mp_subscript)) + result = __Pyx_PyObject_CallOneArg(method, arg); +bad: + Py_XDECREF(method); + return result; +} + +static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d) { + if (PY_MAJOR_VERSION >= 3) + return __Pyx_PyObject_CallMethod1((PyObject*)&PyDict_Type, __pyx_n_s_keys, d); + else + return PyDict_Keys(d); +} + +static CYTHON_INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->exc_type; + *value = tstate->exc_value; + *tb = tstate->exc_traceback; + Py_XINCREF(*type); + Py_XINCREF(*value); + Py_XINCREF(*tb); +#else + PyErr_GetExcInfo(type, value, tb); #endif - { - PyObject* result; - PyObject *py_slice, *py_start, *py_stop; - if (_py_slice) { - py_slice = *_py_slice; - } else { - PyObject* owned_start = NULL; - PyObject* owned_stop = NULL; - if (_py_start) { - py_start = *_py_start; - } else { - if (has_cstart) { - owned_start = py_start = PyInt_FromSsize_t(cstart); - if (unlikely(!py_start)) goto bad; - } else - py_start = Py_None; - } - if (_py_stop) { - py_stop = *_py_stop; - } else { - if (has_cstop) { - owned_stop = py_stop = PyInt_FromSsize_t(cstop); - if (unlikely(!py_stop)) { - Py_XDECREF(owned_start); - goto bad; - } - } else - py_stop = Py_None; - } - py_slice = PySlice_New(py_start, py_stop, Py_None); - Py_XDECREF(owned_start); - Py_XDECREF(owned_stop); - if (unlikely(!py_slice)) goto bad; - } +} +static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { #if CYTHON_COMPILING_IN_CPYTHON - result = mp->mp_subscript(obj, py_slice); + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = type; + tstate->exc_value = value; + tstate->exc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); #else - result = PyObject_GetItem(obj, py_slice); + PyErr_SetExcInfo(type, value, tb); #endif - if (!_py_slice) { - Py_DECREF(py_slice); - } - return result; +} + +static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *local_type, *local_value, *local_tb; +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + local_type = tstate->curexc_type; + local_value = tstate->curexc_value; + local_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(&local_type, &local_value, &local_tb); +#endif + PyErr_NormalizeException(&local_type, &local_value, &local_tb); +#if CYTHON_COMPILING_IN_CPYTHON + if (unlikely(tstate->curexc_type)) +#else + if (unlikely(PyErr_Occurred())) +#endif + goto bad; + #if PY_MAJOR_VERSION >= 3 + if (local_tb) { + if (unlikely(PyException_SetTraceback(local_value, local_tb) < 0)) + goto bad; } - PyErr_Format(PyExc_TypeError, - "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); + #endif + Py_XINCREF(local_tb); + Py_XINCREF(local_type); + Py_XINCREF(local_value); + *type = local_type; + *value = local_value; + *tb = local_tb; +#if CYTHON_COMPILING_IN_CPYTHON + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = local_type; + tstate->exc_value = local_value; + tstate->exc_traceback = local_tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_SetExcInfo(local_type, local_value, local_tb); +#endif + return 0; bad: - return NULL; + *type = 0; + *value = 0; + *tb = 0; + Py_XDECREF(local_type); + Py_XDECREF(local_value); + Py_XDECREF(local_tb); + return -1; } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { @@ -7351,147 +7787,6 @@ raise_neg_overflow: return (int) -1; } -#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static PyObject *__Pyx_GetStdout(void) { - PyObject *f = PySys_GetObject((char *)"stdout"); - if (!f) { - PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout"); - } - return f; -} -static int __Pyx_Print(PyObject* f, PyObject *arg_tuple, int newline) { - int i; - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - for (i=0; i < PyTuple_GET_SIZE(arg_tuple); i++) { - PyObject* v; - if (PyFile_SoftSpace(f, 1)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; - } - v = PyTuple_GET_ITEM(arg_tuple, i); - if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0) - goto error; - if (PyString_Check(v)) { - char *s = PyString_AsString(v); - Py_ssize_t len = PyString_Size(v); - if (len > 0) { - switch (s[len-1]) { - case ' ': break; - case '\f': case '\r': case '\n': case '\t': case '\v': - PyFile_SoftSpace(f, 0); - break; - default: break; - } - } - } - } - if (newline) { - if (PyFile_WriteString("\n", f) < 0) - goto error; - PyFile_SoftSpace(f, 0); - } - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; -} -#else -static int __Pyx_Print(PyObject* stream, PyObject *arg_tuple, int newline) { - PyObject* kwargs = 0; - PyObject* result = 0; - PyObject* end_string; - if (unlikely(!__pyx_print)) { - __pyx_print = PyObject_GetAttr(__pyx_b, __pyx_n_s_print); - if (!__pyx_print) - return -1; - } - if (stream) { - kwargs = PyDict_New(); - if (unlikely(!kwargs)) - return -1; - if (unlikely(PyDict_SetItem(kwargs, __pyx_n_s_file, stream) < 0)) - goto bad; - if (!newline) { - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - goto bad; - if (PyDict_SetItem(kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - goto bad; - } - Py_DECREF(end_string); - } - } else if (!newline) { - if (unlikely(!__pyx_print_kwargs)) { - __pyx_print_kwargs = PyDict_New(); - if (unlikely(!__pyx_print_kwargs)) - return -1; - end_string = PyUnicode_FromStringAndSize(" ", 1); - if (unlikely(!end_string)) - return -1; - if (PyDict_SetItem(__pyx_print_kwargs, __pyx_n_s_end, end_string) < 0) { - Py_DECREF(end_string); - return -1; - } - Py_DECREF(end_string); - } - kwargs = __pyx_print_kwargs; - } - result = PyObject_Call(__pyx_print, arg_tuple, kwargs); - if (unlikely(kwargs) && (kwargs != __pyx_print_kwargs)) - Py_DECREF(kwargs); - if (!result) - return -1; - Py_DECREF(result); - return 0; -bad: - if (kwargs != __pyx_print_kwargs) - Py_XDECREF(kwargs); - return -1; -} -#endif - -#if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION < 3 -static int __Pyx_PrintOne(PyObject* f, PyObject *o) { - if (!f) { - if (!(f = __Pyx_GetStdout())) - return -1; - } - Py_INCREF(f); - if (PyFile_SoftSpace(f, 0)) { - if (PyFile_WriteString(" ", f) < 0) - goto error; - } - if (PyFile_WriteObject(o, f, Py_PRINT_RAW) < 0) - goto error; - if (PyFile_WriteString("\n", f) < 0) - goto error; - Py_DECREF(f); - return 0; -error: - Py_DECREF(f); - return -1; - /* the line below is just to avoid C compiler - * warnings about unused functions */ - return __Pyx_Print(f, NULL, 0); -} -#else -static int __Pyx_PrintOne(PyObject* stream, PyObject *o) { - int res; - PyObject* arg_tuple = PyTuple_Pack(1, o); - if (unlikely(!arg_tuple)) - return -1; - res = __Pyx_Print(stream, arg_tuple, 1); - Py_DECREF(arg_tuple); - return res; -} -#endif - #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { diff --git a/experiments/ml2.pyx b/experiments/ml2.pyx index 99c9784..dd0e7a8 100644 --- a/experiments/ml2.pyx +++ b/experiments/ml2.pyx @@ -10,8 +10,8 @@ cdef DTYPE_t weight_success(int dist, int dt, DTYPE_t alpha, DTYPE_t delta, DTYP 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/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda)) + structural = delta ** dist + # structural = delta/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda)) temporal = log(exp(alpha)-1.) - alpha*dt # temporal = 1. / (1. + (dt - 1.)/alpha)**0.01 - 1. / (1. + dt/alpha)**0.01 result = log(structural) + temporal @@ -22,8 +22,8 @@ cdef DTYPE_t weight_failure(int dist, int dt, DTYPE_t alpha, DTYPE_t delta, DTYP 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/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda)) + structural = delta ** dist + # structural = delta/(1. + 1./(w1*lmbda) + 1./(w2*lmbda) + 1./(w3*lmbda)) temporal = exp(-alpha * dt) # temporal = 1. - 1. / (1. + dt/alpha)**0.01 result = log(1. - structural + structural * temporal) @@ -43,6 +43,7 @@ def ml2(dict root_victims, dict victims, dict non_victims, np.ndarray[DTYPE_t] probs_nv = np.zeros(len(non_victims), dtype=DTYPE) np.ndarray[DTYPE_t] parent_dists = np.zeros(n_victims, dtype=DTYPE) np.ndarray[DTYPE_t] parent_dts = np.zeros(n_victims, dtype=DTYPE) + np.ndarray[DTYPE_t] infectors = np.zeros(n_victims, dtype=DTYPE) # loop through victims for i, parents in enumerate(victims.itervalues()): @@ -50,12 +51,13 @@ def ml2(dict root_victims, dict victims, dict non_victims, # fail to infect it, also computes the probability that its most # likely parent infects it failures = [weight_failure(dist, dt, alpha, delta, lmbda, w1, w2, w3) - for (dist, dt, w1, w2, w3) in parents] + for (prnt, dist, dt, w1, w2, w3) in parents] probs_fail[i] = sum(failures) successes = [weight_success(dist, dt, alpha, delta, lmbda, w1, w2, w3) - for (dist, dt, w1, w2, w3) in parents] - dists = [dist for (dist, dt, w1, w2, w3) in parents] - dts = [dt for (dist, dt, w1, w2, w3) in parents] + for (prnt, dist, dt, w1, w2, w3) in parents] + dists = [dist for (prnt, dist, dt, w1, w2, w3) in parents] + dts = [dt for (prnt, dist, dt, w1, w2, w3) in parents] + prnts = [prnt for (prnt, 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[i] = float("-inf") @@ -63,6 +65,7 @@ def ml2(dict root_victims, dict victims, dict non_victims, prob = s - failures[l] if prob > probs[i]: probs[i] = prob + infectors[i] = prnts[l] parent_dists[i] = dists[l] parent_dts[i] = dts[l] @@ -71,7 +74,7 @@ def ml2(dict root_victims, dict victims, dict non_victims, # for each non victim node, compute the probability that all its # parents fail to infect it failures = [weight_failure(dist, dt, alpha, delta, lmbda, w1, w2, w3) - for (dist, dt, w1, w2, w3) in parents] + for (prnt, dist, dt, w1, w2, w3) in parents] probs_nv[i] = sum(failures) # calculate log likelihood @@ -81,8 +84,14 @@ def ml2(dict root_victims, dict victims, dict non_victims, roots = n_roots # print n_nodes, n_roots, n_victims, max_i, roots - print parent_dists[1:100] - print parent_dts[1:100] - print np.mean(parent_dists) - print np.mean(parent_dts) + # print parent_dists[1:100] + # print parent_dts[1:100] + # print victims.keys() + # print infectors + # print np.mean(parent_dists) + # print np.mean(parent_dts) + + with open('../../Results/infectors.csv', 'w') as infectors_file: + for i, infector in enumerate(infectors): + infectors_file.write("%s, %s\n" % ((victims.keys())[i], infector)) return (lmbda, roots, ll) diff --git a/experiments/ml2.so b/experiments/ml2.so Binary files differindex b8c850b..162e007 100755 --- a/experiments/ml2.so +++ b/experiments/ml2.so diff --git a/experiments/out.log b/experiments/out.log index dbc6e69..b6cddf7 100644 --- a/experiments/out.log +++ b/experiments/out.log @@ -1,180 +1,735 @@ -0.001 0.0001 1e-05 6478 -334195.43339 -0.001 0.000145977430289 1e-05 6478 -329534.623319 -0.001 0.000213094101537 1e-05 6478 -324873.813745 -0.001 0.00031106929352 1e-05 6478 -320213.005232 -0.001 0.000454090961097 1e-05 6478 -315552.198982 -0.001 0.000662870316183 1e-05 6478 -310891.397565 -0.001 0.000967641053709 1e-05 6478 -306230.606477 -0.001 0.00141253754462 1e-05 6478 -301569.837498 -0.001 0.0020619860095 1e-05 4272 -583246.118462 -0.001 0.00301003418958 1e-05 3062 -1265123.26313 -0.001 0.00439397056076 1e-05 2843 -1588685.48614 -0.001 0.00641420531224 1e-05 2792 -1655439.60974 -0.001 0.00936329208824 1e-05 2792 -1600021.6221 -0.001 0.0136682931808 1e-05 2792 -1533516.68277 -0.001 0.0199526231497 1e-05 1178 -6992776.22453 -0.00163789370695 0.0001 1e-05 6503 -331657.971483 -0.00163789370695 0.000145977430289 1e-05 6487 -328611.450608 -0.00163789370695 0.000213094101537 1e-05 6478 -324561.337257 -0.00163789370695 0.00031106929352 1e-05 6478 -319959.244302 -0.00163789370695 0.000454090961097 1e-05 6478 -315298.439239 -0.00163789370695 0.000662870316183 1e-05 6478 -310637.640354 -0.00163789370695 0.000967641053709 1e-05 6478 -305976.854677 -0.00163789370695 0.00141253754462 1e-05 6478 -301316.097265 -0.00163789370695 0.0020619860095 1e-05 3613 -815669.251375 -0.00163789370695 0.00301003418958 1e-05 3103 -1191738.90138 -0.00163789370695 0.00439397056076 1e-05 2911 -1423048.07525 -0.00163789370695 0.00641420531224 1e-05 2832 -1549219.12447 -0.00163789370695 0.00936329208824 1e-05 2799 -1572581.12089 -0.00163789370695 0.0136682931808 1e-05 1767 -2649628.9287 -0.00163789370695 0.0199526231497 1e-05 1186 -6743799.30751 -0.00268269579528 0.0001 1e-05 6665 -316416.139113 -0.00268269579528 0.000145977430289 1e-05 6616 -316822.42361 -0.00268269579528 0.000213094101537 1e-05 6566 -316593.72542 -0.00268269579528 0.00031106929352 1e-05 6539 -315110.6579 -0.00268269579528 0.000454090961097 1e-05 6520 -313502.590841 -0.00268269579528 0.000662870316183 1e-05 6508 -311366.277334 -0.00268269579528 0.000967641053709 1e-05 6495 -308021.225367 -0.00268269579528 0.00141253754462 1e-05 4598 -511697.666228 -0.00268269579528 0.0020619860095 1e-05 3599 -820110.606026 -0.00268269579528 0.00301003418958 1e-05 3246 -1052017.77829 -0.00268269579528 0.00439397056076 1e-05 3049 -1221941.13096 -0.00268269579528 0.00641420531224 1e-05 2929 -1343238.6355 -0.00268269579528 0.00936329208824 1e-05 2871 -1422120.05939 -0.00268269579528 0.0136682931808 1e-05 1531 -3430091.89383 -0.00268269579528 0.0199526231497 1e-05 1223 -5921147.27347 -0.00439397056076 0.0001 1e-05 7011 -291759.652509 -0.00439397056076 0.000145977430289 1e-05 6924 -294332.169158 -0.00439397056076 0.000213094101537 1e-05 6860 -295443.905734 -0.00439397056076 0.00031106929352 1e-05 6816 -295336.433453 -0.00439397056076 0.000454090961097 1e-05 6751 -296297.905972 -0.00439397056076 0.000662870316183 1e-05 6701 -297239.96917 -0.00439397056076 0.000967641053709 1e-05 5772 -355244.508142 -0.00439397056076 0.00141253754462 1e-05 4493 -546346.358256 -0.00439397056076 0.0020619860095 1e-05 3804 -733086.489187 -0.00439397056076 0.00301003418958 1e-05 3483 -884823.745035 -0.00439397056076 0.00439397056076 1e-05 3273 -1012201.97793 -0.00439397056076 0.00641420531224 1e-05 3124 -1112450.18835 -0.00439397056076 0.00936329208824 1e-05 2693 -1347187.51209 -0.00439397056076 0.0136682931808 1e-05 1568 -3234700.11538 -0.00439397056076 0.0199526231497 1e-05 1300 -4861844.98147 -0.00719685673001 0.0001 1e-05 7476 -266137.846988 -0.00719685673001 0.000145977430289 1e-05 7387 -268100.519338 -0.00719685673001 0.000213094101537 1e-05 7312 -270559.260516 -0.00719685673001 0.00031106929352 1e-05 7249 -271497.340427 -0.00719685673001 0.000454090961097 1e-05 7172 -272375.659662 -0.00719685673001 0.000662870316183 1e-05 7124 -273090.386027 -0.00719685673001 0.000967641053709 1e-05 5498 -386101.265521 -0.00719685673001 0.00141253754462 1e-05 4734 -497876.543257 -0.00719685673001 0.0020619860095 1e-05 4188 -605246.845689 -0.00719685673001 0.00301003418958 1e-05 3821 -714208.587765 -0.00719685673001 0.00439397056076 1e-05 3620 -801473.581164 -0.00719685673001 0.00641420531224 1e-05 3470 -870432.004296 -0.00719685673001 0.00936329208824 1e-05 2277 -1582548.33584 -0.00719685673001 0.0136682931808 1e-05 1730 -2695291.50147 -0.00719685673001 0.0199526231497 1e-05 1455 -3730643.7477 -0.0117876863479 0.0001 1e-05 8064 -246019.102742 -0.0117876863479 0.000145977430289 1e-05 7979 -247202.401148 -0.0117876863479 0.000213094101537 1e-05 7881 -247976.479576 -0.0117876863479 0.00031106929352 1e-05 7807 -248816.866397 -0.0117876863479 0.000454090961097 1e-05 7727 -250110.711937 -0.0117876863479 0.000662870316183 1e-05 6717 -291829.426643 -0.0117876863479 0.000967641053709 1e-05 5760 -361761.249225 -0.0117876863479 0.00141253754462 1e-05 5169 -426603.686685 -0.0117876863479 0.0020619860095 1e-05 4773 -488650.259979 -0.0117876863479 0.00301003418958 1e-05 4387 -545791.715374 -0.0117876863479 0.00439397056076 1e-05 4104 -609277.071762 -0.0117876863479 0.00641420531224 1e-05 3887 -666238.108524 -0.0117876863479 0.00936329208824 1e-05 2380 -1431533.60463 -0.0117876863479 0.0136682931808 1e-05 1955 -2096261.93677 -0.0117876863479 0.0199526231497 1e-05 1706 -2683543.79221 -0.0193069772888 0.0001 1e-05 8720 -232220.935432 -0.0193069772888 0.000145977430289 1e-05 8621 -232780.028528 -0.0193069772888 0.000213094101537 1e-05 8536 -233478.58408 -0.0193069772888 0.00031106929352 1e-05 8453 -233909.71715 -0.0193069772888 0.000454090961097 1e-05 8049 -243173.875679 -0.0193069772888 0.000662870316183 1e-05 6977 -283848.55227 -0.0193069772888 0.000967641053709 1e-05 6290 -323915.241661 -0.0193069772888 0.00141253754462 1e-05 5812 -361364.242587 -0.0193069772888 0.0020619860095 1e-05 5421 -395697.988827 -0.0193069772888 0.00301003418958 1e-05 5121 -428552.499162 -0.0193069772888 0.00439397056076 1e-05 4844 -461000.33239 -0.0193069772888 0.00641420531224 1e-05 3774 -667957.613292 -0.0193069772888 0.00936329208824 1e-05 2697 -1147277.29501 -0.0193069772888 0.0136682931808 1e-05 2265 -1569379.5319 -0.0193069772888 0.0199526231497 1e-05 2014 -1933459.24301 -0.0316227766017 0.0001 1e-05 9330 -224220.807161 -0.0316227766017 0.000145977430289 1e-05 9270 -224272.554648 -0.0316227766017 0.000213094101537 1e-05 9205 -224198.785565 -0.0316227766017 0.00031106929352 1e-05 9151 -224084.277528 -0.0316227766017 0.000454090961097 1e-05 8255 -241755.665896 -0.0316227766017 0.000662870316183 1e-05 7553 -263396.9535 -0.0316227766017 0.000967641053709 1e-05 7008 -284871.471307 -0.0316227766017 0.00141253754462 1e-05 6574 -306630.917502 -0.0316227766017 0.0020619860095 1e-05 6238 -327457.391246 -0.0316227766017 0.00301003418958 1e-05 5940 -346618.838854 -0.0316227766017 0.00439397056076 1e-05 5661 -364120.68943 -0.0316227766017 0.00641420531224 1e-05 4068 -604430.895627 -0.0316227766017 0.00936329208824 1e-05 3197 -886257.451415 -0.0316227766017 0.0136682931808 1e-05 2724 -1140825.92636 -0.0316227766017 0.0199526231497 1e-05 2445 -1363542.53265 -0.0517947467923 0.0001 1e-05 9823 -220481.203625 -0.0517947467923 0.000145977430289 1e-05 9762 -220391.217942 -0.0517947467923 0.000213094101537 1e-05 9698 -220364.201728 -0.0517947467923 0.00031106929352 1e-05 9238 -224969.105111 -0.0517947467923 0.000454090961097 1e-05 8580 -235885.11742 -0.0517947467923 0.000662870316183 1e-05 8110 -246755.049984 -0.0517947467923 0.000967641053709 1e-05 7720 -258639.40814 -0.0517947467923 0.00141253754462 1e-05 7362 -268623.478248 -0.0517947467923 0.0020619860095 1e-05 7035 -280202.867047 -0.0517947467923 0.00301003418958 1e-05 6755 -291693.597386 -0.0517947467923 0.00439397056076 1e-05 6051 -337648.348684 -0.0517947467923 0.00641420531224 1e-05 4620 -506173.656543 -0.0517947467923 0.00936329208824 1e-05 3849 -669050.880332 -0.0517947467923 0.0136682931808 1e-05 3335 -822657.249848 -0.0517947467923 0.0199526231497 1e-05 2992 -960246.033215 -0.0848342898244 0.0001 1e-05 10192 -218975.38046 -0.0848342898244 0.000145977430289 1e-05 10152 -218826.941054 -0.0848342898244 0.000213094101537 1e-05 9985 -219603.320577 -0.0848342898244 0.00031106929352 1e-05 9433 -224589.795124 -0.0848342898244 0.000454090961097 1e-05 9044 -230146.083939 -0.0848342898244 0.000662870316183 1e-05 8672 -235363.425524 -0.0848342898244 0.000967641053709 1e-05 8380 -240097.187894 -0.0848342898244 0.00141253754462 1e-05 8116 -245778.160742 -0.0848342898244 0.0020619860095 1e-05 7877 -250737.911988 -0.0848342898244 0.00301003418958 1e-05 7626 -255761.834673 -0.0848342898244 0.00439397056076 1e-05 6388 -320962.53413 -0.0848342898244 0.00641420531224 1e-05 5263 -421938.833431 -0.0848342898244 0.00936329208824 1e-05 4601 -513180.221863 -0.0848342898244 0.0136682931808 1e-05 4115 -599465.443999 -0.0848342898244 0.0199526231497 1e-05 3701 -686941.830573 -0.138949549437 0.0001 1e-05 10515 -218576.085235 -0.138949549437 0.000145977430289 1e-05 10489 -218378.279833 -0.138949549437 0.000213094101537 1e-05 10146 -220185.725333 -0.138949549437 0.00031106929352 1e-05 9810 -222465.772917 -0.138949549437 0.000454090961097 1e-05 9474 -225575.460448 -0.138949549437 0.000662870316183 1e-05 9258 -227659.72262 -0.138949549437 0.000967641053709 1e-05 9046 -229405.451017 -0.138949549437 0.00141253754462 1e-05 8790 -232270.237744 -0.138949549437 0.0020619860095 1e-05 8599 -234251.480018 -0.138949549437 0.00301003418958 1e-05 8169 -242589.313202 -0.138949549437 0.00439397056076 1e-05 6939 -292368.219307 -0.138949549437 0.00641420531224 1e-05 6080 -344287.676624 -0.138949549437 0.00936329208824 1e-05 5459 -394410.965932 -0.138949549437 0.0136682931808 1e-05 4940 -452240.538216 -0.138949549437 0.0199526231497 1e-05 4586 -496132.143115 -0.227584592607 0.0001 1e-05 10763 -218554.364887 -0.227584592607 0.000145977430289 1e-05 10594 -218877.252269 -0.227584592607 0.000213094101537 1e-05 10371 -219675.715629 -0.227584592607 0.00031106929352 1e-05 10162 -220353.951501 -0.227584592607 0.000454090961097 1e-05 9909 -221988.412424 -0.227584592607 0.000662870316183 1e-05 9738 -222965.704469 -0.227584592607 0.000967641053709 1e-05 9582 -223636.176204 -0.227584592607 0.00141253754462 1e-05 9400 -224942.892883 -0.227584592607 0.0020619860095 1e-05 9255 -225153.469266 -0.227584592607 0.00301003418958 1e-05 8452 -240859.589455 -0.227584592607 0.00439397056076 1e-05 7536 -268187.413443 -0.227584592607 0.00641420531224 1e-05 6872 -296855.999889 -0.227584592607 0.00936329208824 1e-05 6333 -324493.055952 -0.227584592607 0.0136682931808 1e-05 5854 -352259.065819 -0.227584592607 0.0199526231497 1e-05 5486 -377070.269048 +0.03 0.09 0.1 8 -2524.16991366 +0.03 0.091 0.1 8 -2523.37447955 +0.03 0.092 0.1 8 -2522.66916324 +0.03 0.093 0.1 8 -2522.05302411 +0.03 0.094 0.1 8 -2521.52515842 +0.03 0.095 0.1 8 -2521.08469776 +0.03 0.096 0.1 8 -2520.73080755 +0.03 0.097 0.1 8 -2520.46268567 +0.03 0.098 0.1 8 -2520.27956114 +0.03 0.099 0.1 8 -2520.18069285 +0.03 0.1 0.1 8 -2520.16489903 +0.03 0.101 0.1 8 -2520.21363286 +0.03 0.102 0.1 8 -2520.34476449 +0.03 0.103 0.1 8 -2520.55765713 +0.03 0.104 0.1 8 -2520.85169858 +0.03 0.105 0.1 8 -2521.2263003 +0.03 0.106 0.1 8 -2521.68089651 +0.03 0.107 0.1 8 -2522.21494335 +0.03 0.108 0.1 8 -2522.82791806 +0.03 0.109 0.1 8 -2523.51931823 +0.03 0.11 0.1 8 -2524.28866105 +0.031 0.09 0.1 8 -2522.1436876 +0.031 0.091 0.1 8 -2521.35313396 +0.031 0.092 0.1 8 -2520.65274236 +0.031 0.093 0.1 8 -2520.02170745 +0.031 0.094 0.1 8 -2519.47855828 +0.031 0.095 0.1 8 -2519.02308655 +0.031 0.096 0.1 8 -2518.65445318 +0.031 0.097 0.1 8 -2518.37185167 +0.031 0.098 0.1 8 -2518.1745068 +0.031 0.099 0.1 8 -2518.06167338 +0.031 0.1 0.1 8 -2518.03263499 +0.031 0.101 0.1 8 -2518.08670293 +0.031 0.102 0.1 8 -2518.22321507 +0.031 0.103 0.1 8 -2518.44153485 +0.031 0.104 0.1 8 -2518.74105029 +0.031 0.105 0.1 8 -2519.12117307 +0.031 0.106 0.1 8 -2519.58133762 +0.031 0.107 0.1 8 -2520.12100029 +0.031 0.108 0.1 8 -2520.73963857 +0.031 0.109 0.1 8 -2521.43675024 +0.031 0.11 0.1 8 -2522.21185273 +0.032 0.09 0.1 8 -2520.29066878 +0.032 0.091 0.1 8 -2519.48374789 +0.032 0.092 0.1 8 -2518.76727387 +0.032 0.093 0.1 8 -2518.14030131 +0.032 0.094 0.1 8 -2517.60192185 +0.032 0.095 0.1 8 -2517.15126258 +0.032 0.096 0.1 8 -2516.78748463 +0.032 0.097 0.1 8 -2516.50978171 +0.032 0.098 0.1 8 -2516.3173788 +0.032 0.099 0.1 8 -2516.20953091 +0.032 0.1 0.1 8 -2516.18552186 +0.032 0.101 0.1 8 -2516.24466312 +0.032 0.102 0.1 8 -2516.38629278 +0.032 0.103 0.1 8 -2516.60977448 +0.032 0.104 0.1 8 -2516.91449646 +0.032 0.105 0.1 8 -2517.2998706 +0.032 0.106 0.1 8 -2517.76533154 +0.032 0.107 0.1 8 -2518.31033586 +0.032 0.108 0.1 8 -2518.93436121 +0.032 0.109 0.1 8 -2519.63690563 +0.032 0.11 0.1 8 -2520.41748673 +0.033 0.09 0.1 8 -2518.6656139 +0.033 0.091 0.1 8 -2517.8631188 +0.033 0.092 0.1 8 -2517.15111081 +0.033 0.093 0.1 8 -2516.52864471 +0.033 0.094 0.1 8 -2515.99481231 +0.033 0.095 0.1 8 -2515.54874094 +0.033 0.096 0.1 8 -2515.1895919 +0.033 0.097 0.1 8 -2514.91655909 +0.033 0.098 0.1 8 -2514.72886771 +0.033 0.099 0.1 8 -2514.62577295 +0.033 0.1 0.1 8 -2514.60655882 +0.033 0.101 0.1 8 -2514.670537 +0.033 0.102 0.1 8 -2514.81704578 +0.033 0.103 0.1 8 -2515.04544899 +0.033 0.104 0.1 8 -2515.35513507 +0.033 0.105 0.1 8 -2515.7455161 +0.033 0.106 0.1 8 -2516.21602692 +0.033 0.107 0.1 8 -2516.76612429 +0.033 0.108 0.1 8 -2517.39528608 +0.033 0.109 0.1 8 -2518.09594913 +0.033 0.11 0.1 8 -2518.86459803 +0.034 0.09 0.1 8 -2517.29524031 +0.034 0.091 0.1 8 -2516.49697398 +0.034 0.092 0.1 8 -2515.78923326 +0.034 0.093 0.1 8 -2515.1710731 +0.034 0.094 0.1 8 -2514.64158553 +0.034 0.095 0.1 8 -2514.19989803 +0.034 0.096 0.1 8 -2513.8451721 +0.034 0.097 0.1 8 -2513.57660184 +0.034 0.098 0.1 8 -2513.39341262 +0.034 0.099 0.1 8 -2513.29485983 +0.034 0.1 0.1 8 -2513.28022765 +0.034 0.101 0.1 8 -2513.34754019 +0.034 0.102 0.1 8 -2513.48010785 +0.034 0.103 0.1 8 -2513.69480394 +0.034 0.104 0.1 8 -2513.99101336 +0.034 0.105 0.1 8 -2514.36814478 +0.034 0.106 0.1 8 -2514.82562974 +0.034 0.107 0.1 8 -2515.36292177 +0.034 0.108 0.1 8 -2515.97949564 +0.034 0.109 0.1 8 -2516.67484652 +0.034 0.11 0.1 8 -2517.44848931 +0.035 0.09 0.1 8 -2516.1651594 +0.035 0.091 0.1 8 -2515.37094245 +0.035 0.092 0.1 8 -2514.66728801 +0.035 0.093 0.1 8 -2514.05325122 +0.035 0.094 0.1 8 -2513.52473289 +0.035 0.095 0.1 8 -2513.0671733 +0.035 0.096 0.1 8 -2512.6968357 +0.035 0.097 0.1 8 -2512.41290979 +0.035 0.098 0.1 8 -2512.21461666 +0.035 0.099 0.1 8 -2512.10120756 +0.035 0.1 0.1 8 -2512.07196269 +0.035 0.101 0.1 8 -2512.12619003 +0.035 0.102 0.1 8 -2512.2632243 +0.035 0.103 0.1 8 -2512.48242589 +0.035 0.104 0.1 8 -2512.78317988 +0.035 0.105 0.1 8 -2513.16489511 +0.035 0.106 0.1 8 -2513.6270033 +0.035 0.107 0.1 8 -2514.16895818 +0.035 0.108 0.1 8 -2514.79023467 +0.035 0.109 0.1 8 -2515.49032815 +0.035 0.11 0.1 8 -2516.26875369 +0.036 0.09 0.1 8 -2515.20368243 +0.036 0.091 0.1 8 -2514.39234197 +0.036 0.092 0.1 8 -2513.67184218 +0.036 0.093 0.1 8 -2513.04123316 +0.036 0.094 0.1 8 -2512.49960224 +0.036 0.095 0.1 8 -2512.04607234 +0.036 0.096 0.1 8 -2511.67980059 +0.036 0.097 0.1 8 -2511.39997684 +0.036 0.098 0.1 8 -2511.20582236 +0.036 0.099 0.1 8 -2511.09658858 +0.036 0.1 0.1 8 -2511.07155586 +0.036 0.101 0.1 8 -2511.13003236 +0.036 0.102 0.1 8 -2511.27135296 +0.036 0.103 0.1 8 -2511.49487824 +0.036 0.104 0.1 8 -2511.79999344 +0.036 0.105 0.1 8 -2512.18610758 +0.036 0.106 0.1 8 -2512.65265255 +0.036 0.107 0.1 8 -2513.19908225 +0.036 0.108 0.1 8 -2513.82487179 +0.036 0.109 0.1 8 -2514.5295167 +0.036 0.11 0.1 8 -2515.31253224 +0.037 0.09 0.1 8 -2514.37772701 +0.037 0.091 0.1 8 -2513.57012341 +0.037 0.092 0.1 8 -2512.85339461 +0.037 0.093 0.1 8 -2512.22659089 +0.037 0.094 0.1 8 -2511.68879971 +0.037 0.095 0.1 8 -2511.2391442 +0.037 0.096 0.1 8 -2510.87678162 +0.037 0.097 0.1 8 -2510.600902 +0.037 0.098 0.1 8 -2510.41072677 +0.037 0.099 0.1 8 -2510.30550753 +0.037 0.1 0.1 8 -2510.28452479 +0.037 0.101 0.1 8 -2510.34708689 +0.037 0.102 0.1 8 -2510.49252888 +0.037 0.103 0.1 8 -2510.72021148 +0.037 0.104 0.1 8 -2511.02952013 +0.037 0.105 0.1 8 -2511.41986399 +0.037 0.106 0.1 8 -2511.89067512 +0.037 0.107 0.1 8 -2512.4414076 +0.037 0.108 0.1 8 -2513.07153669 +0.037 0.109 0.1 8 -2513.77649295 +0.037 0.11 0.1 8 -2514.54676597 +0.038 0.09 0.1 8 -2513.75551416 +0.038 0.091 0.1 8 -2512.9515099 +0.038 0.092 0.1 8 -2512.23841337 +0.038 0.093 0.1 8 -2511.61527499 +0.038 0.094 0.1 8 -2511.08118239 +0.038 0.095 0.1 8 -2510.63525883 +0.038 0.096 0.1 8 -2510.27666175 +0.038 0.097 0.1 8 -2510.00458134 +0.038 0.098 0.1 8 -2509.81823917 +0.038 0.099 0.1 8 -2509.71688701 +0.038 0.1 0.1 8 -2509.69980554 +0.038 0.101 0.1 8 -2509.76630324 +0.038 0.102 0.1 8 -2509.91380565 +0.038 0.103 0.1 8 -2510.12708255 +0.038 0.104 0.1 8 -2510.42221002 +0.038 0.105 0.1 8 -2510.7985938 +0.038 0.106 0.1 8 -2511.25566261 +0.038 0.107 0.1 8 -2511.79286726 +0.038 0.108 0.1 8 -2512.40967988 +0.038 0.109 0.1 8 -2513.10559312 +0.038 0.11 0.1 8 -2513.88011942 +0.039 0.09 0.1 8 -2513.32670083 +0.039 0.091 0.1 8 -2512.52616955 +0.039 0.092 0.1 8 -2511.81657779 +0.039 0.093 0.1 8 -2511.19697611 +0.039 0.094 0.1 8 -2510.6664523 +0.039 0.095 0.1 8 -2510.22412979 +0.039 0.096 0.1 8 -2509.85902971 +0.039 0.097 0.1 8 -2509.57098573 +0.039 0.098 0.1 8 -2509.36892646 +0.039 0.099 0.1 8 -2509.25209949 +0.039 0.1 0.1 8 -2509.21978147 +0.039 0.101 0.1 8 -2509.271277 +0.039 0.102 0.1 8 -2509.40591748 +0.039 0.103 0.1 8 -2509.62306014 +0.039 0.104 0.1 8 -2509.92208699 +0.039 0.105 0.1 8 -2510.30240394 +0.039 0.106 0.1 8 -2510.76343984 +0.039 0.107 0.1 8 -2511.30464566 +0.039 0.108 0.1 8 -2511.9254937 +0.039 0.109 0.1 8 -2512.62547675 +0.039 0.11 0.1 8 -2513.40410741 +0.04 0.09 0.1 8 -2513.07118967 +0.04 0.091 0.1 8 -2512.25300533 +0.04 0.092 0.1 8 -2511.52603397 +0.04 0.093 0.1 8 -2510.88932107 +0.04 0.094 0.1 8 -2510.34194951 +0.04 0.095 0.1 8 -2509.88303797 +0.04 0.096 0.1 8 -2509.51173945 +0.04 0.097 0.1 8 -2509.22723982 +0.04 0.098 0.1 8 -2509.02875655 +0.04 0.099 0.1 8 -2508.91553735 +0.04 0.1 0.1 8 -2508.88685903 +0.04 0.101 0.1 8 -2508.94202633 +0.04 0.102 0.1 8 -2509.08037081 +0.04 0.103 0.1 8 -2509.30124984 +0.04 0.104 0.1 8 -2509.60404559 +0.04 0.105 0.1 8 -2509.98816409 +0.04 0.106 0.1 8 -2510.45303437 +0.04 0.107 0.1 8 -2510.99810753 +0.04 0.108 0.1 8 -2511.62285602 +0.04 0.109 0.1 8 -2512.32677279 +0.04 0.11 0.1 8 -2513.10937058 +0.041 0.09 0.1 8 -2512.87821495 +0.041 0.091 0.1 8 -2512.06328062 +0.041 0.092 0.1 8 -2511.33958904 +0.041 0.093 0.1 8 -2510.70618587 +0.041 0.094 0.1 8 -2510.16215411 +0.041 0.095 0.1 8 -2509.7066126 +0.041 0.096 0.1 8 -2509.33871445 +0.041 0.097 0.1 8 -2509.0576457 +0.041 0.098 0.1 8 -2508.86262395 +0.041 0.099 0.1 8 -2508.75289706 +0.041 0.1 0.1 8 -2508.72774197 +0.041 0.101 0.1 8 -2508.78646358 +0.041 0.102 0.1 8 -2508.92839358 +0.041 0.103 0.1 8 -2509.15288948 +0.041 0.104 0.1 8 -2509.4593336 +0.041 0.105 0.1 8 -2509.84713212 +0.041 0.106 0.1 8 -2510.31571419 +0.041 0.107 0.1 8 -2510.86453109 +0.041 0.108 0.1 8 -2511.49305538 +0.041 0.109 0.1 8 -2512.19670995 +0.041 0.11 0.1 8 -2512.96597014 +0.042 0.09 0.1 8 -2512.85190719 +0.042 0.091 0.1 8 -2512.04012324 +0.042 0.092 0.1 8 -2511.31961094 +0.042 0.093 0.1 8 -2510.68941609 +0.042 0.094 0.1 8 -2510.14862183 +0.042 0.095 0.1 8 -2509.69634712 +0.042 0.096 0.1 8 -2509.33174523 +0.042 0.097 0.1 8 -2509.05400233 +0.042 0.098 0.1 8 -2508.86233614 +0.042 0.099 0.1 8 -2508.75599468 +0.042 0.1 0.1 8 -2508.73425502 +0.042 0.101 0.1 8 -2508.79642219 +0.042 0.102 0.1 8 -2508.94182803 +0.042 0.103 0.1 8 -2509.16148888 +0.042 0.104 0.1 8 -2509.4532293 +0.042 0.105 0.1 8 -2509.82654034 +0.042 0.106 0.1 8 -2510.28084781 +0.042 0.107 0.1 8 -2510.81559968 +0.042 0.108 0.1 8 -2511.43026537 +0.042 0.109 0.1 8 -2512.12433489 +0.042 0.11 0.1 8 -2512.89731812 +0.043 0.09 0.1 8 -2512.98457584 +0.043 0.091 0.1 8 -2512.17584986 +0.043 0.092 0.1 8 -2511.45842361 +0.043 0.093 0.1 8 -2510.831343 +0.043 0.094 0.1 8 -2510.29369133 +0.043 0.095 0.1 8 -2509.84458768 +0.043 0.096 0.1 8 -2509.48318545 +0.043 0.097 0.1 8 -2509.20287919 +0.043 0.098 0.1 8 -2508.99503678 +0.043 0.099 0.1 8 -2508.872757 +0.043 0.1 0.1 8 -2508.83531288 +0.043 0.101 0.1 8 -2508.88200549 +0.043 0.102 0.1 8 -2509.01216288 +0.043 0.103 0.1 8 -2509.225139 +0.043 0.104 0.1 8 -2509.52031271 +0.043 0.105 0.1 8 -2509.89708686 +0.043 0.106 0.1 8 -2510.35488737 +0.043 0.107 0.1 8 -2510.89316237 +0.043 0.108 0.1 8 -2511.51138139 +0.043 0.109 0.1 8 -2512.19797802 +0.043 0.11 0.1 8 -2512.95741925 +0.044 0.09 0.1 8 -2513.26904731 +0.044 0.091 0.1 8 -2512.46329338 +0.044 0.092 0.1 8 -2511.73253181 +0.044 0.093 0.1 8 -2511.08793241 +0.044 0.094 0.1 8 -2510.53302141 +0.044 0.095 0.1 8 -2510.06691314 +0.044 0.096 0.1 8 -2509.68875637 +0.044 0.097 0.1 8 -2509.39773295 +0.044 0.098 0.1 8 -2509.19305641 +0.044 0.099 0.1 8 -2509.07397069 +0.044 0.1 0.1 8 -2509.03974897 +0.044 0.101 0.1 8 -2509.08969245 +0.044 0.102 0.1 8 -2509.2231293 +0.044 0.103 0.1 8 -2509.42908303 +0.044 0.104 0.1 8 -2509.70937281 +0.044 0.105 0.1 8 -2510.07147812 +0.044 0.106 0.1 8 -2510.51482152 +0.044 0.107 0.1 8 -2511.03884786 +0.044 0.108 0.1 8 -2511.6430235 +0.044 0.109 0.1 8 -2512.3268355 +0.044 0.11 0.1 8 -2513.08979087 +0.045 0.09 0.1 8 -2513.61309217 +0.045 0.091 0.1 8 -2512.78920547 +0.045 0.092 0.1 8 -2512.05691459 +0.045 0.093 0.1 8 -2511.41526046 +0.045 0.094 0.1 8 -2510.86332156 +0.045 0.095 0.1 8 -2510.40021234 +0.045 0.096 0.1 8 -2510.02508171 +0.045 0.097 0.1 8 -2509.7343223 +0.045 0.098 0.1 8 -2509.51331026 +0.045 0.099 0.1 8 -2509.37812595 +0.045 0.1 0.1 8 -2509.32803847 +0.045 0.101 0.1 8 -2509.3623451 +0.045 0.102 0.1 8 -2509.4803702 +0.045 0.103 0.1 8 -2509.68146414 +0.045 0.104 0.1 8 -2509.96500234 +0.045 0.105 0.1 8 -2510.3303843 +0.045 0.106 0.1 8 -2510.77703268 +0.045 0.107 0.1 8 -2511.30439248 +0.045 0.108 0.1 8 -2511.91193017 +0.045 0.109 0.1 8 -2512.59913295 +0.045 0.11 0.1 8 -2513.36550797 +0.046 0.09 0.1 8 -2514.07049386 +0.046 0.091 0.1 8 -2513.24942436 +0.046 0.092 0.1 8 -2512.51164807 +0.046 0.093 0.1 8 -2511.85233317 +0.046 0.094 0.1 8 -2511.28299208 +0.046 0.095 0.1 8 -2510.80273447 +0.046 0.096 0.1 8 -2510.41070465 +0.046 0.097 0.1 8 -2510.10608009 +0.046 0.098 0.1 8 -2509.88807014 +0.046 0.099 0.1 8 -2509.75591467 +0.046 0.1 0.1 8 -2509.70888293 +0.046 0.101 0.1 8 -2509.74627229 +0.046 0.102 0.1 8 -2509.86740725 +0.046 0.103 0.1 8 -2510.07163831 +0.046 0.104 0.1 8 -2510.35834101 +0.046 0.105 0.1 8 -2510.72691496 +0.046 0.106 0.1 8 -2511.17678296 +0.046 0.107 0.1 8 -2511.70739013 +0.046 0.108 0.1 8 -2512.31820305 +0.046 0.109 0.1 8 -2513.00870905 +0.046 0.11 0.1 8 -2513.77841541 +0.047 0.09 0.1 8 -2514.58836976 +0.047 0.091 0.1 8 -2513.74903825 +0.047 0.092 0.1 8 -2513.00159644 +0.047 0.093 0.1 8 -2512.34508028 +0.047 0.094 0.1 8 -2511.77856343 +0.047 0.095 0.1 8 -2511.30115571 +0.047 0.096 0.1 8 -2510.91200151 +0.047 0.097 0.1 8 -2510.61027845 +0.047 0.098 0.1 8 -2510.39519599 +0.047 0.099 0.1 8 -2510.26599412 +0.047 0.1 0.1 8 -2510.22194219 +0.047 0.101 0.1 8 -2510.26233773 +0.047 0.102 0.1 8 -2510.38650532 +0.047 0.103 0.1 8 -2510.5937956 +0.047 0.104 0.1 8 -2510.88358422 +0.047 0.105 0.1 8 -2511.25527092 +0.047 0.106 0.1 8 -2511.70827862 +0.047 0.107 0.1 8 -2512.24205253 +0.047 0.108 0.1 8 -2512.8560594 +0.047 0.109 0.1 8 -2513.54978665 +0.047 0.11 0.1 8 -2514.32274169 +0.048 0.09 0.1 8 -2515.20022791 +0.048 0.091 0.1 8 -2514.3635787 +0.048 0.092 0.1 8 -2513.61884388 +0.048 0.093 0.1 8 -2512.96505949 +0.048 0.094 0.1 8 -2512.40129935 +0.048 0.095 0.1 8 -2511.92667334 +0.048 0.096 0.1 8 -2511.54032601 +0.048 0.097 0.1 8 -2511.24143509 +0.048 0.098 0.1 8 -2511.02921012 +0.048 0.099 0.1 8 -2510.90289125 +0.048 0.1 0.1 8 -2510.86174793 +0.048 0.101 0.1 8 -2510.9050778 +0.048 0.102 0.1 8 -2511.03220556 +0.048 0.103 0.1 8 -2511.24248197 +0.048 0.104 0.1 8 -2511.53528279 +0.048 0.105 0.1 8 -2511.91000789 +0.048 0.106 0.1 8 -2512.36608029 +0.048 0.107 0.1 8 -2512.90294534 +0.048 0.108 0.1 8 -2513.52006988 +0.048 0.109 0.1 8 -2514.21694146 +0.048 0.11 0.1 8 -2514.9930676 +0.049 0.09 0.1 8 -2515.93433667 +0.049 0.091 0.1 8 -2515.10030794 +0.049 0.092 0.1 8 -2514.35821771 +0.049 0.093 0.1 8 -2513.70710217 +0.049 0.094 0.1 8 -2513.14603521 +0.049 0.095 0.1 8 -2512.67412685 +0.049 0.096 0.1 8 -2512.29052174 +0.049 0.097 0.1 8 -2511.99439772 +0.049 0.098 0.1 8 -2511.78496447 +0.049 0.099 0.1 8 -2511.66146222 +0.049 0.1 0.1 8 -2511.62316054 +0.049 0.101 0.1 8 -2511.66935719 +0.049 0.102 0.1 8 -2511.799377 +0.049 0.103 0.1 8 -2512.01257081 +0.049 0.104 0.1 8 -2512.30831453 +0.049 0.105 0.1 8 -2512.6860081 +0.049 0.106 0.1 8 -2513.1450747 +0.049 0.107 0.1 8 -2513.68495976 +0.049 0.108 0.1 8 -2514.30513026 +0.049 0.109 0.1 8 -2515.00507385 +0.049 0.11 0.1 8 -2515.78429816 +0.05 0.09 0.1 8 -2516.78582212 +0.05 0.091 0.1 8 -2515.95435563 +0.05 0.092 0.1 8 -2515.21485123 +0.05 0.093 0.1 8 -2514.56634522 +0.05 0.094 0.1 8 -2514.00791161 +0.05 0.095 0.1 8 -2513.53866053 +0.05 0.096 0.1 8 -2513.15773673 +0.05 0.097 0.1 8 -2512.86431817 +0.05 0.098 0.1 8 -2512.65761463 +0.05 0.099 0.1 8 -2512.53686646 +0.05 0.1 0.1 8 -2512.50134334 +0.05 0.101 0.1 8 -2512.55034314 +0.05 0.102 0.1 8 -2512.68319079 +0.05 0.103 0.1 8 -2512.89923726 +0.05 0.104 0.1 8 -2513.19785855 +0.05 0.105 0.1 8 -2513.57845473 +0.05 0.106 0.1 8 -2514.04044908 +0.05 0.107 0.1 8 -2514.58328715 +0.05 0.108 0.1 8 -2515.20643602 +0.05 0.109 0.1 8 -2515.90938346 +0.05 0.11 0.1 8 -2516.69163722 +0.051 0.09 0.1 8 -2517.75009328 +0.051 0.091 0.1 8 -2516.92113404 +0.051 0.092 0.1 8 -2516.18415999 +0.051 0.093 0.1 8 -2515.53820753 +0.051 0.094 0.1 8 -2514.98235078 +0.051 0.095 0.1 8 -2514.51569998 +0.051 0.096 0.1 8 -2514.13739999 +0.051 0.097 0.1 8 -2513.84662887 +0.051 0.098 0.1 8 -2513.64259651 +0.051 0.099 0.1 8 -2513.52454338 +0.051 0.1 0.1 8 -2513.49173925 +0.051 0.101 0.1 8 -2513.5434821 +0.051 0.102 0.1 8 -2513.67909698 +0.051 0.103 0.1 8 -2513.89793497 +0.051 0.104 0.1 8 -2514.19937217 +0.051 0.105 0.1 8 -2514.58280876 +0.051 0.106 0.1 8 -2515.04766812 +0.051 0.107 0.1 8 -2515.59339593 +0.051 0.108 0.1 8 -2516.21945936 +0.051 0.109 0.1 8 -2516.92534631 +0.051 0.11 0.1 8 -2517.71056461 +0.052 0.09 0.1 8 -2518.82282066 +0.052 0.091 0.1 8 -2517.99631666 +0.052 0.092 0.1 8 -2517.26182047 +0.052 0.093 0.1 8 -2516.6183686 +0.052 0.094 0.1 8 -2516.06503527 +0.052 0.095 0.1 8 -2515.60093083 +0.052 0.096 0.1 8 -2515.22520025 +0.052 0.097 0.1 8 -2514.93702168 +0.052 0.098 0.1 8 -2514.73560513 +0.052 0.099 0.1 8 -2514.62019116 +0.052 0.1 0.1 8 -2514.59004967 +0.052 0.101 0.1 8 -2514.64447873 +0.052 0.102 0.1 8 -2514.7828035 +0.052 0.103 0.1 8 -2515.00437516 +0.052 0.104 0.1 8 -2515.30856992 +0.052 0.105 0.1 8 -2515.69478807 +0.052 0.106 0.1 8 -2516.16245309 +0.052 0.107 0.1 8 -2516.71101077 +0.052 0.108 0.1 8 -2517.33992839 +0.052 0.109 0.1 8 -2518.04869395 +0.052 0.11 0.1 8 -2518.8368154 +0.053 0.09 0.1 8 -2519.9999168 +0.053 0.091 0.1 8 -2519.17581874 +0.053 0.092 0.1 8 -2518.44375066 +0.053 0.093 0.1 8 -2517.80274917 +0.053 0.094 0.1 8 -2517.25188861 +0.053 0.095 0.1 8 -2516.79027942 +0.053 0.096 0.1 8 -2516.41706668 +0.053 0.097 0.1 8 -2516.13142863 +0.053 0.098 0.1 8 -2515.9325754 +0.053 0.099 0.1 8 -2515.81974765 +0.053 0.1 0.1 8 -2515.79221537 +0.053 0.101 0.1 8 -2515.84927675 +0.053 0.102 0.1 8 -2515.99025704 +0.053 0.103 0.1 8 -2516.21450753 +0.053 0.104 0.1 8 -2516.52140454 +0.053 0.105 0.1 8 -2516.91034846 +0.053 0.106 0.1 8 -2517.38076288 +0.053 0.107 0.1 8 -2517.93209367 +0.053 0.108 0.1 8 -2518.56380825 +0.053 0.109 0.1 8 -2519.27539469 +0.053 0.11 0.1 8 -2520.06636107 +0.054 0.09 0.1 8 -2521.27751863 +0.054 0.091 0.1 8 -2520.45577967 +0.054 0.092 0.1 8 -2519.72609245 +0.054 0.093 0.1 8 -2519.08749368 +0.054 0.094 0.1 8 -2518.53905778 +0.054 0.095 0.1 8 -2518.0798953 +0.054 0.096 0.1 8 -2517.70915141 +0.054 0.097 0.1 8 -2517.42600448 +0.054 0.098 0.1 8 -2517.22966471 +0.054 0.099 0.1 8 -2517.11937287 +0.054 0.1 0.1 8 -2517.09439907 +0.054 0.101 0.1 8 -2517.15404158 +0.054 0.102 0.1 8 -2517.29762577 +0.054 0.103 0.1 8 -2517.52450301 +0.054 0.104 0.1 8 -2517.83404973 +0.054 0.105 0.1 8 -2518.22566643 +0.054 0.106 0.1 8 -2518.69877679 +0.054 0.107 0.1 8 -2519.2528268 +0.054 0.108 0.1 8 -2519.88728395 +0.054 0.109 0.1 8 -2520.60163645 +0.054 0.11 0.1 8 -2521.39539246 +0.055 0.09 0.1 8 -2522.65197134 +0.055 0.091 0.1 8 -2521.83254695 +0.055 0.092 0.1 8 -2521.10519564 +0.055 0.093 0.1 8 -2520.46895421 +0.055 0.094 0.1 8 -2519.92289719 +0.055 0.095 0.1 8 -2519.46613523 +0.055 0.096 0.1 8 -2519.0978136 +0.055 0.097 0.1 8 -2518.81711076 +0.055 0.098 0.1 8 -2518.62323702 +0.055 0.099 0.1 8 -2518.51543324 +0.055 0.1 0.1 8 -2518.49296963 +0.055 0.101 0.1 8 -2518.55514457 +0.055 0.102 0.1 8 -2518.70128351 +0.055 0.103 0.1 8 -2518.93073794 +0.055 0.104 0.1 8 -2519.24288438 +0.055 0.105 0.1 8 -2519.63712343 +0.055 0.106 0.1 8 -2520.11287888 +0.055 0.107 0.1 8 -2520.6695968 +0.055 0.108 0.1 8 -2521.30674481 +0.055 0.109 0.1 8 -2522.02381118 +0.055 0.11 0.1 8 -2522.82030421 +0.056 0.09 0.1 8 -2524.1198138 +0.056 0.091 0.1 8 -2523.30266151 +0.056 0.092 0.1 8 -2522.57760324 +0.056 0.093 0.1 8 -2521.94367592 +0.056 0.094 0.1 8 -2521.39995415 +0.056 0.095 0.1 8 -2520.94554868 +0.056 0.096 0.1 8 -2520.57960488 +0.056 0.097 0.1 8 -2520.30130131 +0.056 0.098 0.1 8 -2520.10984838 +0.056 0.099 0.1 8 -2520.00448704 +0.056 0.1 0.1 8 -2519.9844876 +0.056 0.101 0.1 8 -2520.04914853 +0.056 0.102 0.1 8 -2520.19779539 +0.056 0.103 0.1 8 -2520.42977976 +0.056 0.104 0.1 8 -2520.74447826 +0.056 0.105 0.1 8 -2521.1412916 +0.056 0.106 0.1 8 -2521.61964363 +0.056 0.107 0.1 8 -2522.17898057 +0.056 0.108 0.1 8 -2522.8187701 +0.056 0.109 0.1 8 -2523.53850061 +0.056 0.11 0.1 8 -2524.33768048 +0.057 0.09 0.1 8 -2525.67776511 +0.057 0.091 0.1 8 -2524.86284436 +0.057 0.092 0.1 8 -2524.14003823 +0.057 0.093 0.1 8 -2523.50838372 +0.057 0.094 0.1 8 -2522.96695553 +0.057 0.095 0.1 8 -2522.51486451 +0.057 0.096 0.1 8 -2522.15125612 +0.057 0.097 0.1 8 -2521.87530902 +0.057 0.098 0.1 8 -2521.68623371 +0.057 0.099 0.1 8 -2521.58327124 +0.057 0.1 0.1 8 -2521.56569201 +0.057 0.101 0.1 8 -2521.6327946 +0.057 0.102 0.1 8 -2521.78390465 +0.057 0.103 0.1 8 -2522.01837384 +0.057 0.104 0.1 8 -2522.3355789 +0.057 0.105 0.1 8 -2522.7349206 +0.057 0.106 0.1 8 -2523.21582293 +0.057 0.107 0.1 8 -2523.77773218 +0.057 0.108 0.1 8 -2524.42011612 +0.057 0.109 0.1 8 -2525.14246327 +0.057 0.11 0.1 8 -2525.94428207 +0.058 0.09 0.1 8 -2527.32271238 +0.058 0.091 0.1 8 -2526.5099844 +0.058 0.092 0.1 8 -2525.78939126 +0.058 0.093 0.1 8 -2525.15997006 +0.058 0.094 0.1 8 -2524.6207956 +0.058 0.095 0.1 8 -2524.17097881 +0.058 0.096 0.1 8 -2523.80966526 +0.058 0.097 0.1 8 -2523.53603368 +0.058 0.098 0.1 8 -2523.34929469 +0.058 0.099 0.1 8 -2523.24868942 +0.058 0.1 0.1 8 -2523.23348836 +0.058 0.101 0.1 8 -2523.30299018 +0.058 0.102 0.1 8 -2523.45652064 +0.058 0.103 0.1 8 -2523.69343149 +0.058 0.104 0.1 8 -2524.01309955 +0.058 0.105 0.1 8 -2524.41492571 +0.058 0.106 0.1 8 -2524.89833404 +0.058 0.107 0.1 8 -2525.46277092 +0.058 0.108 0.1 8 -2526.10770422 +0.058 0.109 0.1 8 -2526.83262255 +0.058 0.11 0.1 8 -2527.63703446 +0.059 0.09 0.1 8 -2529.05169951 +0.059 0.091 0.1 8 -2528.24112714 +0.059 0.092 0.1 8 -2527.52270949 +0.059 0.093 0.1 8 -2526.89548376 +0.059 0.094 0.1 8 -2526.35852484 +0.059 0.095 0.1 8 -2525.91094376 +0.059 0.096 0.1 8 -2525.55188616 +0.059 0.097 0.1 8 -2525.28053089 +0.059 0.098 0.1 8 -2525.09608863 +0.059 0.099 0.1 8 -2524.99780063 +0.059 0.1 0.1 8 -2524.98493746 +0.059 0.101 0.1 8 -2525.05679789 +0.059 0.102 0.1 8 -2525.21270775 +0.059 0.103 0.1 8 -2525.4520189 +0.059 0.104 0.1 8 -2525.77410826 +0.059 0.105 0.1 8 -2526.1783768 +0.059 0.106 0.1 8 -2526.66424868 +0.059 0.107 0.1 8 -2527.23117038 +0.059 0.108 0.1 8 -2527.87860987 +0.059 0.109 0.1 8 -2528.60605584 +0.059 0.11 0.1 8 -2529.41301693 +0.06 0.09 0.1 8 -2530.86191689 +0.06 0.091 0.1 8 -2530.05346447 +0.06 0.092 0.1 8 -2529.33718634 +0.06 0.093 0.1 8 -2528.71211977 +0.06 0.094 0.1 8 -2528.17733975 +0.06 0.095 0.1 8 -2527.7319574 +0.06 0.096 0.1 8 -2527.37511845 +0.06 0.097 0.1 8 -2527.10600184 +0.06 0.098 0.1 8 -2526.92381834 +0.06 0.099 0.1 8 -2526.82780929 +0.06 0.1 0.1 8 -2526.81724535 +0.06 0.101 0.1 8 -2526.89142538 +0.06 0.102 0.1 8 -2527.0496753 +0.06 0.103 0.1 8 -2527.29134708 +0.06 0.104 0.1 8 -2527.6158177 +0.06 0.105 0.1 8 -2528.02248823 +0.06 0.106 0.1 8 -2528.51078293 +0.06 0.107 0.1 8 -2529.08014837 +0.06 0.108 0.1 8 -2529.73005261 +0.06 0.109 0.1 8 -2530.45998443 +0.06 0.11 0.1 8 -2531.26945256 +0.061 0.09 0.1 8 -2532.75069192 +0.061 0.091 0.1 8 -2531.94432519 +0.061 0.092 0.1 8 -2531.23015199 +0.061 0.093 0.1 8 -2530.60720969 +0.061 0.094 0.1 8 -2530.07457336 +0.061 0.095 0.1 8 -2529.6313542 +0.061 0.096 0.1 8 -2529.27669805 +0.061 0.097 0.1 8 -2529.00978393 +0.061 0.098 0.1 8 -2528.82982269 +0.061 0.099 0.1 8 -2528.73605576 +0.061 0.1 0.1 8 -2528.7277539 +0.061 0.101 0.1 8 -2528.80421605 +0.061 0.102 0.1 8 -2528.96476823 +0.061 0.103 0.1 8 -2529.20876248 +0.061 0.104 0.1 8 -2529.53557589 +0.061 0.105 0.1 8 -2529.94460961 +0.061 0.106 0.1 8 -2530.43528799 +0.061 0.107 0.1 8 -2531.00705769 +0.061 0.108 0.1 8 -2531.65938685 +0.061 0.109 0.1 8 -2532.39176436 +0.061 0.11 0.1 8 -2533.20369902 +0.062 0.09 0.1 8 -2534.71548033 +0.062 0.091 0.1 8 -2533.91116631 +0.062 0.092 0.1 8 -2533.19906476 +0.062 0.093 0.1 8 -2532.57821314 +0.062 0.094 0.1 8 -2532.04768661 +0.062 0.095 0.1 8 -2531.60659646 +0.062 0.096 0.1 8 -2531.25408859 +0.062 0.097 0.1 8 -2530.98934213 +0.062 0.098 0.1 8 -2530.81156803 +0.062 0.099 0.1 8 -2530.72000778 +0.062 0.1 0.1 8 -2530.71393224 +0.062 0.101 0.1 8 -2530.79264044 +0.062 0.102 0.1 8 -2530.95545849 +0.062 0.103 0.1 8 -2531.2017385 +0.062 0.104 0.1 8 -2531.53085767 +0.062 0.105 0.1 8 -2531.94221722 +0.062 0.106 0.1 8 -2532.4352416 +0.062 0.107 0.1 8 -2533.00937756 +0.062 0.108 0.1 8 -2533.66409332 +0.062 0.109 0.1 8 -2534.39887785 +0.062 0.11 0.1 8 -2535.21324007 +0.063 0.09 0.1 8 -2536.75385809 +0.063 0.091 0.1 8 -2535.95156501 +0.063 0.092 0.1 8 -2535.24150304 +0.063 0.093 0.1 8 -2534.62270974 +0.063 0.094 0.1 8 -2534.09426034 +0.063 0.095 0.1 8 -2533.65526623 +0.063 0.096 0.1 8 -2533.30487341 +0.063 0.097 0.1 8 -2533.04226106 +0.063 0.098 0.1 8 -2532.86664023 +0.063 0.099 0.1 8 -2532.77725251 +0.063 0.1 0.1 8 -2532.77336883 +0.063 0.101 0.1 8 -2532.85428831 +0.063 0.102 0.1 8 -2533.01933715 +0.063 0.103 0.1 8 -2533.26786755 +0.063 0.104 0.1 8 -2533.59925678 +0.063 0.105 0.1 8 -2534.01290617 +0.063 0.106 0.1 8 -2534.50824024 +0.063 0.107 0.1 8 -2535.08470582 +0.063 0.108 0.1 8 -2535.73898087 +0.063 0.109 0.1 8 -2536.46790779 +0.063 0.11 0.1 8 -2537.27651756 +0.064 0.09 0.1 8 -2538.86351408 +0.064 0.091 0.1 8 -2538.06321125 +0.064 0.092 0.1 8 -2537.35515792 +0.064 0.093 0.1 8 -2536.7383917 +0.064 0.094 0.1 8 -2536.21198792 +0.064 0.095 0.1 8 -2535.77505805 +0.064 0.096 0.1 8 -2535.42674817 +0.064 0.097 0.1 8 -2535.16623755 +0.064 0.098 0.1 8 -2534.99273733 +0.064 0.099 0.1 8 -2534.90548917 +0.064 0.1 0.1 8 -2534.9037641 +0.064 0.101 0.1 8 -2534.98686132 +0.064 0.102 0.1 8 -2535.15410709 +0.064 0.103 0.1 8 -2535.40485374 +0.064 0.104 0.1 8 -2535.73283704 +0.064 0.105 0.1 8 -2536.14016183 +0.064 0.106 0.1 8 -2536.62928234 +0.064 0.107 0.1 8 -2537.19964381 +0.064 0.108 0.1 8 -2537.85071298 +0.064 0.109 0.1 8 -2538.58197737 +0.064 0.11 0.1 8 -2539.39294451 diff --git a/experiments/process.py b/experiments/process.py index 9ea2e81..5f3cff4 100644 --- a/experiments/process.py +++ b/experiments/process.py @@ -15,22 +15,22 @@ if __name__ == "__main__": sys.exit("usage: {0} <file>".format(sys.argv[0])) root_victims, victims, non_victims, age = load(open(sys.argv[1])) - # alphas = np.arange(1e-3, 1e-2, 8e-4) # parameter of the time component - alphas = np.logspace(-3,0,num=15) - # deltas = np.arange(0.001, 0.3, 0.008) # parameter of the structural component - deltas = np.logspace(-4,-1.7,num=15) - with open("out.log", "w") as fh: - for alpha, delta in product(alphas, deltas): - beta, roots, ll = ml3(root_victims, victims, non_victims, age, alpha, delta) - print "\t".join(map(str, [alpha, delta, beta, roots, ll])) - fh.write("\t".join(map(str, [alpha, delta, beta, roots, ll])) + "\n") - fh.flush() - # # alphas = np.arange(1e-3, 1e-2, 8e-4) # parameter of the time component - # alphas = np.logspace(-4,-1.5,num=20) + # alphas = np.logspace(-3,0,num=15) # # deltas = np.arange(0.001, 0.3, 0.008) # parameter of the structural component - # deltas = np.logspace(-4,-2,num=20) - # lmbda = 1.#np.logspace(-12,-3,num=10) + # deltas = np.logspace(-4,-1.7,num=15) + # with open("out.log", "w") as fh: + # for alpha, delta in product(alphas, deltas): + # beta, roots, ll = ml3(root_victims, victims, non_victims, age, alpha, delta) + # print "\t".join(map(str, [alpha, delta, beta, roots, ll])) + # fh.write("\t".join(map(str, [alpha, delta, beta, roots, ll])) + "\n") + # fh.flush() + + # alphas = np.arange(.03, .065, .001) # parameter of the time component + # # alphas = np.logspace(-4,-1,num=20) + # deltas = np.arange(.09, .11, .001) # parameter of the structural component + # # deltas = np.logspace(-2,-.5,num=20) + # lmbda = 0.10#np.logspace(-12,-3,num=10) # with open("out.log", "w") as fh: # for alpha, delta in product(alphas, deltas): # lmbda, roots, ll = ml2(root_victims, victims, non_victims, alpha, delta, lmbda) @@ -38,7 +38,7 @@ if __name__ == "__main__": # fh.write("\t".join(map(str, [alpha, delta, lmbda, roots, ll])) + "\n") # fh.flush() - # alpha = 0.0094 - # delta = 0.0048 - # beta, roots, ll = ml2(root_victims, victims, non_victims, alpha, delta, 1.) - # print "\t".join(map(str, [alpha, delta, beta, roots, ll]))
\ No newline at end of file + alpha = 0.041 + delta = 0.01 + beta, roots, ll = ml2(root_victims, victims, non_victims, alpha, delta, 1.) + print "\t".join(map(str, [alpha, delta, beta, roots, ll]))
\ No newline at end of file |
