summaryrefslogtreecommitdiffstats
path: root/experiments/ml2.c
diff options
context:
space:
mode:
Diffstat (limited to 'experiments/ml2.c')
-rw-r--r--experiments/ml2.c2275
1 files changed, 1285 insertions, 990 deletions
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) {