summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Green <ben@SEASITs-MacBook-Pro.local>2015-06-25 15:33:21 -0400
committerBen Green <ben@SEASITs-MacBook-Pro.local>2015-06-25 15:33:21 -0400
commitc8fc620dda6096932707566dc8f20a3e65cb26b0 (patch)
tree89062eaceca70f16eed0e9067648f5b71666ef45
parent708a88f3b301851c9904d8bbf0656688d9bdb95f (diff)
downloadcriminal_cascades-c8fc620dda6096932707566dc8f20a3e65cb26b0.tar.gz
Tried ml3 that allows for multiple parents to infect.
-rw-r--r--experiments/build/temp.macosx-10.6-x86_64-2.7/ml3.obin271436 -> 277036 bytes
-rw-r--r--experiments/ml3.c1098
-rw-r--r--experiments/ml3.pyx16
-rwxr-xr-xexperiments/ml3.sobin106476 -> 106764 bytes
-rw-r--r--experiments/out.log280
-rw-r--r--experiments/process.py6
6 files changed, 768 insertions, 632 deletions
diff --git a/experiments/build/temp.macosx-10.6-x86_64-2.7/ml3.o b/experiments/build/temp.macosx-10.6-x86_64-2.7/ml3.o
index b211a49..e928c51 100644
--- a/experiments/build/temp.macosx-10.6-x86_64-2.7/ml3.o
+++ b/experiments/build/temp.macosx-10.6-x86_64-2.7/ml3.o
Binary files differ
diff --git a/experiments/ml3.c b/experiments/ml3.c
index 08730d3..12d0e1d 100644
--- a/experiments/ml3.c
+++ b/experiments/ml3.c
@@ -914,18 +914,6 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
#endif
#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0)
-static double __Pyx__PyObject_AsDouble(PyObject* obj);
-#if CYTHON_COMPILING_IN_PYPY
-#define __Pyx_PyObject_AsDouble(obj) \
-(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \
- likely(PyInt_CheckExact(obj)) ? \
- PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
-#else
-#define __Pyx_PyObject_AsDouble(obj) \
-((likely(PyFloat_CheckExact(obj))) ? \
- PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
-#endif
-
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck) \
(__Pyx_fits_Py_ssize_t(i, type, is_signed) ? \
__Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) : \
@@ -947,6 +935,18 @@ 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 double __Pyx__PyObject_AsDouble(PyObject* obj);
+#if CYTHON_COMPILING_IN_PYPY
+#define __Pyx_PyObject_AsDouble(obj) \
+(likely(PyFloat_CheckExact(obj)) ? PyFloat_AS_DOUBLE(obj) : \
+ likely(PyInt_CheckExact(obj)) ? \
+ PyFloat_AsDouble(obj) : __Pyx__PyObject_AsDouble(obj))
+#else
+#define __Pyx_PyObject_AsDouble(obj) \
+((likely(PyFloat_CheckExact(obj))) ? \
+ PyFloat_AS_DOUBLE(obj) : __Pyx__PyObject_AsDouble(obj))
+#endif
+
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb);
@@ -1217,6 +1217,7 @@ static char __pyx_k_sum[] = "sum";
static char __pyx_k_beta[] = "beta";
static char __pyx_k_dist[] = "dist";
static char __pyx_k_main[] = "__main__";
+static char __pyx_k_ones[] = "ones";
static char __pyx_k_prob[] = "prob";
static char __pyx_k_test[] = "__test__";
static char __pyx_k_DTYPE[] = "DTYPE";
@@ -1232,6 +1233,7 @@ static char __pyx_k_seeds[] = "seeds";
static char __pyx_k_zeros[] = "zeros";
static char __pyx_k_arange[] = "arange";
static char __pyx_k_import[] = "__import__";
+static char __pyx_k_isSeed[] = "isSeed";
static char __pyx_k_thresh[] = "thresh";
static char __pyx_k_float64[] = "float64";
static char __pyx_k_n_roots[] = "n_roots";
@@ -1285,6 +1287,7 @@ 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_isSeed;
static PyObject *__pyx_n_s_itervalues;
static PyObject *__pyx_n_s_l;
static PyObject *__pyx_n_s_ll;
@@ -1301,6 +1304,7 @@ static PyObject *__pyx_n_s_non_seeds;
static PyObject *__pyx_n_s_non_victims;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_n_s_numpy;
+static PyObject *__pyx_n_s_ones;
static PyObject *__pyx_n_s_parent_dists;
static PyObject *__pyx_n_s_parent_dts;
static PyObject *__pyx_n_s_parents;
@@ -1323,9 +1327,11 @@ static PyObject *__pyx_n_s_w1;
static PyObject *__pyx_n_s_w2;
static PyObject *__pyx_n_s_w3;
static PyObject *__pyx_n_s_zeros;
-static PyObject *__pyx_float__1;
static PyObject *__pyx_float_1_;
-static PyObject *__pyx_float_0_2;
+static PyObject *__pyx_float_0_00001;
+static PyObject *__pyx_float_neg_19_523275053840013;
+static PyObject *__pyx_int_0;
+static PyObject *__pyx_int_1;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_tuple__2;
static PyObject *__pyx_tuple__3;
@@ -1603,17 +1609,20 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
PyArrayObject *__pyx_v_probs_fail = 0;
PyArrayObject *__pyx_v_parent_dists = 0;
PyArrayObject *__pyx_v_parent_dts = 0;
+ PyArrayObject *__pyx_v_isSeed = 0;
PyObject *__pyx_v_dists = NULL;
PyObject *__pyx_v_dts = NULL;
PyObject *__pyx_v_s = NULL;
PyObject *__pyx_v_prob = NULL;
- double __pyx_v_thresh;
+ CYTHON_UNUSED double __pyx_v_thresh;
PyObject *__pyx_v_seeds = NULL;
PyObject *__pyx_v_non_seeds = NULL;
int __pyx_v_max_roots;
PyObject *__pyx_v_w1 = NULL;
PyObject *__pyx_v_w2 = NULL;
PyObject *__pyx_v_w3 = NULL;
+ __Pyx_LocalBuf_ND __pyx_pybuffernd_isSeed;
+ __Pyx_Buffer __pyx_pybuffer_isSeed;
__Pyx_LocalBuf_ND __pyx_pybuffernd_parent_dists;
__Pyx_Buffer __pyx_pybuffer_parent_dists;
__Pyx_LocalBuf_ND __pyx_pybuffernd_parent_dts;
@@ -1634,28 +1643,28 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
PyArrayObject *__pyx_t_8 = NULL;
PyArrayObject *__pyx_t_9 = NULL;
PyArrayObject *__pyx_t_10 = NULL;
- int __pyx_t_11;
+ PyArrayObject *__pyx_t_11 = NULL;
int __pyx_t_12;
int __pyx_t_13;
- Py_ssize_t __pyx_t_14;
- PyObject *__pyx_t_15 = NULL;
+ int __pyx_t_14;
+ Py_ssize_t __pyx_t_15;
PyObject *__pyx_t_16 = NULL;
PyObject *__pyx_t_17 = NULL;
PyObject *__pyx_t_18 = NULL;
PyObject *__pyx_t_19 = NULL;
PyObject *__pyx_t_20 = NULL;
- PyObject *(*__pyx_t_21)(PyObject *);
- int __pyx_t_22;
- __pyx_t_3ml3_DTYPE_t __pyx_t_23;
+ PyObject *__pyx_t_21 = NULL;
+ PyObject *(*__pyx_t_22)(PyObject *);
+ int __pyx_t_23;
__pyx_t_3ml3_DTYPE_t __pyx_t_24;
__pyx_t_3ml3_DTYPE_t __pyx_t_25;
- int __pyx_t_26;
- double __pyx_t_27;
+ __pyx_t_3ml3_DTYPE_t __pyx_t_26;
+ int __pyx_t_27;
int __pyx_t_28;
int __pyx_t_29;
int __pyx_t_30;
int __pyx_t_31;
- int __pyx_t_32;
+ double __pyx_t_32;
PyObject *(*__pyx_t_33)(PyObject *);
int __pyx_lineno = 0;
const char *__pyx_filename = NULL;
@@ -1677,6 +1686,10 @@ static PyObject *__pyx_pf_3ml3_ml3(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_isSeed.pybuffer.buf = NULL;
+ __pyx_pybuffer_isSeed.refcount = 0;
+ __pyx_pybuffernd_isSeed.data = NULL;
+ __pyx_pybuffernd_isSeed.rcbuffer = &__pyx_pybuffer_isSeed;
/* "ml3.pyx":33
* DTYPE_t beta, ll, beta_add, max_beta, max_beta_add
@@ -1791,7 +1804,7 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
* np.ndarray[DTYPE_t] probs_fail = np.zeros(n_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] isSeed = np.ones(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 = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_4);
@@ -1834,8 +1847,8 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
* np.ndarray[DTYPE_t] probs_fail = np.zeros(n_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] isSeed = np.ones(n_victims, dtype=DTYPE)
*
- * # loop through victims
*/
__pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
@@ -1874,46 +1887,90 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
__pyx_v_parent_dts = ((PyArrayObject *)__pyx_t_6);
__pyx_t_6 = 0;
- /* "ml3.pyx":41
+ /* "ml3.pyx":39
+ * 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] isSeed = np.ones(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 = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_ones); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __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 = 39; __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 = 39; __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 = 39; __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 = 39; __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 = 39; __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 = 39; __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 = 39; __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_isSeed.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_3ml3_DTYPE_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {
+ __pyx_v_isSeed = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_isSeed.rcbuffer->pybuffer.buf = NULL;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ } else {__pyx_pybuffernd_isSeed.diminfo[0].strides = __pyx_pybuffernd_isSeed.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_isSeed.diminfo[0].shape = __pyx_pybuffernd_isSeed.rcbuffer->pybuffer.shape[0];
+ }
+ }
+ __pyx_t_11 = 0;
+ __pyx_v_isSeed = ((PyArrayObject *)__pyx_t_4);
+ __pyx_t_4 = 0;
+
+ /* "ml3.pyx":42
*
* # 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_11 = 0;
+ __pyx_t_12 = 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 = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_3 = __Pyx_dict_iterator(__pyx_v_victims, 1, __pyx_n_s_itervalues, (&__pyx_t_1), (&__pyx_t_12)); 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_XDECREF(__pyx_t_6);
- __pyx_t_6 = __pyx_t_3;
- __pyx_t_3 = 0;
+ __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 = 42; __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;
while (1) {
- __pyx_t_13 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_1, &__pyx_t_2, NULL, &__pyx_t_3, NULL, __pyx_t_12);
- if (unlikely(__pyx_t_13 == 0)) break;
- if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected %.16s, got %.200s", "list", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_XDECREF_SET(__pyx_v_parents, ((PyObject*)__pyx_t_3));
- __pyx_t_3 = 0;
- __pyx_v_i = __pyx_t_11;
- __pyx_t_11 = (__pyx_t_11 + 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 = 42; __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 = 42; __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);
- /* "ml3.pyx":45
+ /* "ml3.pyx":46
* # fail to infect it, also computes the probability that its most
* # likely parent infects it
* failures = [weight_failure(dist, dt, alpha, delta, w1, w2, w3) # <<<<<<<<<<<<<<
* for (dist, dt, w1, w2, w3) in parents]
* probs_fail[i] = sum(failures)
*/
- __pyx_t_3 = PyList_New(0); 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_t_6 = PyList_New(0); 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);
- /* "ml3.pyx":46
+ /* "ml3.pyx":47
* # likely parent infects it
* failures = [weight_failure(dist, dt, alpha, delta, w1, w2, w3)
* for (dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<<
@@ -1922,18 +1979,18 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
*/
if (unlikely(__pyx_v_parents == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_5 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_5); __pyx_t_14 = 0;
+ __pyx_t_5 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_5); __pyx_t_15 = 0;
for (;;) {
- if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_5)) break;
+ if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_5)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_14); __Pyx_INCREF(__pyx_t_4); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
- PyObject* sequence = __pyx_t_4;
+ if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
+ PyObject* sequence = __pyx_t_3;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -1942,91 +1999,91 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
if (unlikely(size != 5)) {
if (size > 5) __Pyx_RaiseTooManyValuesError(5);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_16 = PyTuple_GET_ITEM(sequence, 1);
- __pyx_t_17 = PyTuple_GET_ITEM(sequence, 2);
- __pyx_t_18 = PyTuple_GET_ITEM(sequence, 3);
- __pyx_t_19 = PyTuple_GET_ITEM(sequence, 4);
+ __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);
} else {
- __pyx_t_15 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_16 = PyList_GET_ITEM(sequence, 1);
- __pyx_t_17 = PyList_GET_ITEM(sequence, 2);
- __pyx_t_18 = PyList_GET_ITEM(sequence, 3);
- __pyx_t_19 = PyList_GET_ITEM(sequence, 4);
+ __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_INCREF(__pyx_t_15);
__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);
#else
{
Py_ssize_t i;
- PyObject** temps[5] = {&__pyx_t_15,&__pyx_t_16,&__pyx_t_17,&__pyx_t_18,&__pyx_t_19};
+ 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 = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(item);
*(temps[i]) = item;
}
}
#endif
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
Py_ssize_t index = -1;
- PyObject** temps[5] = {&__pyx_t_15,&__pyx_t_16,&__pyx_t_17,&__pyx_t_18,&__pyx_t_19};
- __pyx_t_20 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_20);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_21 = Py_TYPE(__pyx_t_20)->tp_iternext;
+ 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 = 47; __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_21(__pyx_t_20); if (unlikely(!item)) goto __pyx_L7_unpacking_failed;
+ PyObject* item = __pyx_t_22(__pyx_t_21); if (unlikely(!item)) goto __pyx_L7_unpacking_failed;
__Pyx_GOTREF(item);
*(temps[index]) = item;
}
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_21(__pyx_t_20), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_21 = NULL;
- __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_21), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_22 = NULL;
+ __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
goto __pyx_L8_unpacking_done;
__pyx_L7_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
- __pyx_t_21 = NULL;
+ __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
+ __pyx_t_22 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L8_unpacking_done:;
}
- __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_15); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __pyx_t_22 = __Pyx_PyInt_As_int(__pyx_t_16); if (unlikely((__pyx_t_22 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- __pyx_v_dist = __pyx_t_13;
- __pyx_v_dt = __pyx_t_22;
- __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_17);
- __pyx_t_17 = 0;
- __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_18);
+ __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 = 47; __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_w3, __pyx_t_19);
+ __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_19);
__pyx_t_19 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_20);
+ __pyx_t_20 = 0;
- /* "ml3.pyx":45
+ /* "ml3.pyx":46
* # fail to infect it, also computes the probability that its most
* # likely parent infects it
* failures = [weight_failure(dist, dt, alpha, delta, w1, w2, w3) # <<<<<<<<<<<<<<
* for (dist, dt, w1, w2, w3) in parents]
* probs_fail[i] = sum(failures)
*/
- __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_v_w1); if (unlikely((__pyx_t_23 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_v_w2); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_v_w3); if (unlikely((__pyx_t_25 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = PyFloat_FromDouble(__pyx_f_3ml3_weight_failure(__pyx_v_dist, __pyx_v_dt, __pyx_v_alpha, __pyx_v_delta, __pyx_t_23, __pyx_t_24, __pyx_t_25)); 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 (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_4))) {__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_24 = __pyx_PyFloat_AsDouble(__pyx_v_w1); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __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 = 46; __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 = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyFloat_FromDouble(__pyx_f_3ml3_weight_failure(__pyx_v_dist, __pyx_v_dt, __pyx_v_alpha, __pyx_v_delta, __pyx_t_24, __pyx_t_25, __pyx_t_26)); 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 (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "ml3.pyx":46
+ /* "ml3.pyx":47
* # likely parent infects it
* failures = [weight_failure(dist, dt, alpha, delta, w1, w2, w3)
* for (dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<<
@@ -2035,41 +2092,41 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
*/
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __Pyx_XDECREF_SET(__pyx_v_failures, ((PyObject*)__pyx_t_3));
- __pyx_t_3 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_failures, ((PyObject*)__pyx_t_6));
+ __pyx_t_6 = 0;
- /* "ml3.pyx":47
+ /* "ml3.pyx":48
* failures = [weight_failure(dist, dt, alpha, delta, w1, w2, w3)
* for (dist, dt, w1, w2, w3) in parents]
* probs_fail[i] = sum(failures) # <<<<<<<<<<<<<<
* successes = [weight_success(dist, dt, alpha, delta, w1, w2, w3)
* for (dist, dt, w1, w2, w3) in parents]
*/
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
+ __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
__Pyx_INCREF(__pyx_v_failures);
- PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_failures);
+ PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_failures);
__Pyx_GIVEREF(__pyx_v_failures);
- __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_sum, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_25 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- __pyx_t_22 = __pyx_v_i;
- if (__pyx_t_22 < 0) __pyx_t_22 += __pyx_pybuffernd_probs_fail.diminfo[0].shape;
- *__Pyx_BufPtrStrided1d(__pyx_t_3ml3_DTYPE_t *, __pyx_pybuffernd_probs_fail.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_probs_fail.diminfo[0].strides) = __pyx_t_25;
+ __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_3ml3_DTYPE_t *, __pyx_pybuffernd_probs_fail.rcbuffer->pybuffer.buf, __pyx_t_23, __pyx_pybuffernd_probs_fail.diminfo[0].strides) = __pyx_t_26;
- /* "ml3.pyx":48
+ /* "ml3.pyx":49
* for (dist, dt, w1, w2, w3) in parents]
* probs_fail[i] = sum(failures)
* successes = [weight_success(dist, dt, alpha, delta, w1, w2, w3) # <<<<<<<<<<<<<<
* for (dist, dt, w1, w2, w3) in parents]
* dists = [dist for (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 = 48; __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 = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- /* "ml3.pyx":49
+ /* "ml3.pyx":50
* probs_fail[i] = sum(failures)
* successes = [weight_success(dist, dt, alpha, delta, w1, w2, w3)
* for (dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<<
@@ -2078,18 +2135,18 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
*/
if (unlikely(__pyx_v_parents == Py_None)) {
PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable");
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_3 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_3); __pyx_t_14 = 0;
+ __pyx_t_6 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_6); __pyx_t_15 = 0;
for (;;) {
- if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_6)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_14); __Pyx_INCREF(__pyx_t_4); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
- PyObject* sequence = __pyx_t_4;
+ if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
+ PyObject* sequence = __pyx_t_3;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -2098,91 +2155,91 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
if (unlikely(size != 5)) {
if (size > 5) __Pyx_RaiseTooManyValuesError(5);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_19 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_18 = PyTuple_GET_ITEM(sequence, 1);
- __pyx_t_17 = PyTuple_GET_ITEM(sequence, 2);
- __pyx_t_16 = PyTuple_GET_ITEM(sequence, 3);
- __pyx_t_15 = PyTuple_GET_ITEM(sequence, 4);
+ __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);
} else {
- __pyx_t_19 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_18 = PyList_GET_ITEM(sequence, 1);
- __pyx_t_17 = PyList_GET_ITEM(sequence, 2);
- __pyx_t_16 = PyList_GET_ITEM(sequence, 3);
- __pyx_t_15 = PyList_GET_ITEM(sequence, 4);
+ __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_INCREF(__pyx_t_20);
__Pyx_INCREF(__pyx_t_19);
__Pyx_INCREF(__pyx_t_18);
__Pyx_INCREF(__pyx_t_17);
__Pyx_INCREF(__pyx_t_16);
- __Pyx_INCREF(__pyx_t_15);
#else
{
Py_ssize_t i;
- PyObject** temps[5] = {&__pyx_t_19,&__pyx_t_18,&__pyx_t_17,&__pyx_t_16,&__pyx_t_15};
+ 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 = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(item);
*(temps[i]) = item;
}
}
#endif
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
Py_ssize_t index = -1;
- PyObject** temps[5] = {&__pyx_t_19,&__pyx_t_18,&__pyx_t_17,&__pyx_t_16,&__pyx_t_15};
- __pyx_t_20 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_20);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_21 = Py_TYPE(__pyx_t_20)->tp_iternext;
+ 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 = 50; __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_21(__pyx_t_20); if (unlikely(!item)) goto __pyx_L11_unpacking_failed;
+ PyObject* item = __pyx_t_22(__pyx_t_21); if (unlikely(!item)) goto __pyx_L11_unpacking_failed;
__Pyx_GOTREF(item);
*(temps[index]) = item;
}
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_21(__pyx_t_20), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_21 = NULL;
- __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_21), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_22 = NULL;
+ __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
goto __pyx_L12_unpacking_done;
__pyx_L11_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
- __pyx_t_21 = NULL;
+ __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
+ __pyx_t_22 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L12_unpacking_done:;
}
- __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_19); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 50; __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 = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
- __pyx_t_26 = __Pyx_PyInt_As_int(__pyx_t_18); if (unlikely((__pyx_t_26 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_v_dist = __pyx_t_13;
- __pyx_v_dt = __pyx_t_26;
- __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_17);
+ __pyx_v_dist = __pyx_t_14;
+ __pyx_v_dt = __pyx_t_27;
+ __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_18);
+ __pyx_t_18 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_17);
__pyx_t_17 = 0;
- __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_16);
+ __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_16);
__pyx_t_16 = 0;
- __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_15);
- __pyx_t_15 = 0;
- /* "ml3.pyx":48
+ /* "ml3.pyx":49
* for (dist, dt, w1, w2, w3) in parents]
* probs_fail[i] = sum(failures)
* successes = [weight_success(dist, dt, alpha, delta, w1, w2, w3) # <<<<<<<<<<<<<<
* for (dist, dt, w1, w2, w3) in parents]
* dists = [dist for (dist, dt, w1, w2, w3) in parents]
*/
- __pyx_t_25 = __pyx_PyFloat_AsDouble(__pyx_v_w1); if (unlikely((__pyx_t_25 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_v_w2); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_v_w3); if (unlikely((__pyx_t_23 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_4 = PyFloat_FromDouble(__pyx_f_3ml3_weight_success(__pyx_v_dist, __pyx_v_dt, __pyx_v_alpha, __pyx_v_delta, __pyx_t_25, __pyx_t_24, __pyx_t_23)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 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 = 49; __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 = 49; __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 = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyFloat_FromDouble(__pyx_f_3ml3_weight_success(__pyx_v_dist, __pyx_v_dt, __pyx_v_alpha, __pyx_v_delta, __pyx_t_26, __pyx_t_25, __pyx_t_24)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __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 = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- /* "ml3.pyx":49
+ /* "ml3.pyx":50
* probs_fail[i] = sum(failures)
* successes = [weight_success(dist, dt, alpha, delta, w1, w2, w3)
* for (dist, dt, w1, w2, w3) in parents] # <<<<<<<<<<<<<<
@@ -2190,33 +2247,33 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
* dts = [dt for (dist, dt, w1, w2, w3) in parents]
*/
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF_SET(__pyx_v_successes, ((PyObject*)__pyx_t_5));
__pyx_t_5 = 0;
- /* "ml3.pyx":50
+ /* "ml3.pyx":51
* successes = [weight_success(dist, dt, alpha, delta, 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})
*/
- __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __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 = 51; __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 = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_3 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_3); __pyx_t_14 = 0;
+ __pyx_t_6 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_6); __pyx_t_15 = 0;
for (;;) {
- if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_6)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_14); __Pyx_INCREF(__pyx_t_4); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
- PyObject* sequence = __pyx_t_4;
+ if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
+ PyObject* sequence = __pyx_t_3;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -2225,106 +2282,106 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
if (unlikely(size != 5)) {
if (size > 5) __Pyx_RaiseTooManyValuesError(5);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_15 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_16 = PyTuple_GET_ITEM(sequence, 1);
- __pyx_t_17 = PyTuple_GET_ITEM(sequence, 2);
- __pyx_t_18 = PyTuple_GET_ITEM(sequence, 3);
- __pyx_t_19 = PyTuple_GET_ITEM(sequence, 4);
+ __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);
} else {
- __pyx_t_15 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_16 = PyList_GET_ITEM(sequence, 1);
- __pyx_t_17 = PyList_GET_ITEM(sequence, 2);
- __pyx_t_18 = PyList_GET_ITEM(sequence, 3);
- __pyx_t_19 = PyList_GET_ITEM(sequence, 4);
+ __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_INCREF(__pyx_t_15);
__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);
#else
{
Py_ssize_t i;
- PyObject** temps[5] = {&__pyx_t_15,&__pyx_t_16,&__pyx_t_17,&__pyx_t_18,&__pyx_t_19};
+ 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 = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(item);
*(temps[i]) = item;
}
}
#endif
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
Py_ssize_t index = -1;
- PyObject** temps[5] = {&__pyx_t_15,&__pyx_t_16,&__pyx_t_17,&__pyx_t_18,&__pyx_t_19};
- __pyx_t_20 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_20);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_21 = Py_TYPE(__pyx_t_20)->tp_iternext;
+ 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 = 51; __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_21(__pyx_t_20); if (unlikely(!item)) goto __pyx_L15_unpacking_failed;
+ PyObject* item = __pyx_t_22(__pyx_t_21); if (unlikely(!item)) goto __pyx_L15_unpacking_failed;
__Pyx_GOTREF(item);
*(temps[index]) = item;
}
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_21(__pyx_t_20), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_21 = NULL;
- __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_21), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_22 = NULL;
+ __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
goto __pyx_L16_unpacking_done;
__pyx_L15_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
- __pyx_t_21 = NULL;
+ __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
+ __pyx_t_22 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L16_unpacking_done:;
}
- __pyx_t_26 = __Pyx_PyInt_As_int(__pyx_t_15); if (unlikely((__pyx_t_26 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_16); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- __pyx_v_dist = __pyx_t_26;
- __pyx_v_dt = __pyx_t_13;
- __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_17);
- __pyx_t_17 = 0;
- __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_18);
+ __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 = 51; __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_w3, __pyx_t_19);
+ __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_19);
__pyx_t_19 = 0;
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_dist); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_w3, __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 = 51; __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 = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF_SET(__pyx_v_dists, ((PyObject*)__pyx_t_5));
__pyx_t_5 = 0;
- /* "ml3.pyx":51
+ /* "ml3.pyx":52
* 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})
* # 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 = 51; __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 = 52; __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 = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __pyx_t_3 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_3); __pyx_t_14 = 0;
+ __pyx_t_6 = __pyx_v_parents; __Pyx_INCREF(__pyx_t_6); __pyx_t_15 = 0;
for (;;) {
- if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_3)) break;
+ if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_6)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_14); __Pyx_INCREF(__pyx_t_4); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_4 = PySequence_ITEM(__pyx_t_3, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- if ((likely(PyTuple_CheckExact(__pyx_t_4))) || (PyList_CheckExact(__pyx_t_4))) {
- PyObject* sequence = __pyx_t_4;
+ if ((likely(PyTuple_CheckExact(__pyx_t_3))) || (PyList_CheckExact(__pyx_t_3))) {
+ PyObject* sequence = __pyx_t_3;
#if CYTHON_COMPILING_IN_CPYTHON
Py_ssize_t size = Py_SIZE(sequence);
#else
@@ -2333,213 +2390,207 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
if (unlikely(size != 5)) {
if (size > 5) __Pyx_RaiseTooManyValuesError(5);
else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
#if CYTHON_COMPILING_IN_CPYTHON
if (likely(PyTuple_CheckExact(sequence))) {
- __pyx_t_19 = PyTuple_GET_ITEM(sequence, 0);
- __pyx_t_18 = PyTuple_GET_ITEM(sequence, 1);
- __pyx_t_17 = PyTuple_GET_ITEM(sequence, 2);
- __pyx_t_16 = PyTuple_GET_ITEM(sequence, 3);
- __pyx_t_15 = PyTuple_GET_ITEM(sequence, 4);
+ __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);
} else {
- __pyx_t_19 = PyList_GET_ITEM(sequence, 0);
- __pyx_t_18 = PyList_GET_ITEM(sequence, 1);
- __pyx_t_17 = PyList_GET_ITEM(sequence, 2);
- __pyx_t_16 = PyList_GET_ITEM(sequence, 3);
- __pyx_t_15 = PyList_GET_ITEM(sequence, 4);
+ __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_INCREF(__pyx_t_20);
__Pyx_INCREF(__pyx_t_19);
__Pyx_INCREF(__pyx_t_18);
__Pyx_INCREF(__pyx_t_17);
__Pyx_INCREF(__pyx_t_16);
- __Pyx_INCREF(__pyx_t_15);
#else
{
Py_ssize_t i;
- PyObject** temps[5] = {&__pyx_t_19,&__pyx_t_18,&__pyx_t_17,&__pyx_t_16,&__pyx_t_15};
+ 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 = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ PyObject* item = PySequence_ITEM(sequence, i); if (unlikely(!item)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(item);
*(temps[i]) = item;
}
}
#endif
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
Py_ssize_t index = -1;
- PyObject** temps[5] = {&__pyx_t_19,&__pyx_t_18,&__pyx_t_17,&__pyx_t_16,&__pyx_t_15};
- __pyx_t_20 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_20);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_21 = Py_TYPE(__pyx_t_20)->tp_iternext;
+ 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 = 52; __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_21(__pyx_t_20); if (unlikely(!item)) goto __pyx_L19_unpacking_failed;
+ PyObject* item = __pyx_t_22(__pyx_t_21); if (unlikely(!item)) goto __pyx_L19_unpacking_failed;
__Pyx_GOTREF(item);
*(temps[index]) = item;
}
- if (__Pyx_IternextUnpackEndCheck(__pyx_t_21(__pyx_t_20), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_21 = NULL;
- __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
+ if (__Pyx_IternextUnpackEndCheck(__pyx_t_22(__pyx_t_21), 5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_22 = NULL;
+ __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
goto __pyx_L20_unpacking_done;
__pyx_L19_unpacking_failed:;
- __Pyx_DECREF(__pyx_t_20); __pyx_t_20 = 0;
- __pyx_t_21 = NULL;
+ __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0;
+ __pyx_t_22 = NULL;
if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index);
- {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_L20_unpacking_done:;
}
- __pyx_t_13 = __Pyx_PyInt_As_int(__pyx_t_19); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __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 = 52; __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 = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_19); __pyx_t_19 = 0;
- __pyx_t_26 = __Pyx_PyInt_As_int(__pyx_t_18); if (unlikely((__pyx_t_26 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_18); __pyx_t_18 = 0;
- __pyx_v_dist = __pyx_t_13;
- __pyx_v_dt = __pyx_t_26;
- __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_17);
+ __pyx_v_dist = __pyx_t_14;
+ __pyx_v_dt = __pyx_t_27;
+ __Pyx_XDECREF_SET(__pyx_v_w1, __pyx_t_18);
+ __pyx_t_18 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_17);
__pyx_t_17 = 0;
- __Pyx_XDECREF_SET(__pyx_v_w2, __pyx_t_16);
+ __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_16);
__pyx_t_16 = 0;
- __Pyx_XDECREF_SET(__pyx_v_w3, __pyx_t_15);
- __pyx_t_15 = 0;
- __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_dt); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_4))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_dt); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __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 = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_XDECREF_SET(__pyx_v_dts, ((PyObject*)__pyx_t_5));
__pyx_t_5 = 0;
- /* "ml3.pyx":54
- * # find parent that maximizes log(p) - log(\tilde{p})
+ /* "ml3.pyx":56
* # probs[i] = max(s - failures[l] for l, s in enumerate(successes))
- * probs[i] = float("-inf") # <<<<<<<<<<<<<<
- * for l, s in enumerate(successes):
- * prob = s - failures[l]
- */
- __pyx_t_27 = __Pyx_PyObject_AsDouble(__pyx_kp_s_inf); if (unlikely(__pyx_t_27 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_26 = __pyx_v_i;
- if (__pyx_t_26 < 0) __pyx_t_26 += __pyx_pybuffernd_probs.diminfo[0].shape;
- *__Pyx_BufPtrStrided1d(__pyx_t_3ml3_DTYPE_t *, __pyx_pybuffernd_probs.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_probs.diminfo[0].strides) = __pyx_t_27;
-
- /* "ml3.pyx":55
- * # probs[i] = max(s - failures[l] for l, s in enumerate(successes))
- * probs[i] = float("-inf")
+ * # probs[i] = 0.
* for l, s in enumerate(successes): # <<<<<<<<<<<<<<
* prob = s - failures[l]
- * if prob > probs[i]:
+ * if prob > -19.523275053840013:
*/
- __pyx_t_13 = 0;
- __pyx_t_5 = __pyx_v_successes; __Pyx_INCREF(__pyx_t_5); __pyx_t_14 = 0;
+ __pyx_t_27 = 0;
+ __pyx_t_5 = __pyx_v_successes; __Pyx_INCREF(__pyx_t_5); __pyx_t_15 = 0;
for (;;) {
- if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_5)) break;
+ if (__pyx_t_15 >= PyList_GET_SIZE(__pyx_t_5)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_14); __Pyx_INCREF(__pyx_t_3); __pyx_t_14++; 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_15); __Pyx_INCREF(__pyx_t_6); __pyx_t_15++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_14); __pyx_t_14++; 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_15); __pyx_t_15++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
- __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_3);
- __pyx_t_3 = 0;
- __pyx_v_l = __pyx_t_13;
- __pyx_t_13 = (__pyx_t_13 + 1);
+ __Pyx_XDECREF_SET(__pyx_v_s, __pyx_t_6);
+ __pyx_t_6 = 0;
+ __pyx_v_l = __pyx_t_27;
+ __pyx_t_27 = (__pyx_t_27 + 1);
- /* "ml3.pyx":56
- * probs[i] = float("-inf")
+ /* "ml3.pyx":57
+ * # probs[i] = 0.
* for l, s in enumerate(successes):
* prob = s - failures[l] # <<<<<<<<<<<<<<
- * if prob > probs[i]:
- * probs[i] = prob
+ * if prob > -19.523275053840013:
+ * isSeed[i] = 0
*/
- __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_failures, __pyx_v_l, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __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 = 57; __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 = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_4 = PyNumber_Subtract(__pyx_v_s, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_XDECREF_SET(__pyx_v_prob, __pyx_t_4);
- __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_XDECREF_SET(__pyx_v_prob, __pyx_t_3);
+ __pyx_t_3 = 0;
- /* "ml3.pyx":57
+ /* "ml3.pyx":58
* for l, s in enumerate(successes):
* prob = s - failures[l]
- * if prob > probs[i]: # <<<<<<<<<<<<<<
- * probs[i] = prob
- * parent_dists[i] = dists[l]
+ * if prob > -19.523275053840013: # <<<<<<<<<<<<<<
+ * isSeed[i] = 0
+ * probs[i] += prob
*/
- __pyx_t_28 = __pyx_v_i;
- if (__pyx_t_28 < 0) __pyx_t_28 += __pyx_pybuffernd_probs.diminfo[0].shape;
- __pyx_t_4 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_3ml3_DTYPE_t *, __pyx_pybuffernd_probs.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_probs.diminfo[0].strides))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
- __pyx_t_3 = PyObject_RichCompare(__pyx_v_prob, __pyx_t_4, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_29 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_29 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyObject_RichCompare(__pyx_v_prob, __pyx_float_neg_19_523275053840013, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_28 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_28 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- if (__pyx_t_29) {
+ if (__pyx_t_28) {
- /* "ml3.pyx":58
+ /* "ml3.pyx":59
* prob = s - failures[l]
- * if prob > probs[i]:
- * probs[i] = prob # <<<<<<<<<<<<<<
+ * if prob > -19.523275053840013:
+ * isSeed[i] = 0 # <<<<<<<<<<<<<<
+ * probs[i] += prob
+ * parent_dists[i] = dists[l]
+ */
+ __pyx_t_14 = __pyx_v_i;
+ if (__pyx_t_14 < 0) __pyx_t_14 += __pyx_pybuffernd_isSeed.diminfo[0].shape;
+ *__Pyx_BufPtrStrided1d(__pyx_t_3ml3_DTYPE_t *, __pyx_pybuffernd_isSeed.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_isSeed.diminfo[0].strides) = 0.0;
+
+ /* "ml3.pyx":60
+ * if prob > -19.523275053840013:
+ * isSeed[i] = 0
+ * probs[i] += prob # <<<<<<<<<<<<<<
* parent_dists[i] = dists[l]
* parent_dts[i] = dts[l]
*/
- __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_v_prob); if (unlikely((__pyx_t_23 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_t_30 = __pyx_v_i;
- if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_pybuffernd_probs.diminfo[0].shape;
- *__Pyx_BufPtrStrided1d(__pyx_t_3ml3_DTYPE_t *, __pyx_pybuffernd_probs.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_probs.diminfo[0].strides) = __pyx_t_23;
+ __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 = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_29 = __pyx_v_i;
+ if (__pyx_t_29 < 0) __pyx_t_29 += __pyx_pybuffernd_probs.diminfo[0].shape;
+ *__Pyx_BufPtrStrided1d(__pyx_t_3ml3_DTYPE_t *, __pyx_pybuffernd_probs.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_probs.diminfo[0].strides) += __pyx_t_24;
- /* "ml3.pyx":59
- * if prob > probs[i]:
- * probs[i] = prob
+ /* "ml3.pyx":61
+ * isSeed[i] = 0
+ * probs[i] += prob
* parent_dists[i] = dists[l] # <<<<<<<<<<<<<<
* parent_dts[i] = dts[l]
* # probs_fail[i] = failures[l]
*/
- __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_dists, __pyx_v_l, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_dists, __pyx_v_l, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_23 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_31 = __pyx_v_i;
- if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_pybuffernd_parent_dists.diminfo[0].shape;
- *__Pyx_BufPtrStrided1d(__pyx_t_3ml3_DTYPE_t *, __pyx_pybuffernd_parent_dists.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_parent_dists.diminfo[0].strides) = __pyx_t_23;
+ __pyx_t_30 = __pyx_v_i;
+ if (__pyx_t_30 < 0) __pyx_t_30 += __pyx_pybuffernd_parent_dists.diminfo[0].shape;
+ *__Pyx_BufPtrStrided1d(__pyx_t_3ml3_DTYPE_t *, __pyx_pybuffernd_parent_dists.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_parent_dists.diminfo[0].strides) = __pyx_t_24;
- /* "ml3.pyx":60
- * probs[i] = prob
+ /* "ml3.pyx":62
+ * probs[i] += prob
* parent_dists[i] = dists[l]
* parent_dts[i] = dts[l] # <<<<<<<<<<<<<<
* # probs_fail[i] = failures[l]
*
*/
- __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_dts, __pyx_v_l, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __pyx_t_3 = __Pyx_GetItemInt_List(__pyx_v_dts, __pyx_v_l, int, 1, __Pyx_PyInt_From_int, 1, 1, 0); if (unlikely(__pyx_t_3 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_23 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_32 = __pyx_v_i;
- if (__pyx_t_32 < 0) __pyx_t_32 += __pyx_pybuffernd_parent_dts.diminfo[0].shape;
- *__Pyx_BufPtrStrided1d(__pyx_t_3ml3_DTYPE_t *, __pyx_pybuffernd_parent_dts.rcbuffer->pybuffer.buf, __pyx_t_32, __pyx_pybuffernd_parent_dts.diminfo[0].strides) = __pyx_t_23;
+ __pyx_t_31 = __pyx_v_i;
+ if (__pyx_t_31 < 0) __pyx_t_31 += __pyx_pybuffernd_parent_dts.diminfo[0].shape;
+ *__Pyx_BufPtrStrided1d(__pyx_t_3ml3_DTYPE_t *, __pyx_pybuffernd_parent_dts.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_parent_dts.diminfo[0].strides) = __pyx_t_24;
goto __pyx_L23;
}
__pyx_L23:;
- /* "ml3.pyx":55
+ /* "ml3.pyx":56
* # probs[i] = max(s - failures[l] for l, s in enumerate(successes))
- * probs[i] = float("-inf")
+ * # probs[i] = 0.
* for l, s in enumerate(successes): # <<<<<<<<<<<<<<
* prob = s - failures[l]
- * if prob > probs[i]:
+ * if prob > -19.523275053840013:
*/
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- /* "ml3.pyx":64
+ /* "ml3.pyx":66
*
* # calculate log likelihood
- * ll = probs_fail.sum() # add probability that all edges to all victims fail # <<<<<<<<<<<<<<
+ * ll = probs_fail.sum() # add probability that all edges to all victims fail # <<<<<<<<<<<<<<
*
* # print 'probs', probs
*/
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_probs_fail), __pyx_n_s_sum); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_probs_fail), __pyx_n_s_sum); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = NULL;
if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_5))) {
@@ -2552,157 +2603,151 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
}
}
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 = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
} else {
- __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __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 = 66; __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_23 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_23 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_v_ll = __pyx_t_23;
+ __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_ll = __pyx_t_24;
- /* "ml3.pyx":67
+ /* "ml3.pyx":69
*
* # print 'probs', probs
* max_beta_add = float('-inf') # <<<<<<<<<<<<<<
* # iterate over all victim nodes to find the optimal threshold
- * for beta in np.arange(0.2, 1., .1):
+ * for beta in np.arange(0.00001, 1., 1.):
*/
- __pyx_t_27 = __Pyx_PyObject_AsDouble(__pyx_kp_s_inf); if (unlikely(__pyx_t_27 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_v_max_beta_add = __pyx_t_27;
+ __pyx_t_32 = __Pyx_PyObject_AsDouble(__pyx_kp_s_inf); if (unlikely(__pyx_t_32 == ((double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_v_max_beta_add = __pyx_t_32;
- /* "ml3.pyx":69
+ /* "ml3.pyx":71
* max_beta_add = float('-inf')
* # iterate over all victim nodes to find the optimal threshold
- * for beta in np.arange(0.2, 1., .1): # <<<<<<<<<<<<<<
+ * for beta in np.arange(0.00001, 1., 1.): # <<<<<<<<<<<<<<
* thresh = log(beta/(3012.*(1.-beta)))
- * seeds = probs<thresh
+ * seeds = isSeed==1
*/
- __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_arange); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __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 = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_arange); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __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_PyObject_Call(__pyx_t_5, __pyx_tuple_, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
- if (likely(PyList_CheckExact(__pyx_t_6)) || PyTuple_CheckExact(__pyx_t_6)) {
- __pyx_t_5 = __pyx_t_6; __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
+ if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
+ __pyx_t_5 = __pyx_t_4; __Pyx_INCREF(__pyx_t_5); __pyx_t_1 = 0;
__pyx_t_33 = NULL;
} else {
- __pyx_t_1 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_1 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_33 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_33 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
for (;;) {
if (likely(!__pyx_t_33)) {
if (likely(PyList_CheckExact(__pyx_t_5))) {
if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_5)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
} else {
if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
#if CYTHON_COMPILING_IN_CPYTHON
- __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_6); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#else
- __pyx_t_6 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = PySequence_ITEM(__pyx_t_5, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
#endif
}
} else {
- __pyx_t_6 = __pyx_t_33(__pyx_t_5);
- if (unlikely(!__pyx_t_6)) {
+ __pyx_t_4 = __pyx_t_33(__pyx_t_5);
+ if (unlikely(!__pyx_t_4)) {
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 = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
break;
}
- __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_GOTREF(__pyx_t_4);
}
- __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_23 == (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_v_beta = __pyx_t_23;
+ __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_v_beta = __pyx_t_24;
- /* "ml3.pyx":70
+ /* "ml3.pyx":72
* # iterate over all victim nodes to find the optimal threshold
- * for beta in np.arange(0.2, 1., .1):
+ * for beta in np.arange(0.00001, 1., 1.):
* thresh = log(beta/(3012.*(1.-beta))) # <<<<<<<<<<<<<<
- * seeds = probs<thresh
- * non_seeds = probs>=thresh
+ * seeds = isSeed==1
+ * non_seeds = isSeed==0
*/
__pyx_v_thresh = log((__pyx_v_beta / (3012. * (1. - __pyx_v_beta))));
- /* "ml3.pyx":71
- * for beta in np.arange(0.2, 1., .1):
+ /* "ml3.pyx":73
+ * for beta in np.arange(0.00001, 1., 1.):
* thresh = log(beta/(3012.*(1.-beta)))
- * seeds = probs<thresh # <<<<<<<<<<<<<<
- * non_seeds = probs>=thresh
+ * seeds = isSeed==1 # <<<<<<<<<<<<<<
+ * non_seeds = isSeed==0
* roots = n_roots + sum(seeds)
*/
- __pyx_t_6 = PyFloat_FromDouble(__pyx_v_thresh); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_3 = PyObject_RichCompare(((PyObject *)__pyx_v_probs), __pyx_t_6, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __Pyx_XDECREF_SET(__pyx_v_seeds, __pyx_t_3);
- __pyx_t_3 = 0;
+ __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_isSeed), __pyx_int_1, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_XDECREF_SET(__pyx_v_seeds, __pyx_t_4);
+ __pyx_t_4 = 0;
- /* "ml3.pyx":72
+ /* "ml3.pyx":74
* thresh = log(beta/(3012.*(1.-beta)))
- * seeds = probs<thresh
- * non_seeds = probs>=thresh # <<<<<<<<<<<<<<
+ * seeds = isSeed==1
+ * non_seeds = isSeed==0 # <<<<<<<<<<<<<<
* roots = n_roots + sum(seeds)
*
*/
- __pyx_t_3 = PyFloat_FromDouble(__pyx_v_thresh); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = PyObject_RichCompare(((PyObject *)__pyx_v_probs), __pyx_t_3, Py_GE); __Pyx_XGOTREF(__pyx_t_6); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_XDECREF_SET(__pyx_v_non_seeds, __pyx_t_6);
- __pyx_t_6 = 0;
+ __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_isSeed), __pyx_int_0, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_XDECREF_SET(__pyx_v_non_seeds, __pyx_t_4);
+ __pyx_t_4 = 0;
- /* "ml3.pyx":73
- * seeds = probs<thresh
- * non_seeds = probs>=thresh
+ /* "ml3.pyx":75
+ * seeds = isSeed==1
+ * non_seeds = isSeed==0
* roots = n_roots + sum(seeds) # <<<<<<<<<<<<<<
*
* beta_add = 0.
*/
- __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_n_roots); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_4 = __Pyx_PyInt_From_int(__pyx_v_n_roots); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_3 = PyTuple_New(1); 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);
__Pyx_INCREF(__pyx_v_seeds);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_seeds);
__Pyx_GIVEREF(__pyx_v_seeds);
- __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_sum, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_sum, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_6); 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);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
__Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_11 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_11 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_12 = __Pyx_PyInt_As_int(__pyx_t_3); if (unlikely((__pyx_t_12 == (int)-1) && PyErr_Occurred())) {__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_v_roots = __pyx_t_11;
+ __pyx_v_roots = __pyx_t_12;
- /* "ml3.pyx":75
+ /* "ml3.pyx":77
* roots = n_roots + sum(seeds)
*
* beta_add = 0. # <<<<<<<<<<<<<<
- * # add probability to say that parents of seeds did not try to infect them
- * # beta_add -= (probs_fail[seeds]).sum()
+ * # add probability for realized edges and subtract probability these edges fail
+ * beta_add += (probs[non_seeds]).sum()
*/
__pyx_v_beta_add = 0.;
/* "ml3.pyx":79
- * # beta_add -= (probs_fail[seeds]).sum()
+ * beta_add = 0.
* # add probability for realized edges and subtract probability these edges fail
* beta_add += (probs[non_seeds]).sum() # <<<<<<<<<<<<<<
* # add probability for the seeds and non-seeds
@@ -2710,36 +2755,36 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
*/
__pyx_t_3 = PyFloat_FromDouble(__pyx_v_beta_add); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_probs), __pyx_v_non_seeds); if (unlikely(__pyx_t_6 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
- __Pyx_GOTREF(__pyx_t_6);
- __pyx_t_15 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_sum); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
- __pyx_t_6 = NULL;
- if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_15))) {
- __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_15);
- if (likely(__pyx_t_6)) {
- PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_15);
- __Pyx_INCREF(__pyx_t_6);
+ __pyx_t_4 = PyObject_GetItem(((PyObject *)__pyx_v_probs), __pyx_v_non_seeds); if (unlikely(__pyx_t_4 == NULL)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;};
+ __Pyx_GOTREF(__pyx_t_4);
+ __pyx_t_16 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_sum); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __pyx_t_4 = NULL;
+ if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_16))) {
+ __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_16);
+ if (likely(__pyx_t_4)) {
+ PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_16);
+ __Pyx_INCREF(__pyx_t_4);
__Pyx_INCREF(function);
- __Pyx_DECREF_SET(__pyx_t_15, function);
+ __Pyx_DECREF_SET(__pyx_t_16, function);
}
}
- if (__pyx_t_6) {
- __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_15, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ if (__pyx_t_4) {
+ __pyx_t_6 = __Pyx_PyObject_CallOneArg(__pyx_t_16, __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
} else {
- __pyx_t_4 = __Pyx_PyObject_CallNoArg(__pyx_t_15); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_6 = __Pyx_PyObject_CallNoArg(__pyx_t_16); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
}
- __Pyx_GOTREF(__pyx_t_4);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __pyx_t_15 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
+ __Pyx_GOTREF(__pyx_t_6);
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_t_16 = PyNumber_InPlaceAdd(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
- __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_15); if (unlikely((__pyx_t_23 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
- __pyx_v_beta_add = __pyx_t_23;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_16); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
+ __pyx_v_beta_add = __pyx_t_24;
/* "ml3.pyx":81
* beta_add += (probs[non_seeds]).sum()
@@ -2748,35 +2793,35 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
*
* if beta_add > max_beta_add:
*/
- __pyx_t_15 = PyFloat_FromDouble(__pyx_v_beta_add); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- __pyx_t_4 = PyFloat_FromDouble((__pyx_v_roots * log((__pyx_v_beta / 3012.)))); 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_16 = PyFloat_FromDouble(__pyx_v_beta_add); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_6 = PyFloat_FromDouble((__pyx_v_roots * log((__pyx_v_beta / 3012.)))); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_6);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
__Pyx_INCREF(__pyx_v_non_seeds);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_non_seeds);
__Pyx_GIVEREF(__pyx_v_non_seeds);
- __pyx_t_6 = __Pyx_PyObject_Call(__pyx_builtin_sum, __pyx_t_3, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_6);
+ __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_sum, __pyx_t_3, NULL); 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_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_3 = PyFloat_FromDouble(log((1. - __pyx_v_beta))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_16 = PyNumber_Multiply(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __pyx_t_17 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_17);
+ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_3 = PyNumber_Add(__pyx_t_4, __pyx_t_16); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_t_17); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
+ __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
+ __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
+ __pyx_t_17 = PyNumber_InPlaceAdd(__pyx_t_16, __pyx_t_3); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_17);
__Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- __pyx_t_16 = PyNumber_InPlaceAdd(__pyx_t_15, __pyx_t_3); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
- __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0;
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
- __pyx_t_23 = __pyx_PyFloat_AsDouble(__pyx_t_16); if (unlikely((__pyx_t_23 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_DECREF(__pyx_t_16); __pyx_t_16 = 0;
- __pyx_v_beta_add = __pyx_t_23;
+ __pyx_t_24 = __pyx_PyFloat_AsDouble(__pyx_t_17); if (unlikely((__pyx_t_24 == (npy_double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_DECREF(__pyx_t_17); __pyx_t_17 = 0;
+ __pyx_v_beta_add = __pyx_t_24;
/* "ml3.pyx":83
* beta_add += roots * log(beta/3012.) + sum(non_seeds) * log(1. - beta)
@@ -2785,8 +2830,8 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
* max_beta = beta
* max_roots = roots
*/
- __pyx_t_29 = ((__pyx_v_beta_add > __pyx_v_max_beta_add) != 0);
- if (__pyx_t_29) {
+ __pyx_t_28 = ((__pyx_v_beta_add > __pyx_v_max_beta_add) != 0);
+ if (__pyx_t_28) {
/* "ml3.pyx":84
*
@@ -2818,12 +2863,12 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
}
__pyx_L26:;
- /* "ml3.pyx":69
+ /* "ml3.pyx":71
* max_beta_add = float('-inf')
* # iterate over all victim nodes to find the optimal threshold
- * for beta in np.arange(0.2, 1., .1): # <<<<<<<<<<<<<<
+ * for beta in np.arange(0.00001, 1., 1.): # <<<<<<<<<<<<<<
* thresh = log(beta/(3012.*(1.-beta)))
- * seeds = probs<thresh
+ * seeds = isSeed==1
*/
}
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
@@ -2863,23 +2908,23 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
__Pyx_XDECREF(__pyx_r);
__pyx_t_5 = PyFloat_FromDouble(__pyx_v_beta); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_5);
- __pyx_t_16 = __Pyx_PyInt_From_int(__pyx_v_roots); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_16);
+ __pyx_t_17 = __Pyx_PyInt_From_int(__pyx_v_roots); if (unlikely(!__pyx_t_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_17);
__pyx_t_3 = PyFloat_FromDouble(__pyx_v_ll); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_t_3);
- __pyx_t_15 = PyTuple_New(3); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __Pyx_GOTREF(__pyx_t_15);
- PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_5);
+ __pyx_t_16 = PyTuple_New(3); if (unlikely(!__pyx_t_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __Pyx_GOTREF(__pyx_t_16);
+ PyTuple_SET_ITEM(__pyx_t_16, 0, __pyx_t_5);
__Pyx_GIVEREF(__pyx_t_5);
- PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_16);
- __Pyx_GIVEREF(__pyx_t_16);
- PyTuple_SET_ITEM(__pyx_t_15, 2, __pyx_t_3);
+ PyTuple_SET_ITEM(__pyx_t_16, 1, __pyx_t_17);
+ __Pyx_GIVEREF(__pyx_t_17);
+ PyTuple_SET_ITEM(__pyx_t_16, 2, __pyx_t_3);
__Pyx_GIVEREF(__pyx_t_3);
__pyx_t_5 = 0;
- __pyx_t_16 = 0;
+ __pyx_t_17 = 0;
__pyx_t_3 = 0;
- __pyx_r = __pyx_t_15;
- __pyx_t_15 = 0;
+ __pyx_r = __pyx_t_16;
+ __pyx_t_16 = 0;
goto __pyx_L0;
/* "ml3.pyx":27
@@ -2896,14 +2941,15 @@ static PyObject *__pyx_pf_3ml3_ml3(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_15);
__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);
{ PyObject *__pyx_type, *__pyx_value, *__pyx_tb;
__Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb);
+ __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_isSeed.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);
@@ -2913,6 +2959,7 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
__pyx_r = NULL;
goto __pyx_L2;
__pyx_L0:;
+ __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_isSeed.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);
@@ -2925,6 +2972,7 @@ static PyObject *__pyx_pf_3ml3_ml3(CYTHON_UNUSED PyObject *__pyx_self, PyObject
__Pyx_XDECREF((PyObject *)__pyx_v_probs_fail);
__Pyx_XDECREF((PyObject *)__pyx_v_parent_dists);
__Pyx_XDECREF((PyObject *)__pyx_v_parent_dts);
+ __Pyx_XDECREF((PyObject *)__pyx_v_isSeed);
__Pyx_XDECREF(__pyx_v_dists);
__Pyx_XDECREF(__pyx_v_dts);
__Pyx_XDECREF(__pyx_v_s);
@@ -4988,6 +5036,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{&__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_isSeed, __pyx_k_isSeed, sizeof(__pyx_k_isSeed), 0, 0, 1, 1},
{&__pyx_n_s_itervalues, __pyx_k_itervalues, sizeof(__pyx_k_itervalues), 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},
@@ -5004,6 +5053,7 @@ 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_ones, __pyx_k_ones, sizeof(__pyx_k_ones), 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},
@@ -5029,8 +5079,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = {
{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 = 41; __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 = 47; __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 = 42; __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 = 48; __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;}
@@ -5043,14 +5093,14 @@ static int __Pyx_InitCachedConstants(void) {
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0);
- /* "ml3.pyx":69
+ /* "ml3.pyx":71
* max_beta_add = float('-inf')
* # iterate over all victim nodes to find the optimal threshold
- * for beta in np.arange(0.2, 1., .1): # <<<<<<<<<<<<<<
+ * for beta in np.arange(0.00001, 1., 1.): # <<<<<<<<<<<<<<
* thresh = log(beta/(3012.*(1.-beta)))
- * seeds = probs<thresh
+ * seeds = isSeed==1
*/
- __pyx_tuple_ = PyTuple_Pack(3, __pyx_float_0_2, __pyx_float_1_, __pyx_float__1); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple_ = PyTuple_Pack(3, __pyx_float_0_00001, __pyx_float_1_, __pyx_float_1_); if (unlikely(!__pyx_tuple_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple_);
__Pyx_GIVEREF(__pyx_tuple_);
@@ -5127,10 +5177,10 @@ static int __Pyx_InitCachedConstants(void) {
* DTYPE_t alpha, DTYPE_t delta):
* cdef:
*/
- __pyx_tuple__8 = PyTuple_Pack(37, __pyx_n_s_root_victims, __pyx_n_s_victims, __pyx_n_s_non_victims, __pyx_n_s_age, __pyx_n_s_alpha, __pyx_n_s_delta, __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_beta, __pyx_n_s_ll, __pyx_n_s_beta_add, __pyx_n_s_max_beta, __pyx_n_s_max_beta_add, __pyx_n_s_parents, __pyx_n_s_failures, __pyx_n_s_successes, __pyx_n_s_probs, __pyx_n_s_probs_fail, __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_thresh, __pyx_n_s_seeds, __pyx_n_s_non_seeds, __pyx_n_s_max_roots, __pyx_n_s_w1, __pyx_n_s_w2, __pyx_n_s_w3); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_tuple__8 = PyTuple_Pack(38, __pyx_n_s_root_victims, __pyx_n_s_victims, __pyx_n_s_non_victims, __pyx_n_s_age, __pyx_n_s_alpha, __pyx_n_s_delta, __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_beta, __pyx_n_s_ll, __pyx_n_s_beta_add, __pyx_n_s_max_beta, __pyx_n_s_max_beta_add, __pyx_n_s_parents, __pyx_n_s_failures, __pyx_n_s_successes, __pyx_n_s_probs, __pyx_n_s_probs_fail, __pyx_n_s_parent_dists, __pyx_n_s_parent_dts, __pyx_n_s_isSeed, __pyx_n_s_dists, __pyx_n_s_dts, __pyx_n_s_s, __pyx_n_s_prob, __pyx_n_s_thresh, __pyx_n_s_seeds, __pyx_n_s_non_seeds, __pyx_n_s_max_roots, __pyx_n_s_w1, __pyx_n_s_w2, __pyx_n_s_w3); if (unlikely(!__pyx_tuple__8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_GOTREF(__pyx_tuple__8);
__Pyx_GIVEREF(__pyx_tuple__8);
- __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(6, 0, 37, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ben_Documents_Cascade_Pro, __pyx_n_s_ml3, 27, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_codeobj__9 = (PyObject*)__Pyx_PyCode_New(6, 0, 38, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__8, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_Users_ben_Documents_Cascade_Pro, __pyx_n_s_ml3, 27, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__Pyx_RefNannyFinishContext();
return 0;
__pyx_L1_error:;
@@ -5140,9 +5190,11 @@ 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_float__1 = PyFloat_FromDouble(.1); if (unlikely(!__pyx_float__1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
__pyx_float_1_ = PyFloat_FromDouble(1.); if (unlikely(!__pyx_float_1_)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
- __pyx_float_0_2 = PyFloat_FromDouble(0.2); if (unlikely(!__pyx_float_0_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_float_0_00001 = PyFloat_FromDouble(0.00001); if (unlikely(!__pyx_float_0_00001)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_float_neg_19_523275053840013 = PyFloat_FromDouble(-19.523275053840013); if (unlikely(!__pyx_float_neg_19_523275053840013)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+ __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_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;}
return 0;
__pyx_L1_error:;
return -1;
@@ -6412,45 +6464,6 @@ static CYTHON_INLINE int __Pyx_dict_iter_next(PyObject* iter_obj, Py_ssize_t ori
return 1;
}
-static double __Pyx__PyObject_AsDouble(PyObject* obj) {
- PyObject* float_value;
-#if CYTHON_COMPILING_IN_PYPY
- float_value = PyNumber_Float(obj);
-#else
- PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
- if (likely(nb) && likely(nb->nb_float)) {
- float_value = nb->nb_float(obj);
- if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
- PyErr_Format(PyExc_TypeError,
- "__float__ returned non-float (type %.200s)",
- Py_TYPE(float_value)->tp_name);
- Py_DECREF(float_value);
- goto bad;
- }
- } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
-#if PY_MAJOR_VERSION >= 3
- float_value = PyFloat_FromString(obj);
-#else
- float_value = PyFloat_FromString(obj, 0);
-#endif
- } else {
- PyObject* args = PyTuple_New(1);
- if (unlikely(!args)) goto bad;
- PyTuple_SET_ITEM(args, 0, obj);
- float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
- PyTuple_SET_ITEM(args, 0, 0);
- Py_DECREF(args);
- }
-#endif
- if (likely(float_value)) {
- double value = PyFloat_AS_DOUBLE(float_value);
- Py_DECREF(float_value);
- return value;
- }
-bad:
- return (double)-1;
-}
-
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) {
PyObject *r;
if (!j) return NULL;
@@ -6529,6 +6542,45 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
}
+static double __Pyx__PyObject_AsDouble(PyObject* obj) {
+ PyObject* float_value;
+#if CYTHON_COMPILING_IN_PYPY
+ float_value = PyNumber_Float(obj);
+#else
+ PyNumberMethods *nb = Py_TYPE(obj)->tp_as_number;
+ if (likely(nb) && likely(nb->nb_float)) {
+ float_value = nb->nb_float(obj);
+ if (likely(float_value) && unlikely(!PyFloat_Check(float_value))) {
+ PyErr_Format(PyExc_TypeError,
+ "__float__ returned non-float (type %.200s)",
+ Py_TYPE(float_value)->tp_name);
+ Py_DECREF(float_value);
+ goto bad;
+ }
+ } else if (PyUnicode_CheckExact(obj) || PyBytes_CheckExact(obj)) {
+#if PY_MAJOR_VERSION >= 3
+ float_value = PyFloat_FromString(obj);
+#else
+ float_value = PyFloat_FromString(obj, 0);
+#endif
+ } else {
+ PyObject* args = PyTuple_New(1);
+ if (unlikely(!args)) goto bad;
+ PyTuple_SET_ITEM(args, 0, obj);
+ float_value = PyObject_Call((PyObject*)&PyFloat_Type, args, 0);
+ PyTuple_SET_ITEM(args, 0, 0);
+ Py_DECREF(args);
+ }
+#endif
+ if (likely(float_value)) {
+ double value = PyFloat_AS_DOUBLE(float_value);
+ Py_DECREF(float_value);
+ return value;
+ }
+bad:
+ return (double)-1;
+}
+
static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) {
#if CYTHON_COMPILING_IN_CPYTHON
PyObject *tmp_type, *tmp_value, *tmp_tb;
diff --git a/experiments/ml3.pyx b/experiments/ml3.pyx
index 49b24cf..faeda92 100644
--- a/experiments/ml3.pyx
+++ b/experiments/ml3.pyx
@@ -36,6 +36,7 @@ def ml3(dict root_victims, dict victims, dict non_victims, DTYPE_t age,
np.ndarray[DTYPE_t] probs_fail = np.zeros(n_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] isSeed = np.ones(n_victims, dtype=DTYPE)
# loop through victims
for i, parents in enumerate(victims.itervalues()):
@@ -51,25 +52,26 @@ def ml3(dict root_victims, dict victims, dict non_victims, DTYPE_t age,
dts = [dt for (dist, dt, w1, w2, w3) in parents]
# find parent that maximizes log(p) - log(\tilde{p})
# probs[i] = max(s - failures[l] for l, s in enumerate(successes))
- probs[i] = float("-inf")
+ # probs[i] = 0.
for l, s in enumerate(successes):
prob = s - failures[l]
- if prob > probs[i]:
- probs[i] = prob
+ if prob > -19.523275053840013:
+ isSeed[i] = 0
+ probs[i] += prob
parent_dists[i] = dists[l]
parent_dts[i] = dts[l]
# probs_fail[i] = failures[l]
# calculate log likelihood
- ll = probs_fail.sum() # add probability that all edges to all victims fail
+ ll = probs_fail.sum() # add probability that all edges to all victims fail
# print 'probs', probs
max_beta_add = float('-inf')
# iterate over all victim nodes to find the optimal threshold
- for beta in np.arange(0.2, 1., .1):
+ for beta in np.arange(0.00001, 1., 1.):
thresh = log(beta/(3012.*(1.-beta)))
- seeds = probs<thresh
- non_seeds = probs>=thresh
+ seeds = isSeed==1
+ non_seeds = isSeed==0
roots = n_roots + sum(seeds)
beta_add = 0.
diff --git a/experiments/ml3.so b/experiments/ml3.so
index ff3bf05..2dd1f2d 100755
--- a/experiments/ml3.so
+++ b/experiments/ml3.so
Binary files differ
diff --git a/experiments/out.log b/experiments/out.log
index eb2c025..dbc6e69 100644
--- a/experiments/out.log
+++ b/experiments/out.log
@@ -1,100 +1,180 @@
-0.001 0.01 0.9 11270 -91523.5870424
-0.001 0.0162596469388 0.9 11270 -91565.5369996
-0.001 0.0264376118575 0.9 11270 -91642.6191169
-0.001 0.0429866234708 0.9 11270 -91794.9085171
-0.001 0.0698947320727 0.9 11270 -92128.8835388
-0.001 0.113646366639 0.9 11270 -92965.5190312
-0.001 0.184784979742 0.9 11270 -95386.8510621
-0.001 0.30045385302 0.9 11270 -103403.123173
-0.001 0.488527357152 0.9 11270 -133489.114715
-0.001 0.794328234724 0.2 1081 -269549.85751
-0.00210001415571 0.01 0.9 11270 -91549.0398969
-0.00210001415571 0.0162596469388 0.9 11270 -91608.9392339
-0.00210001415571 0.0264376118575 0.9 11270 -91718.9499636
-0.00210001415571 0.0429866234708 0.9 11270 -91936.0972211
-0.00210001415571 0.0698947320727 0.9 11270 -92411.5963962
-0.00210001415571 0.113646366639 0.9 11270 -93600.4835423
-0.00210001415571 0.184784979742 0.9 11270 -97036.0559331
-0.00210001415571 0.30045385302 0.9 11270 -108420.798127
-0.00210001415571 0.488527357152 0.9 11270 -151592.592656
-0.00210001415571 0.794328234724 0.2 1107 -355093.565328
-0.00441005945418 0.01 0.9 11270 -91569.3379363
-0.00441005945418 0.0162596469388 0.9 11270 -91643.4969567
-0.00441005945418 0.0264376118575 0.9 11270 -91779.5685522
-0.00441005945418 0.0429866234708 0.9 11270 -92047.755834
-0.00441005945418 0.0698947320727 0.9 11270 -92633.7707234
-0.00441005945418 0.113646366639 0.9 11270 -94095.2794735
-0.00441005945418 0.184784979742 0.9 11270 -98309.4445937
-0.00441005945418 0.30045385302 0.9 11270 -112268.842806
-0.00441005945418 0.488527357152 0.2 1474 -161614.876299
-0.00441005945418 0.794328234724 0.2 1211 -423573.226057
-0.00926118728129 0.01 0.9 11270 -91582.097857
-0.00926118728129 0.0162596469388 0.9 11270 -91665.1812708
-0.00926118728129 0.0264376118575 0.9 11270 -91817.4930301
-0.00926118728129 0.0429866234708 0.9 11270 -92117.2856217
-0.00926118728129 0.0698947320727 0.9 11270 -92771.1561099
-0.00926118728129 0.113646366639 0.9 11270 -94398.4223619
-0.00926118728129 0.184784979742 0.9 11270 -99081.6655999
-0.00926118728129 0.30045385302 0.9 11270 -114582.48041
-0.00926118728129 0.488527357152 0.2 1793 -166203.470861
-0.00926118728129 0.794328234724 0.2 1423 -464281.110986
-0.0194486243894 0.01 0.9 11270 -91589.1566432
-0.0194486243894 0.0162596469388 0.9 11270 -91677.1565448
-0.0194486243894 0.0264376118575 0.9 11270 -91838.3798994
-0.0194486243894 0.0429866234708 0.9 11270 -92155.4170802
-0.0194486243894 0.0698947320727 0.9 11270 -92846.0360004
-0.0194486243894 0.113646366639 0.9 11270 -94562.3188477
-0.0194486243894 0.184784979742 0.9 11091 -99479.0420841
-0.0194486243894 0.30045385302 0.9 10696 -115604.07263
-0.0194486243894 0.488527357152 0.2 2313 -168219.323905
-0.0194486243894 0.794328234724 0.2 1874 -485475.711599
-0.0408423865267 0.01 0.9 11270 -91592.918457
-0.0408423865267 0.0162596469388 0.9 11270 -91683.5297704
-0.0408423865267 0.0264376118575 0.9 11270 -91849.4717525
-0.0408423865267 0.0429866234708 0.9 11270 -92175.5988872
-0.0408423865267 0.0698947320727 0.9 11270 -92885.4758244
-0.0408423865267 0.113646366639 0.9 11091 -94607.5509898
-0.0408423865267 0.184784979742 0.9 10920 -99533.2715965
-0.0408423865267 0.30045385302 0.4 4653 -115165.025542
-0.0408423865267 0.488527357152 0.3 3250 -169701.162437
-0.0408423865267 0.794328234724 0.2 2551 -497252.401069
-0.0857695898591 0.01 0.9 11270 -91594.8449918
-0.0857695898591 0.0162596469388 0.9 11270 -91686.7925519
-0.0857695898591 0.0264376118575 0.9 11270 -91855.1468545
-0.0857695898591 0.0429866234708 0.9 11220 -92181.6530585
-0.0857695898591 0.0698947320727 0.9 11134 -92859.3457513
-0.0857695898591 0.113646366639 0.9 11035 -94556.8958805
-0.0857695898591 0.184784979742 0.9 10980 -99546.3858189
-0.0857695898591 0.30045385302 0.5 5934 -114797.582709
-0.0857695898591 0.488527357152 0.4 4571 -171639.667412
-0.0857695898591 0.794328234724 0.3 3611 -505504.435206
-0.180117352833 0.01 0.9 11270 -91595.798042
-0.180117352833 0.0162596469388 0.9 11270 -91688.4072416
-0.180117352833 0.0264376118575 0.9 11220 -91848.0602501
-0.180117352833 0.0429866234708 0.9 11189 -92148.3380166
-0.180117352833 0.0698947320727 0.9 11153 -92822.3461559
-0.180117352833 0.113646366639 0.9 11107 -94544.0599077
-0.180117352833 0.184784979742 0.9 10762 -99484.0075654
-0.180117352833 0.30045385302 0.7 7800 -114745.998069
-0.180117352833 0.488527357152 0.6 6367 -174044.07246
-0.180117352833 0.794328234724 0.5 5220 -512564.399314
-0.378248990639 0.01 0.9 11252 -91595.2710428
-0.378248990639 0.0162596469388 0.9 11240 -91677.3958133
-0.378248990639 0.0264376118575 0.9 11220 -91827.1066696
-0.378248990639 0.0429866234708 0.9 11189 -92129.1165997
-0.378248990639 0.0698947320727 0.9 11180 -92813.7501975
-0.378248990639 0.113646366639 0.9 11085 -94541.0130047
-0.378248990639 0.184784979742 0.9 10835 -99445.5569634
-0.378248990639 0.30045385302 0.8 8991 -114979.385412
-0.378248990639 0.488527357152 0.7 7814 -176288.205939
-0.378248990639 0.794328234724 0.6 6818 -518633.486957
-0.794328234724 0.01 0.9 11252 -91585.4894658
-0.794328234724 0.0162596469388 0.9 11240 -91666.0412529
-0.794328234724 0.0264376118575 0.9 11220 -91821.4045302
-0.794328234724 0.0429866234708 0.9 11220 -92131.2319205
-0.794328234724 0.0698947320727 0.9 11203 -92829.9697857
-0.794328234724 0.113646366639 0.9 11032 -94518.9825954
-0.794328234724 0.184784979742 0.9 10535 -99409.3300157
-0.794328234724 0.30045385302 0.9 9821 -115311.500132
-0.794328234724 0.488527357152 0.8 8920 -178215.065651
-0.794328234724 0.794328234724 0.7 8277 -523497.864977
+0.001 0.0001 1e-05 6478 -334195.43339
+0.001 0.000145977430289 1e-05 6478 -329534.623319
+0.001 0.000213094101537 1e-05 6478 -324873.813745
+0.001 0.00031106929352 1e-05 6478 -320213.005232
+0.001 0.000454090961097 1e-05 6478 -315552.198982
+0.001 0.000662870316183 1e-05 6478 -310891.397565
+0.001 0.000967641053709 1e-05 6478 -306230.606477
+0.001 0.00141253754462 1e-05 6478 -301569.837498
+0.001 0.0020619860095 1e-05 4272 -583246.118462
+0.001 0.00301003418958 1e-05 3062 -1265123.26313
+0.001 0.00439397056076 1e-05 2843 -1588685.48614
+0.001 0.00641420531224 1e-05 2792 -1655439.60974
+0.001 0.00936329208824 1e-05 2792 -1600021.6221
+0.001 0.0136682931808 1e-05 2792 -1533516.68277
+0.001 0.0199526231497 1e-05 1178 -6992776.22453
+0.00163789370695 0.0001 1e-05 6503 -331657.971483
+0.00163789370695 0.000145977430289 1e-05 6487 -328611.450608
+0.00163789370695 0.000213094101537 1e-05 6478 -324561.337257
+0.00163789370695 0.00031106929352 1e-05 6478 -319959.244302
+0.00163789370695 0.000454090961097 1e-05 6478 -315298.439239
+0.00163789370695 0.000662870316183 1e-05 6478 -310637.640354
+0.00163789370695 0.000967641053709 1e-05 6478 -305976.854677
+0.00163789370695 0.00141253754462 1e-05 6478 -301316.097265
+0.00163789370695 0.0020619860095 1e-05 3613 -815669.251375
+0.00163789370695 0.00301003418958 1e-05 3103 -1191738.90138
+0.00163789370695 0.00439397056076 1e-05 2911 -1423048.07525
+0.00163789370695 0.00641420531224 1e-05 2832 -1549219.12447
+0.00163789370695 0.00936329208824 1e-05 2799 -1572581.12089
+0.00163789370695 0.0136682931808 1e-05 1767 -2649628.9287
+0.00163789370695 0.0199526231497 1e-05 1186 -6743799.30751
+0.00268269579528 0.0001 1e-05 6665 -316416.139113
+0.00268269579528 0.000145977430289 1e-05 6616 -316822.42361
+0.00268269579528 0.000213094101537 1e-05 6566 -316593.72542
+0.00268269579528 0.00031106929352 1e-05 6539 -315110.6579
+0.00268269579528 0.000454090961097 1e-05 6520 -313502.590841
+0.00268269579528 0.000662870316183 1e-05 6508 -311366.277334
+0.00268269579528 0.000967641053709 1e-05 6495 -308021.225367
+0.00268269579528 0.00141253754462 1e-05 4598 -511697.666228
+0.00268269579528 0.0020619860095 1e-05 3599 -820110.606026
+0.00268269579528 0.00301003418958 1e-05 3246 -1052017.77829
+0.00268269579528 0.00439397056076 1e-05 3049 -1221941.13096
+0.00268269579528 0.00641420531224 1e-05 2929 -1343238.6355
+0.00268269579528 0.00936329208824 1e-05 2871 -1422120.05939
+0.00268269579528 0.0136682931808 1e-05 1531 -3430091.89383
+0.00268269579528 0.0199526231497 1e-05 1223 -5921147.27347
+0.00439397056076 0.0001 1e-05 7011 -291759.652509
+0.00439397056076 0.000145977430289 1e-05 6924 -294332.169158
+0.00439397056076 0.000213094101537 1e-05 6860 -295443.905734
+0.00439397056076 0.00031106929352 1e-05 6816 -295336.433453
+0.00439397056076 0.000454090961097 1e-05 6751 -296297.905972
+0.00439397056076 0.000662870316183 1e-05 6701 -297239.96917
+0.00439397056076 0.000967641053709 1e-05 5772 -355244.508142
+0.00439397056076 0.00141253754462 1e-05 4493 -546346.358256
+0.00439397056076 0.0020619860095 1e-05 3804 -733086.489187
+0.00439397056076 0.00301003418958 1e-05 3483 -884823.745035
+0.00439397056076 0.00439397056076 1e-05 3273 -1012201.97793
+0.00439397056076 0.00641420531224 1e-05 3124 -1112450.18835
+0.00439397056076 0.00936329208824 1e-05 2693 -1347187.51209
+0.00439397056076 0.0136682931808 1e-05 1568 -3234700.11538
+0.00439397056076 0.0199526231497 1e-05 1300 -4861844.98147
+0.00719685673001 0.0001 1e-05 7476 -266137.846988
+0.00719685673001 0.000145977430289 1e-05 7387 -268100.519338
+0.00719685673001 0.000213094101537 1e-05 7312 -270559.260516
+0.00719685673001 0.00031106929352 1e-05 7249 -271497.340427
+0.00719685673001 0.000454090961097 1e-05 7172 -272375.659662
+0.00719685673001 0.000662870316183 1e-05 7124 -273090.386027
+0.00719685673001 0.000967641053709 1e-05 5498 -386101.265521
+0.00719685673001 0.00141253754462 1e-05 4734 -497876.543257
+0.00719685673001 0.0020619860095 1e-05 4188 -605246.845689
+0.00719685673001 0.00301003418958 1e-05 3821 -714208.587765
+0.00719685673001 0.00439397056076 1e-05 3620 -801473.581164
+0.00719685673001 0.00641420531224 1e-05 3470 -870432.004296
+0.00719685673001 0.00936329208824 1e-05 2277 -1582548.33584
+0.00719685673001 0.0136682931808 1e-05 1730 -2695291.50147
+0.00719685673001 0.0199526231497 1e-05 1455 -3730643.7477
+0.0117876863479 0.0001 1e-05 8064 -246019.102742
+0.0117876863479 0.000145977430289 1e-05 7979 -247202.401148
+0.0117876863479 0.000213094101537 1e-05 7881 -247976.479576
+0.0117876863479 0.00031106929352 1e-05 7807 -248816.866397
+0.0117876863479 0.000454090961097 1e-05 7727 -250110.711937
+0.0117876863479 0.000662870316183 1e-05 6717 -291829.426643
+0.0117876863479 0.000967641053709 1e-05 5760 -361761.249225
+0.0117876863479 0.00141253754462 1e-05 5169 -426603.686685
+0.0117876863479 0.0020619860095 1e-05 4773 -488650.259979
+0.0117876863479 0.00301003418958 1e-05 4387 -545791.715374
+0.0117876863479 0.00439397056076 1e-05 4104 -609277.071762
+0.0117876863479 0.00641420531224 1e-05 3887 -666238.108524
+0.0117876863479 0.00936329208824 1e-05 2380 -1431533.60463
+0.0117876863479 0.0136682931808 1e-05 1955 -2096261.93677
+0.0117876863479 0.0199526231497 1e-05 1706 -2683543.79221
+0.0193069772888 0.0001 1e-05 8720 -232220.935432
+0.0193069772888 0.000145977430289 1e-05 8621 -232780.028528
+0.0193069772888 0.000213094101537 1e-05 8536 -233478.58408
+0.0193069772888 0.00031106929352 1e-05 8453 -233909.71715
+0.0193069772888 0.000454090961097 1e-05 8049 -243173.875679
+0.0193069772888 0.000662870316183 1e-05 6977 -283848.55227
+0.0193069772888 0.000967641053709 1e-05 6290 -323915.241661
+0.0193069772888 0.00141253754462 1e-05 5812 -361364.242587
+0.0193069772888 0.0020619860095 1e-05 5421 -395697.988827
+0.0193069772888 0.00301003418958 1e-05 5121 -428552.499162
+0.0193069772888 0.00439397056076 1e-05 4844 -461000.33239
+0.0193069772888 0.00641420531224 1e-05 3774 -667957.613292
+0.0193069772888 0.00936329208824 1e-05 2697 -1147277.29501
+0.0193069772888 0.0136682931808 1e-05 2265 -1569379.5319
+0.0193069772888 0.0199526231497 1e-05 2014 -1933459.24301
+0.0316227766017 0.0001 1e-05 9330 -224220.807161
+0.0316227766017 0.000145977430289 1e-05 9270 -224272.554648
+0.0316227766017 0.000213094101537 1e-05 9205 -224198.785565
+0.0316227766017 0.00031106929352 1e-05 9151 -224084.277528
+0.0316227766017 0.000454090961097 1e-05 8255 -241755.665896
+0.0316227766017 0.000662870316183 1e-05 7553 -263396.9535
+0.0316227766017 0.000967641053709 1e-05 7008 -284871.471307
+0.0316227766017 0.00141253754462 1e-05 6574 -306630.917502
+0.0316227766017 0.0020619860095 1e-05 6238 -327457.391246
+0.0316227766017 0.00301003418958 1e-05 5940 -346618.838854
+0.0316227766017 0.00439397056076 1e-05 5661 -364120.68943
+0.0316227766017 0.00641420531224 1e-05 4068 -604430.895627
+0.0316227766017 0.00936329208824 1e-05 3197 -886257.451415
+0.0316227766017 0.0136682931808 1e-05 2724 -1140825.92636
+0.0316227766017 0.0199526231497 1e-05 2445 -1363542.53265
+0.0517947467923 0.0001 1e-05 9823 -220481.203625
+0.0517947467923 0.000145977430289 1e-05 9762 -220391.217942
+0.0517947467923 0.000213094101537 1e-05 9698 -220364.201728
+0.0517947467923 0.00031106929352 1e-05 9238 -224969.105111
+0.0517947467923 0.000454090961097 1e-05 8580 -235885.11742
+0.0517947467923 0.000662870316183 1e-05 8110 -246755.049984
+0.0517947467923 0.000967641053709 1e-05 7720 -258639.40814
+0.0517947467923 0.00141253754462 1e-05 7362 -268623.478248
+0.0517947467923 0.0020619860095 1e-05 7035 -280202.867047
+0.0517947467923 0.00301003418958 1e-05 6755 -291693.597386
+0.0517947467923 0.00439397056076 1e-05 6051 -337648.348684
+0.0517947467923 0.00641420531224 1e-05 4620 -506173.656543
+0.0517947467923 0.00936329208824 1e-05 3849 -669050.880332
+0.0517947467923 0.0136682931808 1e-05 3335 -822657.249848
+0.0517947467923 0.0199526231497 1e-05 2992 -960246.033215
+0.0848342898244 0.0001 1e-05 10192 -218975.38046
+0.0848342898244 0.000145977430289 1e-05 10152 -218826.941054
+0.0848342898244 0.000213094101537 1e-05 9985 -219603.320577
+0.0848342898244 0.00031106929352 1e-05 9433 -224589.795124
+0.0848342898244 0.000454090961097 1e-05 9044 -230146.083939
+0.0848342898244 0.000662870316183 1e-05 8672 -235363.425524
+0.0848342898244 0.000967641053709 1e-05 8380 -240097.187894
+0.0848342898244 0.00141253754462 1e-05 8116 -245778.160742
+0.0848342898244 0.0020619860095 1e-05 7877 -250737.911988
+0.0848342898244 0.00301003418958 1e-05 7626 -255761.834673
+0.0848342898244 0.00439397056076 1e-05 6388 -320962.53413
+0.0848342898244 0.00641420531224 1e-05 5263 -421938.833431
+0.0848342898244 0.00936329208824 1e-05 4601 -513180.221863
+0.0848342898244 0.0136682931808 1e-05 4115 -599465.443999
+0.0848342898244 0.0199526231497 1e-05 3701 -686941.830573
+0.138949549437 0.0001 1e-05 10515 -218576.085235
+0.138949549437 0.000145977430289 1e-05 10489 -218378.279833
+0.138949549437 0.000213094101537 1e-05 10146 -220185.725333
+0.138949549437 0.00031106929352 1e-05 9810 -222465.772917
+0.138949549437 0.000454090961097 1e-05 9474 -225575.460448
+0.138949549437 0.000662870316183 1e-05 9258 -227659.72262
+0.138949549437 0.000967641053709 1e-05 9046 -229405.451017
+0.138949549437 0.00141253754462 1e-05 8790 -232270.237744
+0.138949549437 0.0020619860095 1e-05 8599 -234251.480018
+0.138949549437 0.00301003418958 1e-05 8169 -242589.313202
+0.138949549437 0.00439397056076 1e-05 6939 -292368.219307
+0.138949549437 0.00641420531224 1e-05 6080 -344287.676624
+0.138949549437 0.00936329208824 1e-05 5459 -394410.965932
+0.138949549437 0.0136682931808 1e-05 4940 -452240.538216
+0.138949549437 0.0199526231497 1e-05 4586 -496132.143115
+0.227584592607 0.0001 1e-05 10763 -218554.364887
+0.227584592607 0.000145977430289 1e-05 10594 -218877.252269
+0.227584592607 0.000213094101537 1e-05 10371 -219675.715629
+0.227584592607 0.00031106929352 1e-05 10162 -220353.951501
+0.227584592607 0.000454090961097 1e-05 9909 -221988.412424
+0.227584592607 0.000662870316183 1e-05 9738 -222965.704469
+0.227584592607 0.000967641053709 1e-05 9582 -223636.176204
+0.227584592607 0.00141253754462 1e-05 9400 -224942.892883
+0.227584592607 0.0020619860095 1e-05 9255 -225153.469266
+0.227584592607 0.00301003418958 1e-05 8452 -240859.589455
+0.227584592607 0.00439397056076 1e-05 7536 -268187.413443
+0.227584592607 0.00641420531224 1e-05 6872 -296855.999889
+0.227584592607 0.00936329208824 1e-05 6333 -324493.055952
+0.227584592607 0.0136682931808 1e-05 5854 -352259.065819
+0.227584592607 0.0199526231497 1e-05 5486 -377070.269048
diff --git a/experiments/process.py b/experiments/process.py
index 8201dea..9ea2e81 100644
--- a/experiments/process.py
+++ b/experiments/process.py
@@ -6,17 +6,19 @@ import numpy as np
from cPickle import load
from itertools import product
from math import exp
+import time
if __name__ == "__main__":
+ time.sleep(3)
if len(sys.argv) < 2:
sys.exit("usage: {0} <file>".format(sys.argv[0]))
root_victims, victims, non_victims, age = load(open(sys.argv[1]))
# alphas = np.arange(1e-3, 1e-2, 8e-4) # parameter of the time component
- alphas = np.logspace(-3,-.1,num=10)
+ alphas = np.logspace(-3,0,num=15)
# deltas = np.arange(0.001, 0.3, 0.008) # parameter of the structural component
- deltas = np.logspace(-2,-.1,num=10)
+ deltas = np.logspace(-4,-1.7,num=15)
with open("out.log", "w") as fh:
for alpha, delta in product(alphas, deltas):
beta, roots, ll = ml3(root_victims, victims, non_victims, age, alpha, delta)