From ccca3a3fac398d91bb4700dc711a1a225a954fc0 Mon Sep 17 00:00:00 2001 From: NA Date: Sat, 8 Jan 2022 10:25:46 -0500 Subject: [PATCH 1/2] Replace l-value macros as per PEP 674. --- lightfm/_lightfm_fast_no_openmp.c | 12 ++++++------ lightfm/_lightfm_fast_openmp.c | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/lightfm/_lightfm_fast_no_openmp.c b/lightfm/_lightfm_fast_no_openmp.c index fa843443..2ef7f8bb 100644 --- a/lightfm/_lightfm_fast_no_openmp.c +++ b/lightfm/_lightfm_fast_no_openmp.c @@ -24535,9 +24535,9 @@ static void __pyx_tp_dealloc_array(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); + Py_SET_REFCNT(o, 1 + Py_REFCNT(o)); __pyx_array___dealloc__(o); - --Py_REFCNT(o); + Py_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->mode); @@ -24846,9 +24846,9 @@ static void __pyx_tp_dealloc_memoryview(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); + Py_SET_REFCNT(o, 1 + Py_REFCNT(o)); __pyx_memoryview___dealloc__(o); - --Py_REFCNT(o); + Py_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->obj); @@ -25096,9 +25096,9 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); + Py_SET_REFCNT(o, 1 + Py_REFCNT(o)); __pyx_memoryviewslice___dealloc__(o); - --Py_REFCNT(o); + Py_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->from_object); diff --git a/lightfm/_lightfm_fast_openmp.c b/lightfm/_lightfm_fast_openmp.c index adeb1e27..c64534c9 100644 --- a/lightfm/_lightfm_fast_openmp.c +++ b/lightfm/_lightfm_fast_openmp.c @@ -24865,9 +24865,9 @@ static void __pyx_tp_dealloc_array(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); + Py_SET_REFCNT(o, 1 + Py_REFCNT(o)); __pyx_array___dealloc__(o); - --Py_REFCNT(o); + Py_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->mode); @@ -25176,9 +25176,9 @@ static void __pyx_tp_dealloc_memoryview(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); + Py_SET_REFCNT(o, 1 + Py_REFCNT(o)); __pyx_memoryview___dealloc__(o); - --Py_REFCNT(o); + Py_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->obj); @@ -25426,9 +25426,9 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); - ++Py_REFCNT(o); + Py_SET_REFCNT(o, 1 + Py_REFCNT(o)); __pyx_memoryviewslice___dealloc__(o); - --Py_REFCNT(o); + Py_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->from_object); From 9af754b6da050aa04c0fe40a6ad541e2bfca2fb2 Mon Sep 17 00:00:00 2001 From: NA Date: Sat, 8 Jan 2022 15:28:02 -0500 Subject: [PATCH 2/2] Store average loss values for users' benefit. --- lightfm/_lightfm_fast.pyx.template | 12 + lightfm/_lightfm_fast_no_openmp.c | 3410 +++++++++++++++------------ lightfm/_lightfm_fast_openmp.c | 3444 ++++++++++++++++------------ lightfm/lightfm.py | 10 + 4 files changed, 3987 insertions(+), 2889 deletions(-) diff --git a/lightfm/_lightfm_fast.pyx.template b/lightfm/_lightfm_fast.pyx.template index e33c7a5e..4708a58b 100644 --- a/lightfm/_lightfm_fast.pyx.template +++ b/lightfm/_lightfm_fast.pyx.template @@ -213,6 +213,9 @@ cdef class FastLightFM: cdef double item_scale cdef double user_scale + cdef readonly double avg_loss + cdef int avg_loss_ctr + def __init__(self, flt[:, ::1] item_features, flt[:, ::1] item_feature_gradients, @@ -258,6 +261,9 @@ cdef class FastLightFM: self.max_sampled = max_sampled + self.avg_loss = 0.0 + self.avg_loss_ctr = 0 + cdef inline flt sigmoid(flt v) nogil: """ @@ -533,6 +539,9 @@ cdef inline void update(double loss, lightfm.item_scale *= (1.0 + item_alpha * avg_learning_rate) lightfm.user_scale *= (1.0 + user_alpha * avg_learning_rate) + lightfm.avg_loss_ctr += 1 + lightfm.avg_loss = (lightfm.avg_loss * (lightfm.avg_loss_ctr - 1) + loss) / lightfm.avg_loss_ctr + cdef void warp_update(double loss, CSRMatrix item_features, @@ -648,6 +657,9 @@ cdef void warp_update(double loss, lightfm.item_scale *= (1.0 + item_alpha * avg_learning_rate) lightfm.user_scale *= (1.0 + user_alpha * avg_learning_rate) + lightfm.avg_loss_ctr += 1 + lightfm.avg_loss = (lightfm.avg_loss * (lightfm.avg_loss_ctr - 1) + loss) / lightfm.avg_loss_ctr + cdef void regularize(FastLightFM lightfm, double item_alpha, diff --git a/lightfm/_lightfm_fast_no_openmp.c b/lightfm/_lightfm_fast_no_openmp.c index 2ef7f8bb..99f39a0d 100644 --- a/lightfm/_lightfm_fast_no_openmp.c +++ b/lightfm/_lightfm_fast_no_openmp.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.14 */ +/* Generated by Cython 0.29.26 */ /* BEGIN: Cython Metadata { @@ -13,15 +13,17 @@ } END: Cython Metadata */ +#ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_14" -#define CYTHON_HEX_VERSION 0x001D0EF0 +#define CYTHON_ABI "0_29_26" +#define CYTHON_HEX_VERSION 0x001D1AF0 #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof @@ -168,7 +170,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -187,7 +189,7 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 + #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) @@ -206,7 +208,9 @@ END: Cython Metadata */ #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -323,9 +327,68 @@ END: Cython Metadata */ #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#if PY_VERSION_HEX >= 0x030B00A1 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject* co=NULL; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (!(kwds=PyDict_New())) goto end; + if (!(argcount=PyLong_FromLong(a))) goto end; + if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; + if (!(posonlyargcount=PyLong_FromLong(0))) goto end; + if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; + if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; + if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; + if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; + if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; + if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here + if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; + Py_XDECREF((PyObject*)co); + co = (PyCodeObject*)call_result; + call_result = NULL; + if (0) { + cleanup_code_too: + Py_XDECREF((PyObject*)co); + co = NULL; + } + end: + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + Py_XDECREF(nlocals); + Py_XDECREF(stacksize); + Py_XDECREF(replace); + Py_XDECREF(call_result); + Py_XDECREF(empty); + if (type) { + PyErr_Restore(type, value, traceback); + } + return co; + } #else #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) @@ -439,8 +502,12 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 + #if defined(PyUnicode_IS_READY) #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) + #else + #define __Pyx_PyUnicode_READY(op) (0) + #endif #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) @@ -448,7 +515,15 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #endif #else #define CYTHON_PEP393_ENABLED 0 #define PyUnicode_1BYTE_KIND 1 @@ -497,8 +572,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact +#ifndef PyObject_Unicode #define PyObject_Unicode PyObject_Str #endif +#endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) @@ -509,6 +586,13 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) #else @@ -542,13 +626,13 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif @@ -589,11 +673,10 @@ static CYTHON_INLINE float __PYX_NAN() { #define __Pyx_truncl truncl #endif - +#define __PYX_MARK_ERR_POS(f_index, lineno) \ + { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } #define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } #ifndef __PYX_EXTERN_C #ifdef __cplusplus @@ -709,6 +792,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -1011,6 +1095,8 @@ struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM { int max_sampled; double item_scale; double user_scale; + double avg_loss; + int avg_loss_ctr; }; @@ -1402,6 +1488,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif +#if CYTHON_FAST_PYCALL static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -1409,6 +1496,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif // CYTHON_FAST_PYCALL #endif /* PyObjectCall.proto */ @@ -1572,7 +1660,7 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { if (likely(L->allocated > len)) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; + __Pyx_SET_SIZE(list, len + 1); return 0; } return PyList_Append(list, x); @@ -1610,7 +1698,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; + __Pyx_SET_SIZE(list, len + 1); return 0; } return PyList_Append(list, x); @@ -1639,6 +1727,9 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam /* SetVTable.proto */ static int __Pyx_SetVtable(PyObject *dict, void *vtable); +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + /* SetupReduce.proto */ static int __Pyx_setup_reduce(PyObject* type_obj); @@ -1702,8 +1793,10 @@ static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, /* Capsule.proto */ static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); +/* GCCDiagnostics.proto */ +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif /* MemviewDtypeToObject.proto */ static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(const char *itemp); @@ -1745,8 +1838,8 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_int /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyObject *, int writable_flag); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +/* ObjectToMemviewSlice.proto */ +static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(PyObject *, int writable_flag); /* MemviewSliceCopyTemplate.proto */ static __Pyx_memviewslice @@ -1755,18 +1848,21 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, size_t sizeof_dtype, int contig_flag, int dtype_is_object); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); + /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + /* CIntFromPy.proto */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); -/* ObjectToMemviewSlice.proto */ -static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(PyObject *, int writable_flag); - /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); @@ -2052,8 +2148,8 @@ static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview"; static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array"; static const char __pyx_k_Incompatible_checksums_s_vs_0x5b[] = "Incompatible checksums (%s vs 0x5b63e82 = (cols, data, indices, indptr, nnz, rows))"; +static const char __pyx_k_Incompatible_checksums_s_vs_0x8f[] = "Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))"; static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))"; -static const char __pyx_k_Incompatible_checksums_s_vs_0xdd[] = "Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))"; static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported"; static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s"; static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)"; @@ -2073,8 +2169,8 @@ static PyObject *__pyx_n_s_Ellipsis; static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; static PyObject *__pyx_n_s_FastLightFM; static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x5b; +static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x8f; static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0; -static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xdd; static PyObject *__pyx_n_s_IndexError; static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr; @@ -2256,6 +2352,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_9CSRMatrix___init__(struc static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_9CSRMatrix_2__reduce_cython__(struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_9CSRMatrix_4__setstate_cython__(struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *__pyx_v_self, __Pyx_memviewslice __pyx_v_item_features, __Pyx_memviewslice __pyx_v_item_feature_gradients, __Pyx_memviewslice __pyx_v_item_feature_momentum, __Pyx_memviewslice __pyx_v_item_biases, __Pyx_memviewslice __pyx_v_item_bias_gradients, __Pyx_memviewslice __pyx_v_item_bias_momentum, __Pyx_memviewslice __pyx_v_user_features, __Pyx_memviewslice __pyx_v_user_feature_gradients, __Pyx_memviewslice __pyx_v_user_feature_momentum, __Pyx_memviewslice __pyx_v_user_biases, __Pyx_memviewslice __pyx_v_user_bias_gradients, __Pyx_memviewslice __pyx_v_user_bias_momentum, int __pyx_v_no_components, int __pyx_v_adadelta, __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_v_learning_rate, __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_v_rho, __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_v_epsilon, int __pyx_v_max_sampled); /* proto */ +static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_8avg_loss___get__(struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_2__reduce_cython__(struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_4__setstate_cython__(struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *__pyx_v_item_features, struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *__pyx_v_user_features, __Pyx_memviewslice __pyx_v_user_ids, __Pyx_memviewslice __pyx_v_item_ids, __Pyx_memviewslice __pyx_v_Y, __Pyx_memviewslice __pyx_v_sample_weight, __Pyx_memviewslice __pyx_v_shuffle_indices, struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *__pyx_v_lightfm, CYTHON_UNUSED double __pyx_v_learning_rate, double __pyx_v_item_alpha, double __pyx_v_user_alpha, CYTHON_UNUSED int __pyx_v_num_threads); /* proto */ @@ -2319,8 +2416,8 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_95829634; +static PyObject *__pyx_int_150189132; static PyObject *__pyx_int_184977713; -static PyObject *__pyx_int_232728138; static PyObject *__pyx_int_neg_1; static PyObject *__pyx_tuple_; static PyObject *__pyx_tuple__2; @@ -2956,6 +3053,9 @@ static int __pyx_f_7lightfm_23_lightfm_fast_no_openmp_flt_compare(const void *__ static int __pyx_pw_7lightfm_23_lightfm_fast_no_openmp_9CSRMatrix_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7lightfm_23_lightfm_fast_no_openmp_9CSRMatrix_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_csr_matrix = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); @@ -3015,6 +3115,9 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_9CSRMatrix___init__(struc int __pyx_t_8; int __pyx_t_9; size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); /* "lightfm/_lightfm_fast_no_openmp.pyx":161 @@ -3268,6 +3371,9 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_9CSRMatrix_2__reduc PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":5 @@ -3523,6 +3629,9 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_9CSRMatrix_4__setst PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":17 @@ -3555,8 +3664,8 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_9CSRMatrix_4__setst return __pyx_r; } -/* "lightfm/_lightfm_fast_no_openmp.pyx":216 - * cdef double user_scale +/* "lightfm/_lightfm_fast_no_openmp.pyx":219 + * cdef int avg_loss_ctr * * def __init__(self, # <<<<<<<<<<<<<< * flt[:, ::1] item_features, @@ -3584,6 +3693,9 @@ static int __pyx_pw_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_1__init__(P __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_v_rho; __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_v_epsilon; int __pyx_v_max_sampled; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); @@ -3642,107 +3754,107 @@ static int __pyx_pw_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_1__init__(P case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_feature_gradients)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 1); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 1); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_feature_momentum)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 2); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 2); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_biases)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 3); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 3); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_bias_gradients)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 4); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 4); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_bias_momentum)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 5); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 5); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 6); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 6); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_feature_gradients)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 7); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 7); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_feature_momentum)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 8); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 8); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_biases)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 9); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 9); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_bias_gradients)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 10); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 10); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_bias_momentum)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 11); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 11); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_no_components)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 12); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 12); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 13: if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_adadelta)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 13); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 13); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 14: if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_learning_rate)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 14); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 14); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 15: if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 15); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 15); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 16: if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_epsilon)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 16); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 16); __PYX_ERR(0, 219, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 17: if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_sampled)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 17); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 17); __PYX_ERR(0, 219, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 216, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 219, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 18) { goto __pyx_L5_argtuple_error; @@ -3766,28 +3878,28 @@ static int __pyx_pw_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_1__init__(P values[16] = PyTuple_GET_ITEM(__pyx_args, 16); values[17] = PyTuple_GET_ITEM(__pyx_args, 17); } - __pyx_v_item_features = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_features.memview)) __PYX_ERR(0, 217, __pyx_L3_error) - __pyx_v_item_feature_gradients = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_feature_gradients.memview)) __PYX_ERR(0, 218, __pyx_L3_error) - __pyx_v_item_feature_momentum = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_feature_momentum.memview)) __PYX_ERR(0, 219, __pyx_L3_error) - __pyx_v_item_biases = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_biases.memview)) __PYX_ERR(0, 220, __pyx_L3_error) - __pyx_v_item_bias_gradients = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_bias_gradients.memview)) __PYX_ERR(0, 221, __pyx_L3_error) - __pyx_v_item_bias_momentum = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_bias_momentum.memview)) __PYX_ERR(0, 222, __pyx_L3_error) - __pyx_v_user_features = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_features.memview)) __PYX_ERR(0, 223, __pyx_L3_error) - __pyx_v_user_feature_gradients = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_feature_gradients.memview)) __PYX_ERR(0, 224, __pyx_L3_error) - __pyx_v_user_feature_momentum = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_feature_momentum.memview)) __PYX_ERR(0, 225, __pyx_L3_error) - __pyx_v_user_biases = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[9], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_biases.memview)) __PYX_ERR(0, 226, __pyx_L3_error) - __pyx_v_user_bias_gradients = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[10], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_bias_gradients.memview)) __PYX_ERR(0, 227, __pyx_L3_error) - __pyx_v_user_bias_momentum = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[11], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_bias_momentum.memview)) __PYX_ERR(0, 228, __pyx_L3_error) - __pyx_v_no_components = __Pyx_PyInt_As_int(values[12]); if (unlikely((__pyx_v_no_components == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 229, __pyx_L3_error) - __pyx_v_adadelta = __Pyx_PyInt_As_int(values[13]); if (unlikely((__pyx_v_adadelta == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 230, __pyx_L3_error) - __pyx_v_learning_rate = __pyx_PyFloat_AsFloat(values[14]); if (unlikely((__pyx_v_learning_rate == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 231, __pyx_L3_error) - __pyx_v_rho = __pyx_PyFloat_AsFloat(values[15]); if (unlikely((__pyx_v_rho == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L3_error) - __pyx_v_epsilon = __pyx_PyFloat_AsFloat(values[16]); if (unlikely((__pyx_v_epsilon == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L3_error) - __pyx_v_max_sampled = __Pyx_PyInt_As_int(values[17]); if (unlikely((__pyx_v_max_sampled == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + __pyx_v_item_features = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_features.memview)) __PYX_ERR(0, 220, __pyx_L3_error) + __pyx_v_item_feature_gradients = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_feature_gradients.memview)) __PYX_ERR(0, 221, __pyx_L3_error) + __pyx_v_item_feature_momentum = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_feature_momentum.memview)) __PYX_ERR(0, 222, __pyx_L3_error) + __pyx_v_item_biases = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_biases.memview)) __PYX_ERR(0, 223, __pyx_L3_error) + __pyx_v_item_bias_gradients = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_bias_gradients.memview)) __PYX_ERR(0, 224, __pyx_L3_error) + __pyx_v_item_bias_momentum = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_bias_momentum.memview)) __PYX_ERR(0, 225, __pyx_L3_error) + __pyx_v_user_features = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_features.memview)) __PYX_ERR(0, 226, __pyx_L3_error) + __pyx_v_user_feature_gradients = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_feature_gradients.memview)) __PYX_ERR(0, 227, __pyx_L3_error) + __pyx_v_user_feature_momentum = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_feature_momentum.memview)) __PYX_ERR(0, 228, __pyx_L3_error) + __pyx_v_user_biases = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[9], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_biases.memview)) __PYX_ERR(0, 229, __pyx_L3_error) + __pyx_v_user_bias_gradients = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[10], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_bias_gradients.memview)) __PYX_ERR(0, 230, __pyx_L3_error) + __pyx_v_user_bias_momentum = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[11], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_bias_momentum.memview)) __PYX_ERR(0, 231, __pyx_L3_error) + __pyx_v_no_components = __Pyx_PyInt_As_int(values[12]); if (unlikely((__pyx_v_no_components == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 232, __pyx_L3_error) + __pyx_v_adadelta = __Pyx_PyInt_As_int(values[13]); if (unlikely((__pyx_v_adadelta == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 233, __pyx_L3_error) + __pyx_v_learning_rate = __pyx_PyFloat_AsFloat(values[14]); if (unlikely((__pyx_v_learning_rate == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 234, __pyx_L3_error) + __pyx_v_rho = __pyx_PyFloat_AsFloat(values[15]); if (unlikely((__pyx_v_rho == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L3_error) + __pyx_v_epsilon = __pyx_PyFloat_AsFloat(values[16]); if (unlikely((__pyx_v_epsilon == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L3_error) + __pyx_v_max_sampled = __Pyx_PyInt_As_int(values[17]); if (unlikely((__pyx_v_max_sampled == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 216, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 219, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_no_openmp.FastLightFM.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3805,7 +3917,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "lightfm/_lightfm_fast_no_openmp.pyx":236 + /* "lightfm/_lightfm_fast_no_openmp.pyx":239 * int max_sampled): * * self.item_features = item_features # <<<<<<<<<<<<<< @@ -3816,7 +3928,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st __PYX_INC_MEMVIEW(&__pyx_v_item_features, 0); __pyx_v_self->item_features = __pyx_v_item_features; - /* "lightfm/_lightfm_fast_no_openmp.pyx":237 + /* "lightfm/_lightfm_fast_no_openmp.pyx":240 * * self.item_features = item_features * self.item_feature_gradients = item_feature_gradients # <<<<<<<<<<<<<< @@ -3827,7 +3939,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st __PYX_INC_MEMVIEW(&__pyx_v_item_feature_gradients, 0); __pyx_v_self->item_feature_gradients = __pyx_v_item_feature_gradients; - /* "lightfm/_lightfm_fast_no_openmp.pyx":238 + /* "lightfm/_lightfm_fast_no_openmp.pyx":241 * self.item_features = item_features * self.item_feature_gradients = item_feature_gradients * self.item_feature_momentum = item_feature_momentum # <<<<<<<<<<<<<< @@ -3838,7 +3950,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st __PYX_INC_MEMVIEW(&__pyx_v_item_feature_momentum, 0); __pyx_v_self->item_feature_momentum = __pyx_v_item_feature_momentum; - /* "lightfm/_lightfm_fast_no_openmp.pyx":239 + /* "lightfm/_lightfm_fast_no_openmp.pyx":242 * self.item_feature_gradients = item_feature_gradients * self.item_feature_momentum = item_feature_momentum * self.item_biases = item_biases # <<<<<<<<<<<<<< @@ -3849,7 +3961,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st __PYX_INC_MEMVIEW(&__pyx_v_item_biases, 0); __pyx_v_self->item_biases = __pyx_v_item_biases; - /* "lightfm/_lightfm_fast_no_openmp.pyx":240 + /* "lightfm/_lightfm_fast_no_openmp.pyx":243 * self.item_feature_momentum = item_feature_momentum * self.item_biases = item_biases * self.item_bias_gradients = item_bias_gradients # <<<<<<<<<<<<<< @@ -3860,7 +3972,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st __PYX_INC_MEMVIEW(&__pyx_v_item_bias_gradients, 0); __pyx_v_self->item_bias_gradients = __pyx_v_item_bias_gradients; - /* "lightfm/_lightfm_fast_no_openmp.pyx":241 + /* "lightfm/_lightfm_fast_no_openmp.pyx":244 * self.item_biases = item_biases * self.item_bias_gradients = item_bias_gradients * self.item_bias_momentum = item_bias_momentum # <<<<<<<<<<<<<< @@ -3871,7 +3983,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st __PYX_INC_MEMVIEW(&__pyx_v_item_bias_momentum, 0); __pyx_v_self->item_bias_momentum = __pyx_v_item_bias_momentum; - /* "lightfm/_lightfm_fast_no_openmp.pyx":242 + /* "lightfm/_lightfm_fast_no_openmp.pyx":245 * self.item_bias_gradients = item_bias_gradients * self.item_bias_momentum = item_bias_momentum * self.user_features = user_features # <<<<<<<<<<<<<< @@ -3882,7 +3994,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st __PYX_INC_MEMVIEW(&__pyx_v_user_features, 0); __pyx_v_self->user_features = __pyx_v_user_features; - /* "lightfm/_lightfm_fast_no_openmp.pyx":243 + /* "lightfm/_lightfm_fast_no_openmp.pyx":246 * self.item_bias_momentum = item_bias_momentum * self.user_features = user_features * self.user_feature_gradients = user_feature_gradients # <<<<<<<<<<<<<< @@ -3893,7 +4005,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st __PYX_INC_MEMVIEW(&__pyx_v_user_feature_gradients, 0); __pyx_v_self->user_feature_gradients = __pyx_v_user_feature_gradients; - /* "lightfm/_lightfm_fast_no_openmp.pyx":244 + /* "lightfm/_lightfm_fast_no_openmp.pyx":247 * self.user_features = user_features * self.user_feature_gradients = user_feature_gradients * self.user_feature_momentum = user_feature_momentum # <<<<<<<<<<<<<< @@ -3904,7 +4016,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st __PYX_INC_MEMVIEW(&__pyx_v_user_feature_momentum, 0); __pyx_v_self->user_feature_momentum = __pyx_v_user_feature_momentum; - /* "lightfm/_lightfm_fast_no_openmp.pyx":245 + /* "lightfm/_lightfm_fast_no_openmp.pyx":248 * self.user_feature_gradients = user_feature_gradients * self.user_feature_momentum = user_feature_momentum * self.user_biases = user_biases # <<<<<<<<<<<<<< @@ -3915,7 +4027,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st __PYX_INC_MEMVIEW(&__pyx_v_user_biases, 0); __pyx_v_self->user_biases = __pyx_v_user_biases; - /* "lightfm/_lightfm_fast_no_openmp.pyx":246 + /* "lightfm/_lightfm_fast_no_openmp.pyx":249 * self.user_feature_momentum = user_feature_momentum * self.user_biases = user_biases * self.user_bias_gradients = user_bias_gradients # <<<<<<<<<<<<<< @@ -3926,7 +4038,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st __PYX_INC_MEMVIEW(&__pyx_v_user_bias_gradients, 0); __pyx_v_self->user_bias_gradients = __pyx_v_user_bias_gradients; - /* "lightfm/_lightfm_fast_no_openmp.pyx":247 + /* "lightfm/_lightfm_fast_no_openmp.pyx":250 * self.user_biases = user_biases * self.user_bias_gradients = user_bias_gradients * self.user_bias_momentum = user_bias_momentum # <<<<<<<<<<<<<< @@ -3937,7 +4049,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st __PYX_INC_MEMVIEW(&__pyx_v_user_bias_momentum, 0); __pyx_v_self->user_bias_momentum = __pyx_v_user_bias_momentum; - /* "lightfm/_lightfm_fast_no_openmp.pyx":249 + /* "lightfm/_lightfm_fast_no_openmp.pyx":252 * self.user_bias_momentum = user_bias_momentum * * self.no_components = no_components # <<<<<<<<<<<<<< @@ -3946,7 +4058,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st */ __pyx_v_self->no_components = __pyx_v_no_components; - /* "lightfm/_lightfm_fast_no_openmp.pyx":250 + /* "lightfm/_lightfm_fast_no_openmp.pyx":253 * * self.no_components = no_components * self.learning_rate = learning_rate # <<<<<<<<<<<<<< @@ -3955,7 +4067,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st */ __pyx_v_self->learning_rate = __pyx_v_learning_rate; - /* "lightfm/_lightfm_fast_no_openmp.pyx":251 + /* "lightfm/_lightfm_fast_no_openmp.pyx":254 * self.no_components = no_components * self.learning_rate = learning_rate * self.rho = rho # <<<<<<<<<<<<<< @@ -3964,7 +4076,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st */ __pyx_v_self->rho = __pyx_v_rho; - /* "lightfm/_lightfm_fast_no_openmp.pyx":252 + /* "lightfm/_lightfm_fast_no_openmp.pyx":255 * self.learning_rate = learning_rate * self.rho = rho * self.eps = epsilon # <<<<<<<<<<<<<< @@ -3973,7 +4085,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st */ __pyx_v_self->eps = __pyx_v_epsilon; - /* "lightfm/_lightfm_fast_no_openmp.pyx":254 + /* "lightfm/_lightfm_fast_no_openmp.pyx":257 * self.eps = epsilon * * self.item_scale = 1.0 # <<<<<<<<<<<<<< @@ -3982,7 +4094,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st */ __pyx_v_self->item_scale = 1.0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":255 + /* "lightfm/_lightfm_fast_no_openmp.pyx":258 * * self.item_scale = 1.0 * self.user_scale = 1.0 # <<<<<<<<<<<<<< @@ -3991,7 +4103,7 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st */ __pyx_v_self->user_scale = 1.0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":257 + /* "lightfm/_lightfm_fast_no_openmp.pyx":260 * self.user_scale = 1.0 * * self.adadelta = adadelta # <<<<<<<<<<<<<< @@ -4000,17 +4112,35 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st */ __pyx_v_self->adadelta = __pyx_v_adadelta; - /* "lightfm/_lightfm_fast_no_openmp.pyx":259 + /* "lightfm/_lightfm_fast_no_openmp.pyx":262 * self.adadelta = adadelta * * self.max_sampled = max_sampled # <<<<<<<<<<<<<< * - * + * self.avg_loss = 0.0 */ __pyx_v_self->max_sampled = __pyx_v_max_sampled; - /* "lightfm/_lightfm_fast_no_openmp.pyx":216 - * cdef double user_scale + /* "lightfm/_lightfm_fast_no_openmp.pyx":264 + * self.max_sampled = max_sampled + * + * self.avg_loss = 0.0 # <<<<<<<<<<<<<< + * self.avg_loss_ctr = 0 + * + */ + __pyx_v_self->avg_loss = 0.0; + + /* "lightfm/_lightfm_fast_no_openmp.pyx":265 + * + * self.avg_loss = 0.0 + * self.avg_loss_ctr = 0 # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_self->avg_loss_ctr = 0; + + /* "lightfm/_lightfm_fast_no_openmp.pyx":219 + * cdef int avg_loss_ctr * * def __init__(self, # <<<<<<<<<<<<<< * flt[:, ::1] item_features, @@ -4035,6 +4165,53 @@ static int __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM___init__(st return __pyx_r; } +/* "lightfm/_lightfm_fast_no_openmp.pyx":216 + * cdef double user_scale + * + * cdef readonly double avg_loss # <<<<<<<<<<<<<< + * cdef int avg_loss_ctr + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_8avg_loss_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_8avg_loss_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_8avg_loss___get__(((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_8avg_loss___get__(struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->avg_loss); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 216, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lightfm._lightfm_fast_no_openmp.FastLightFM.avg_loss.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * cdef tuple state @@ -4081,99 +4258,112 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_2__re PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; - int __pyx_t_22; - int __pyx_t_23; + PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; + int __pyx_t_24; + int __pyx_t_25; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":5 * cdef object _dict * cdef bint use_setstate - * state = (self.adadelta, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) # <<<<<<<<<<<<<< + * state = (self.adadelta, self.avg_loss, self.avg_loss_ctr, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) # <<<<<<<<<<<<<< * _dict = getattr(self, '__dict__', None) * if _dict is not None: */ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->adadelta); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->eps); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->avg_loss); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_self->item_bias_gradients, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->avg_loss_ctr); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_self->item_bias_momentum, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->eps); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_self->item_biases, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_self->item_bias_gradients, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_self->item_feature_gradients, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_self->item_bias_momentum, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_self->item_feature_momentum, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_self->item_biases, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_self->item_features, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_self->item_feature_gradients, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyFloat_FromDouble(__pyx_v_self->item_scale); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_self->item_feature_momentum, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyFloat_FromDouble(__pyx_v_self->learning_rate); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_10 = __pyx_memoryview_fromslice(__pyx_v_self->item_features, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_self->max_sampled); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_11 = PyFloat_FromDouble(__pyx_v_self->item_scale); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_self->no_components); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_12 = PyFloat_FromDouble(__pyx_v_self->learning_rate); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = PyFloat_FromDouble(__pyx_v_self->rho); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_self->max_sampled); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = __pyx_memoryview_fromslice(__pyx_v_self->user_bias_gradients, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_self->no_components); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = __pyx_memoryview_fromslice(__pyx_v_self->user_bias_momentum, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_15 = PyFloat_FromDouble(__pyx_v_self->rho); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = __pyx_memoryview_fromslice(__pyx_v_self->user_biases, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_16 = __pyx_memoryview_fromslice(__pyx_v_self->user_bias_gradients, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); - __pyx_t_17 = __pyx_memoryview_fromslice(__pyx_v_self->user_feature_gradients, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_17 = __pyx_memoryview_fromslice(__pyx_v_self->user_bias_momentum, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = __pyx_memoryview_fromslice(__pyx_v_self->user_feature_momentum, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_18 = __pyx_memoryview_fromslice(__pyx_v_self->user_biases, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); - __pyx_t_19 = __pyx_memoryview_fromslice(__pyx_v_self->user_features, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_19 = __pyx_memoryview_fromslice(__pyx_v_self->user_feature_gradients, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); - __pyx_t_20 = PyFloat_FromDouble(__pyx_v_self->user_scale); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_20 = __pyx_memoryview_fromslice(__pyx_v_self->user_feature_momentum, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); - __pyx_t_21 = PyTuple_New(20); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_21 = __pyx_memoryview_fromslice(__pyx_v_self->user_features, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt, 0);; if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); + __pyx_t_22 = PyFloat_FromDouble(__pyx_v_self->user_scale); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_23 = PyTuple_New(22); if (unlikely(!__pyx_t_23)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_21, 3, __pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_23, 3, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_21, 4, __pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_23, 4, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_21, 5, __pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_23, 5, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_21, 6, __pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_23, 6, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_21, 7, __pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_23, 7, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_21, 8, __pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_23, 8, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_21, 9, __pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_23, 9, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_21, 10, __pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_23, 10, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_21, 11, __pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_23, 11, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_21, 12, __pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_23, 12, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_14); - PyTuple_SET_ITEM(__pyx_t_21, 13, __pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_23, 13, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_21, 14, __pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_23, 14, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_21, 15, __pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_23, 15, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_21, 16, __pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_23, 16, __pyx_t_17); __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_21, 17, __pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_23, 17, __pyx_t_18); __Pyx_GIVEREF(__pyx_t_19); - PyTuple_SET_ITEM(__pyx_t_21, 18, __pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_23, 18, __pyx_t_19); __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_21, 19, __pyx_t_20); + PyTuple_SET_ITEM(__pyx_t_23, 19, __pyx_t_20); + __Pyx_GIVEREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_23, 20, __pyx_t_21); + __Pyx_GIVEREF(__pyx_t_22); + PyTuple_SET_ITEM(__pyx_t_23, 21, __pyx_t_22); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; @@ -4194,31 +4384,33 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_2__re __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; - __pyx_v_state = ((PyObject*)__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_22 = 0; + __pyx_v_state = ((PyObject*)__pyx_t_23); + __pyx_t_23 = 0; /* "(tree fragment)":6 * cdef bint use_setstate - * state = (self.adadelta, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) + * state = (self.adadelta, self.avg_loss, self.avg_loss_ctr, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< * if _dict is not None: * state += (_dict,) */ - __pyx_t_21 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); - __pyx_v__dict = __pyx_t_21; - __pyx_t_21 = 0; + __pyx_t_23 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_23)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + __pyx_v__dict = __pyx_t_23; + __pyx_t_23 = 0; /* "(tree fragment)":7 - * state = (self.adadelta, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) + * state = (self.adadelta, self.avg_loss, self.avg_loss_ctr, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) * _dict = getattr(self, '__dict__', None) * if _dict is not None: # <<<<<<<<<<<<<< * state += (_dict,) * use_setstate = True */ - __pyx_t_22 = (__pyx_v__dict != Py_None); - __pyx_t_23 = (__pyx_t_22 != 0); - if (__pyx_t_23) { + __pyx_t_24 = (__pyx_v__dict != Py_None); + __pyx_t_25 = (__pyx_t_24 != 0); + if (__pyx_t_25) { /* "(tree fragment)":8 * _dict = getattr(self, '__dict__', None) @@ -4227,16 +4419,16 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_2__re * use_setstate = True * else: */ - __pyx_t_21 = PyTuple_New(1); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); + __pyx_t_23 = PyTuple_New(1); if (unlikely(!__pyx_t_23)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); __Pyx_INCREF(__pyx_v__dict); __Pyx_GIVEREF(__pyx_v__dict); - PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_v__dict); - __pyx_t_20 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_20)); - __pyx_t_20 = 0; + PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_v__dict); + __pyx_t_22 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_22)); + __pyx_t_22 = 0; /* "(tree fragment)":9 * if _dict is not None: @@ -4248,7 +4440,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_2__re __pyx_v_use_setstate = 1; /* "(tree fragment)":7 - * state = (self.adadelta, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) + * state = (self.adadelta, self.avg_loss, self.avg_loss_ctr, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) * _dict = getattr(self, '__dict__', None) * if _dict is not None: # <<<<<<<<<<<<<< * state += (_dict,) @@ -4262,7 +4454,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_2__re * else: * use_setstate = False # <<<<<<<<<<<<<< * if use_setstate: - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, None), state + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, None), state */ /*else*/ { __pyx_v_use_setstate = 0; @@ -4273,89 +4465,89 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_2__re * else: * use_setstate = False * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, None), state + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, None), state * else: */ - __pyx_t_23 = (__pyx_v_use_setstate != 0); - if (__pyx_t_23) { + __pyx_t_25 = (__pyx_v_use_setstate != 0); + if (__pyx_t_25) { /* "(tree fragment)":13 * use_setstate = False * if use_setstate: - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, None), state # <<<<<<<<<<<<<< + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, None), state # <<<<<<<<<<<<<< * else: - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, state) + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, state) */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_pyx_unpickle_FastLightFM); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); + __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_pyx_unpickle_FastLightFM); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_23 = PyTuple_New(3); if (unlikely(!__pyx_t_23)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_21, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_232728138); - __Pyx_GIVEREF(__pyx_int_232728138); - PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_int_232728138); + PyTuple_SET_ITEM(__pyx_t_23, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_INCREF(__pyx_int_150189132); + __Pyx_GIVEREF(__pyx_int_150189132); + PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_int_150189132); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_21, 2, Py_None); - __pyx_t_19 = PyTuple_New(3); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_20); - __Pyx_GIVEREF(__pyx_t_21); - PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_23, 2, Py_None); + __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_GIVEREF(__pyx_t_22); + PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_22); + __Pyx_GIVEREF(__pyx_t_23); + PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_23); __Pyx_INCREF(__pyx_v_state); __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_v_state); - __pyx_t_20 = 0; + PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_v_state); + __pyx_t_22 = 0; + __pyx_t_23 = 0; + __pyx_r = __pyx_t_21; __pyx_t_21 = 0; - __pyx_r = __pyx_t_19; - __pyx_t_19 = 0; goto __pyx_L0; /* "(tree fragment)":12 * else: * use_setstate = False * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, None), state + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, None), state * else: */ } /* "(tree fragment)":15 - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, None), state + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, None), state * else: - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, state) # <<<<<<<<<<<<<< + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, state) # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * __pyx_unpickle_FastLightFM__set_state(self, __pyx_state) */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_pyx_unpickle_FastLightFM); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_pyx_unpickle_FastLightFM); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); + __pyx_t_23 = PyTuple_New(3); if (unlikely(!__pyx_t_23)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_21, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_232728138); - __Pyx_GIVEREF(__pyx_int_232728138); - PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_int_232728138); + PyTuple_SET_ITEM(__pyx_t_23, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_INCREF(__pyx_int_150189132); + __Pyx_GIVEREF(__pyx_int_150189132); + PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_int_150189132); __Pyx_INCREF(__pyx_v_state); __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_v_state); - __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __Pyx_GIVEREF(__pyx_t_19); - PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_v_state); + __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); __Pyx_GIVEREF(__pyx_t_21); - PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_21); - __pyx_t_19 = 0; + PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_21); + __Pyx_GIVEREF(__pyx_t_23); + PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_23); __pyx_t_21 = 0; - __pyx_r = __pyx_t_20; - __pyx_t_20 = 0; + __pyx_t_23 = 0; + __pyx_r = __pyx_t_22; + __pyx_t_22 = 0; goto __pyx_L0; } @@ -4388,6 +4580,8 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_2__re __Pyx_XDECREF(__pyx_t_19); __Pyx_XDECREF(__pyx_t_20); __Pyx_XDECREF(__pyx_t_21); + __Pyx_XDECREF(__pyx_t_22); + __Pyx_XDECREF(__pyx_t_23); __Pyx_AddTraceback("lightfm._lightfm_fast_no_openmp.FastLightFM.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -4400,7 +4594,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_2__re /* "(tree fragment)":16 * else: - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, state) + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle_FastLightFM__set_state(self, __pyx_state) */ @@ -4422,10 +4616,13 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_4__se PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":17 - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, state) + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, state) * def __setstate_cython__(self, __pyx_state): * __pyx_unpickle_FastLightFM__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ @@ -4436,7 +4633,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_4__se /* "(tree fragment)":16 * else: - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, state) + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle_FastLightFM__set_state(self, __pyx_state) */ @@ -4454,7 +4651,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_4__se return __pyx_r; } -/* "lightfm/_lightfm_fast_no_openmp.pyx":262 +/* "lightfm/_lightfm_fast_no_openmp.pyx":268 * * * cdef inline flt sigmoid(flt v) nogil: # <<<<<<<<<<<<<< @@ -4465,7 +4662,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_4__se static CYTHON_INLINE __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_f_7lightfm_23_lightfm_fast_no_openmp_sigmoid(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_v_v) { __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_r; - /* "lightfm/_lightfm_fast_no_openmp.pyx":267 + /* "lightfm/_lightfm_fast_no_openmp.pyx":273 * """ * * return 1.0 / (1.0 + exp(-v)) # <<<<<<<<<<<<<< @@ -4475,7 +4672,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_f_7lig __pyx_r = (1.0 / (1.0 + exp((-__pyx_v_v)))); goto __pyx_L0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":262 + /* "lightfm/_lightfm_fast_no_openmp.pyx":268 * * * cdef inline flt sigmoid(flt v) nogil: # <<<<<<<<<<<<<< @@ -4488,7 +4685,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_f_7lig return __pyx_r; } -/* "lightfm/_lightfm_fast_no_openmp.pyx":270 +/* "lightfm/_lightfm_fast_no_openmp.pyx":276 * * * cdef inline int in_positives(int item_id, int user_id, CSRMatrix interactions) nogil: # <<<<<<<<<<<<<< @@ -4503,7 +4700,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives Py_ssize_t __pyx_t_1; int __pyx_t_2; - /* "lightfm/_lightfm_fast_no_openmp.pyx":274 + /* "lightfm/_lightfm_fast_no_openmp.pyx":280 * cdef int i, start_idx, stop_idx * * start_idx = interactions.get_row_start(user_id) # <<<<<<<<<<<<<< @@ -4512,7 +4709,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives */ __pyx_v_start_idx = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_interactions->__pyx_vtab)->get_row_start(__pyx_v_interactions, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":275 + /* "lightfm/_lightfm_fast_no_openmp.pyx":281 * * start_idx = interactions.get_row_start(user_id) * stop_idx = interactions.get_row_end(user_id) # <<<<<<<<<<<<<< @@ -4521,7 +4718,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives */ __pyx_v_stop_idx = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_interactions->__pyx_vtab)->get_row_end(__pyx_v_interactions, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":278 + /* "lightfm/_lightfm_fast_no_openmp.pyx":284 * * if bsearch(&item_id, * &interactions.indices[start_idx], # <<<<<<<<<<<<<< @@ -4530,7 +4727,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives */ __pyx_t_1 = __pyx_v_start_idx; - /* "lightfm/_lightfm_fast_no_openmp.pyx":281 + /* "lightfm/_lightfm_fast_no_openmp.pyx":287 * stop_idx - start_idx, * sizeof(int), * int_compare) == NULL: # <<<<<<<<<<<<<< @@ -4539,7 +4736,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives */ __pyx_t_2 = ((bsearch((&__pyx_v_item_id), (&(*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_interactions->indices.data) + __pyx_t_1)) )))), (__pyx_v_stop_idx - __pyx_v_start_idx), (sizeof(int)), __pyx_f_7lightfm_23_lightfm_fast_no_openmp_int_compare) == NULL) != 0); - /* "lightfm/_lightfm_fast_no_openmp.pyx":277 + /* "lightfm/_lightfm_fast_no_openmp.pyx":283 * stop_idx = interactions.get_row_end(user_id) * * if bsearch(&item_id, # <<<<<<<<<<<<<< @@ -4548,7 +4745,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives */ if (__pyx_t_2) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":282 + /* "lightfm/_lightfm_fast_no_openmp.pyx":288 * sizeof(int), * int_compare) == NULL: * return 0 # <<<<<<<<<<<<<< @@ -4558,7 +4755,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives __pyx_r = 0; goto __pyx_L0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":277 + /* "lightfm/_lightfm_fast_no_openmp.pyx":283 * stop_idx = interactions.get_row_end(user_id) * * if bsearch(&item_id, # <<<<<<<<<<<<<< @@ -4567,7 +4764,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives */ } - /* "lightfm/_lightfm_fast_no_openmp.pyx":284 + /* "lightfm/_lightfm_fast_no_openmp.pyx":290 * return 0 * else: * return 1 # <<<<<<<<<<<<<< @@ -4579,7 +4776,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives goto __pyx_L0; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":270 + /* "lightfm/_lightfm_fast_no_openmp.pyx":276 * * * cdef inline int in_positives(int item_id, int user_id, CSRMatrix interactions) nogil: # <<<<<<<<<<<<<< @@ -4592,7 +4789,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives return __pyx_r; } -/* "lightfm/_lightfm_fast_no_openmp.pyx":287 +/* "lightfm/_lightfm_fast_no_openmp.pyx":293 * * * cdef inline void compute_representation(CSRMatrix features, # <<<<<<<<<<<<<< @@ -4613,16 +4810,13 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_rep int __pyx_t_4; int __pyx_t_5; Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; + int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; int __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_11; - /* "lightfm/_lightfm_fast_no_openmp.pyx":302 + /* "lightfm/_lightfm_fast_no_openmp.pyx":308 * cdef flt feature_weight * * start_index = features.get_row_start(row_id) # <<<<<<<<<<<<<< @@ -4631,7 +4825,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_rep */ __pyx_v_start_index = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_features->__pyx_vtab)->get_row_start(__pyx_v_features, __pyx_v_row_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":303 + /* "lightfm/_lightfm_fast_no_openmp.pyx":309 * * start_index = features.get_row_start(row_id) * stop_index = features.get_row_end(row_id) # <<<<<<<<<<<<<< @@ -4640,7 +4834,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_rep */ __pyx_v_stop_index = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_features->__pyx_vtab)->get_row_end(__pyx_v_features, __pyx_v_row_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":305 + /* "lightfm/_lightfm_fast_no_openmp.pyx":311 * stop_index = features.get_row_end(row_id) * * for i in range(lightfm.no_components + 1): # <<<<<<<<<<<<<< @@ -4652,7 +4846,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_rep for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "lightfm/_lightfm_fast_no_openmp.pyx":306 + /* "lightfm/_lightfm_fast_no_openmp.pyx":312 * * for i in range(lightfm.no_components + 1): * representation[i] = 0.0 # <<<<<<<<<<<<<< @@ -4662,7 +4856,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_rep (__pyx_v_representation[__pyx_v_i]) = 0.0; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":308 + /* "lightfm/_lightfm_fast_no_openmp.pyx":314 * representation[i] = 0.0 * * for i in range(start_index, stop_index): # <<<<<<<<<<<<<< @@ -4674,7 +4868,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_rep for (__pyx_t_5 = __pyx_v_start_index; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "lightfm/_lightfm_fast_no_openmp.pyx":310 + /* "lightfm/_lightfm_fast_no_openmp.pyx":316 * for i in range(start_index, stop_index): * * feature = features.indices[i] # <<<<<<<<<<<<<< @@ -4684,54 +4878,54 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_rep __pyx_t_6 = __pyx_v_i; __pyx_v_feature = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_features->indices.data) + __pyx_t_6)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":311 + /* "lightfm/_lightfm_fast_no_openmp.pyx":317 * * feature = features.indices[i] * feature_weight = features.data[i] * scale # <<<<<<<<<<<<<< * * for j in range(lightfm.no_components): */ - __pyx_t_7 = __pyx_v_i; - __pyx_v_feature_weight = ((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_features->data.data) + __pyx_t_7)) ))) * __pyx_v_scale); + __pyx_t_6 = __pyx_v_i; + __pyx_v_feature_weight = ((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_features->data.data) + __pyx_t_6)) ))) * __pyx_v_scale); - /* "lightfm/_lightfm_fast_no_openmp.pyx":313 + /* "lightfm/_lightfm_fast_no_openmp.pyx":319 * feature_weight = features.data[i] * scale * * for j in range(lightfm.no_components): # <<<<<<<<<<<<<< * * representation[j] += feature_weight * feature_embeddings[feature, j] */ - __pyx_t_8 = __pyx_v_lightfm->no_components; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_j = __pyx_t_10; + __pyx_t_7 = __pyx_v_lightfm->no_components; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_j = __pyx_t_9; - /* "lightfm/_lightfm_fast_no_openmp.pyx":315 + /* "lightfm/_lightfm_fast_no_openmp.pyx":321 * for j in range(lightfm.no_components): * * representation[j] += feature_weight * feature_embeddings[feature, j] # <<<<<<<<<<<<<< * * representation[lightfm.no_components] += feature_weight * feature_biases[feature] */ + __pyx_t_10 = __pyx_v_j; + __pyx_t_6 = __pyx_v_feature; __pyx_t_11 = __pyx_v_j; - __pyx_t_12 = __pyx_v_feature; - __pyx_t_13 = __pyx_v_j; - (__pyx_v_representation[__pyx_t_11]) = ((__pyx_v_representation[__pyx_t_11]) + (__pyx_v_feature_weight * (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_feature_embeddings.data + __pyx_t_12 * __pyx_v_feature_embeddings.strides[0]) )) + __pyx_t_13)) ))))); + (__pyx_v_representation[__pyx_t_10]) = ((__pyx_v_representation[__pyx_t_10]) + (__pyx_v_feature_weight * (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_feature_embeddings.data + __pyx_t_6 * __pyx_v_feature_embeddings.strides[0]) )) + __pyx_t_11)) ))))); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":317 + /* "lightfm/_lightfm_fast_no_openmp.pyx":323 * representation[j] += feature_weight * feature_embeddings[feature, j] * * representation[lightfm.no_components] += feature_weight * feature_biases[feature] # <<<<<<<<<<<<<< * * */ - __pyx_t_8 = __pyx_v_lightfm->no_components; - __pyx_t_14 = __pyx_v_feature; - (__pyx_v_representation[__pyx_t_8]) = ((__pyx_v_representation[__pyx_t_8]) + (__pyx_v_feature_weight * (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_feature_biases.data) + __pyx_t_14)) ))))); + __pyx_t_7 = __pyx_v_lightfm->no_components; + __pyx_t_11 = __pyx_v_feature; + (__pyx_v_representation[__pyx_t_7]) = ((__pyx_v_representation[__pyx_t_7]) + (__pyx_v_feature_weight * (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_feature_biases.data) + __pyx_t_11)) ))))); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":287 + /* "lightfm/_lightfm_fast_no_openmp.pyx":293 * * * cdef inline void compute_representation(CSRMatrix features, # <<<<<<<<<<<<<< @@ -4742,7 +4936,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_rep /* function exit code */ } -/* "lightfm/_lightfm_fast_no_openmp.pyx":320 +/* "lightfm/_lightfm_fast_no_openmp.pyx":326 * * * cdef inline flt compute_prediction_from_repr(flt *user_repr, # <<<<<<<<<<<<<< @@ -4758,7 +4952,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_f_7lig int __pyx_t_2; int __pyx_t_3; - /* "lightfm/_lightfm_fast_no_openmp.pyx":328 + /* "lightfm/_lightfm_fast_no_openmp.pyx":334 * * # Biases * result = user_repr[no_components] + item_repr[no_components] # <<<<<<<<<<<<<< @@ -4767,7 +4961,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_f_7lig */ __pyx_v_result = ((__pyx_v_user_repr[__pyx_v_no_components]) + (__pyx_v_item_repr[__pyx_v_no_components])); - /* "lightfm/_lightfm_fast_no_openmp.pyx":331 + /* "lightfm/_lightfm_fast_no_openmp.pyx":337 * * # Latent factor dot product * for i in range(no_components): # <<<<<<<<<<<<<< @@ -4779,7 +4973,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_f_7lig for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "lightfm/_lightfm_fast_no_openmp.pyx":332 + /* "lightfm/_lightfm_fast_no_openmp.pyx":338 * # Latent factor dot product * for i in range(no_components): * result += user_repr[i] * item_repr[i] # <<<<<<<<<<<<<< @@ -4789,7 +4983,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_f_7lig __pyx_v_result = (__pyx_v_result + ((__pyx_v_user_repr[__pyx_v_i]) * (__pyx_v_item_repr[__pyx_v_i]))); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":334 + /* "lightfm/_lightfm_fast_no_openmp.pyx":340 * result += user_repr[i] * item_repr[i] * * return result # <<<<<<<<<<<<<< @@ -4799,7 +4993,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_f_7lig __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":320 + /* "lightfm/_lightfm_fast_no_openmp.pyx":326 * * * cdef inline flt compute_prediction_from_repr(flt *user_repr, # <<<<<<<<<<<<<< @@ -4812,7 +5006,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_f_7lig return __pyx_r; } -/* "lightfm/_lightfm_fast_no_openmp.pyx":337 +/* "lightfm/_lightfm_fast_no_openmp.pyx":343 * * * cdef double update_biases(CSRMatrix feature_indices, # <<<<<<<<<<<<<< @@ -4834,22 +5028,8 @@ static double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(struct __ int __pyx_t_4; Py_ssize_t __pyx_t_5; Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - /* "lightfm/_lightfm_fast_no_openmp.pyx":356 + /* "lightfm/_lightfm_fast_no_openmp.pyx":362 * cdef double feature_weight, local_learning_rate, sum_learning_rate, update * * sum_learning_rate = 0.0 # <<<<<<<<<<<<<< @@ -4858,7 +5038,7 @@ static double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(struct __ */ __pyx_v_sum_learning_rate = 0.0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":358 + /* "lightfm/_lightfm_fast_no_openmp.pyx":364 * sum_learning_rate = 0.0 * * if adadelta: # <<<<<<<<<<<<<< @@ -4868,7 +5048,7 @@ static double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(struct __ __pyx_t_1 = (__pyx_v_adadelta != 0); if (__pyx_t_1) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":359 + /* "lightfm/_lightfm_fast_no_openmp.pyx":365 * * if adadelta: * for i in range(start, stop): # <<<<<<<<<<<<<< @@ -4880,7 +5060,7 @@ static double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(struct __ for (__pyx_t_4 = __pyx_v_start; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "lightfm/_lightfm_fast_no_openmp.pyx":361 + /* "lightfm/_lightfm_fast_no_openmp.pyx":367 * for i in range(start, stop): * * feature = feature_indices.indices[i] # <<<<<<<<<<<<<< @@ -4890,39 +5070,39 @@ static double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(struct __ __pyx_t_5 = __pyx_v_i; __pyx_v_feature = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_feature_indices->indices.data) + __pyx_t_5)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":362 + /* "lightfm/_lightfm_fast_no_openmp.pyx":368 * * feature = feature_indices.indices[i] * feature_weight = feature_indices.data[i] # <<<<<<<<<<<<<< * * gradients[feature] = rho * gradients[feature] + (1 - rho) * (feature_weight * gradient) ** 2 */ - __pyx_t_6 = __pyx_v_i; - __pyx_v_feature_weight = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_6)) ))); + __pyx_t_5 = __pyx_v_i; + __pyx_v_feature_weight = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_5)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":364 + /* "lightfm/_lightfm_fast_no_openmp.pyx":370 * feature_weight = feature_indices.data[i] * * gradients[feature] = rho * gradients[feature] + (1 - rho) * (feature_weight * gradient) ** 2 # <<<<<<<<<<<<<< * local_learning_rate = sqrt(momentum[feature] + eps) / sqrt(gradients[feature] + eps) * update = local_learning_rate * gradient * feature_weight */ - __pyx_t_7 = __pyx_v_feature; - __pyx_t_8 = __pyx_v_feature; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_8)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_7)) )))) + ((1.0 - __pyx_v_rho) * pow((__pyx_v_feature_weight * __pyx_v_gradient), 2.0))); + __pyx_t_5 = __pyx_v_feature; + __pyx_t_6 = __pyx_v_feature; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_6)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_5)) )))) + ((1.0 - __pyx_v_rho) * pow((__pyx_v_feature_weight * __pyx_v_gradient), 2.0))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":365 + /* "lightfm/_lightfm_fast_no_openmp.pyx":371 * * gradients[feature] = rho * gradients[feature] + (1 - rho) * (feature_weight * gradient) ** 2 * local_learning_rate = sqrt(momentum[feature] + eps) / sqrt(gradients[feature] + eps) # <<<<<<<<<<<<<< * update = local_learning_rate * gradient * feature_weight * momentum[feature] = rho * momentum[feature] + (1 - rho) * update ** 2 */ - __pyx_t_9 = __pyx_v_feature; - __pyx_t_10 = __pyx_v_feature; - __pyx_v_local_learning_rate = (sqrt(((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_momentum.data) + __pyx_t_9)) ))) + __pyx_v_eps)) / sqrt(((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_10)) ))) + __pyx_v_eps))); + __pyx_t_5 = __pyx_v_feature; + __pyx_t_6 = __pyx_v_feature; + __pyx_v_local_learning_rate = (sqrt(((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_momentum.data) + __pyx_t_5)) ))) + __pyx_v_eps)) / sqrt(((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_6)) ))) + __pyx_v_eps))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":366 + /* "lightfm/_lightfm_fast_no_openmp.pyx":372 * gradients[feature] = rho * gradients[feature] + (1 - rho) * (feature_weight * gradient) ** 2 * local_learning_rate = sqrt(momentum[feature] + eps) / sqrt(gradients[feature] + eps) * update = local_learning_rate * gradient * feature_weight # <<<<<<<<<<<<<< @@ -4931,38 +5111,38 @@ static double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(struct __ */ __pyx_v_update = ((__pyx_v_local_learning_rate * __pyx_v_gradient) * __pyx_v_feature_weight); - /* "lightfm/_lightfm_fast_no_openmp.pyx":367 + /* "lightfm/_lightfm_fast_no_openmp.pyx":373 * local_learning_rate = sqrt(momentum[feature] + eps) / sqrt(gradients[feature] + eps) * update = local_learning_rate * gradient * feature_weight * momentum[feature] = rho * momentum[feature] + (1 - rho) * update ** 2 # <<<<<<<<<<<<<< * biases[feature] -= update * */ - __pyx_t_11 = __pyx_v_feature; - __pyx_t_12 = __pyx_v_feature; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_momentum.data) + __pyx_t_12)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_momentum.data) + __pyx_t_11)) )))) + ((1.0 - __pyx_v_rho) * pow(__pyx_v_update, 2.0))); + __pyx_t_6 = __pyx_v_feature; + __pyx_t_5 = __pyx_v_feature; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_momentum.data) + __pyx_t_5)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_momentum.data) + __pyx_t_6)) )))) + ((1.0 - __pyx_v_rho) * pow(__pyx_v_update, 2.0))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":368 + /* "lightfm/_lightfm_fast_no_openmp.pyx":374 * update = local_learning_rate * gradient * feature_weight * momentum[feature] = rho * momentum[feature] + (1 - rho) * update ** 2 * biases[feature] -= update # <<<<<<<<<<<<<< * * # Lazy regularization: scale up by the regularization */ - __pyx_t_13 = __pyx_v_feature; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_biases.data) + __pyx_t_13)) )) -= __pyx_v_update; + __pyx_t_6 = __pyx_v_feature; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_biases.data) + __pyx_t_6)) )) -= __pyx_v_update; - /* "lightfm/_lightfm_fast_no_openmp.pyx":372 + /* "lightfm/_lightfm_fast_no_openmp.pyx":378 * # Lazy regularization: scale up by the regularization * # parameter. * biases[feature] *= (1.0 + alpha * local_learning_rate) # <<<<<<<<<<<<<< * * sum_learning_rate += local_learning_rate */ - __pyx_t_14 = __pyx_v_feature; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_biases.data) + __pyx_t_14)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); + __pyx_t_6 = __pyx_v_feature; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_biases.data) + __pyx_t_6)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":374 + /* "lightfm/_lightfm_fast_no_openmp.pyx":380 * biases[feature] *= (1.0 + alpha * local_learning_rate) * * sum_learning_rate += local_learning_rate # <<<<<<<<<<<<<< @@ -4972,7 +5152,7 @@ static double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(struct __ __pyx_v_sum_learning_rate = (__pyx_v_sum_learning_rate + __pyx_v_local_learning_rate); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":358 + /* "lightfm/_lightfm_fast_no_openmp.pyx":364 * sum_learning_rate = 0.0 * * if adadelta: # <<<<<<<<<<<<<< @@ -4982,7 +5162,7 @@ static double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(struct __ goto __pyx_L3; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":376 + /* "lightfm/_lightfm_fast_no_openmp.pyx":382 * sum_learning_rate += local_learning_rate * else: * for i in range(start, stop): # <<<<<<<<<<<<<< @@ -4995,67 +5175,67 @@ static double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(struct __ for (__pyx_t_4 = __pyx_v_start; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "lightfm/_lightfm_fast_no_openmp.pyx":378 + /* "lightfm/_lightfm_fast_no_openmp.pyx":384 * for i in range(start, stop): * * feature = feature_indices.indices[i] # <<<<<<<<<<<<<< * feature_weight = feature_indices.data[i] * */ - __pyx_t_15 = __pyx_v_i; - __pyx_v_feature = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_feature_indices->indices.data) + __pyx_t_15)) ))); + __pyx_t_6 = __pyx_v_i; + __pyx_v_feature = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_feature_indices->indices.data) + __pyx_t_6)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":379 + /* "lightfm/_lightfm_fast_no_openmp.pyx":385 * * feature = feature_indices.indices[i] * feature_weight = feature_indices.data[i] # <<<<<<<<<<<<<< * * local_learning_rate = learning_rate / sqrt(gradients[feature]) */ - __pyx_t_16 = __pyx_v_i; - __pyx_v_feature_weight = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_16)) ))); + __pyx_t_6 = __pyx_v_i; + __pyx_v_feature_weight = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_6)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":381 + /* "lightfm/_lightfm_fast_no_openmp.pyx":387 * feature_weight = feature_indices.data[i] * * local_learning_rate = learning_rate / sqrt(gradients[feature]) # <<<<<<<<<<<<<< * biases[feature] -= local_learning_rate * feature_weight * gradient * gradients[feature] += (gradient * feature_weight) ** 2 */ - __pyx_t_17 = __pyx_v_feature; - __pyx_v_local_learning_rate = (__pyx_v_learning_rate / sqrt((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_17)) ))))); + __pyx_t_6 = __pyx_v_feature; + __pyx_v_local_learning_rate = (__pyx_v_learning_rate / sqrt((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_6)) ))))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":382 + /* "lightfm/_lightfm_fast_no_openmp.pyx":388 * * local_learning_rate = learning_rate / sqrt(gradients[feature]) * biases[feature] -= local_learning_rate * feature_weight * gradient # <<<<<<<<<<<<<< * gradients[feature] += (gradient * feature_weight) ** 2 * */ - __pyx_t_18 = __pyx_v_feature; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_biases.data) + __pyx_t_18)) )) -= ((__pyx_v_local_learning_rate * __pyx_v_feature_weight) * __pyx_v_gradient); + __pyx_t_6 = __pyx_v_feature; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_biases.data) + __pyx_t_6)) )) -= ((__pyx_v_local_learning_rate * __pyx_v_feature_weight) * __pyx_v_gradient); - /* "lightfm/_lightfm_fast_no_openmp.pyx":383 + /* "lightfm/_lightfm_fast_no_openmp.pyx":389 * local_learning_rate = learning_rate / sqrt(gradients[feature]) * biases[feature] -= local_learning_rate * feature_weight * gradient * gradients[feature] += (gradient * feature_weight) ** 2 # <<<<<<<<<<<<<< * * # Lazy regularization: scale up by the regularization */ - __pyx_t_19 = __pyx_v_feature; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_19)) )) += pow((__pyx_v_gradient * __pyx_v_feature_weight), 2.0); + __pyx_t_6 = __pyx_v_feature; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_6)) )) += pow((__pyx_v_gradient * __pyx_v_feature_weight), 2.0); - /* "lightfm/_lightfm_fast_no_openmp.pyx":387 + /* "lightfm/_lightfm_fast_no_openmp.pyx":393 * # Lazy regularization: scale up by the regularization * # parameter. * biases[feature] *= (1.0 + alpha * local_learning_rate) # <<<<<<<<<<<<<< * * sum_learning_rate += local_learning_rate */ - __pyx_t_20 = __pyx_v_feature; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_biases.data) + __pyx_t_20)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); + __pyx_t_6 = __pyx_v_feature; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_biases.data) + __pyx_t_6)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":389 + /* "lightfm/_lightfm_fast_no_openmp.pyx":395 * biases[feature] *= (1.0 + alpha * local_learning_rate) * * sum_learning_rate += local_learning_rate # <<<<<<<<<<<<<< @@ -5067,7 +5247,7 @@ static double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(struct __ } __pyx_L3:; - /* "lightfm/_lightfm_fast_no_openmp.pyx":391 + /* "lightfm/_lightfm_fast_no_openmp.pyx":397 * sum_learning_rate += local_learning_rate * * return sum_learning_rate # <<<<<<<<<<<<<< @@ -5077,7 +5257,7 @@ static double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(struct __ __pyx_r = __pyx_v_sum_learning_rate; goto __pyx_L0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":337 + /* "lightfm/_lightfm_fast_no_openmp.pyx":343 * * * cdef double update_biases(CSRMatrix feature_indices, # <<<<<<<<<<<<<< @@ -5090,7 +5270,7 @@ static double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(struct __ return __pyx_r; } -/* "lightfm/_lightfm_fast_no_openmp.pyx":394 +/* "lightfm/_lightfm_fast_no_openmp.pyx":400 * * * cdef inline double update_features(CSRMatrix feature_indices, # <<<<<<<<<<<<<< @@ -5114,32 +5294,8 @@ static CYTHON_INLINE double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_fe Py_ssize_t __pyx_t_6; Py_ssize_t __pyx_t_7; Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; - Py_ssize_t __pyx_t_29; - Py_ssize_t __pyx_t_30; - Py_ssize_t __pyx_t_31; - Py_ssize_t __pyx_t_32; - - /* "lightfm/_lightfm_fast_no_openmp.pyx":414 + + /* "lightfm/_lightfm_fast_no_openmp.pyx":420 * cdef double feature_weight, local_learning_rate, sum_learning_rate, update * * sum_learning_rate = 0.0 # <<<<<<<<<<<<<< @@ -5148,7 +5304,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_fe */ __pyx_v_sum_learning_rate = 0.0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":416 + /* "lightfm/_lightfm_fast_no_openmp.pyx":422 * sum_learning_rate = 0.0 * * if adadelta: # <<<<<<<<<<<<<< @@ -5158,7 +5314,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_fe __pyx_t_1 = (__pyx_v_adadelta != 0); if (__pyx_t_1) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":417 + /* "lightfm/_lightfm_fast_no_openmp.pyx":423 * * if adadelta: * for i in range(start, stop): # <<<<<<<<<<<<<< @@ -5170,7 +5326,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_fe for (__pyx_t_4 = __pyx_v_start; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "lightfm/_lightfm_fast_no_openmp.pyx":419 + /* "lightfm/_lightfm_fast_no_openmp.pyx":425 * for i in range(start, stop): * * feature = feature_indices.indices[i] # <<<<<<<<<<<<<< @@ -5180,59 +5336,59 @@ static CYTHON_INLINE double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_fe __pyx_t_5 = __pyx_v_i; __pyx_v_feature = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_feature_indices->indices.data) + __pyx_t_5)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":420 + /* "lightfm/_lightfm_fast_no_openmp.pyx":426 * * feature = feature_indices.indices[i] * feature_weight = feature_indices.data[i] # <<<<<<<<<<<<<< * * gradients[feature, component] = (rho * gradients[feature, component] */ - __pyx_t_6 = __pyx_v_i; - __pyx_v_feature_weight = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_6)) ))); + __pyx_t_5 = __pyx_v_i; + __pyx_v_feature_weight = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_5)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":422 + /* "lightfm/_lightfm_fast_no_openmp.pyx":428 * feature_weight = feature_indices.data[i] * * gradients[feature, component] = (rho * gradients[feature, component] # <<<<<<<<<<<<<< * + (1 - rho) * (feature_weight * gradient) ** 2) * local_learning_rate = (sqrt(momentum[feature, component] + eps) */ - __pyx_t_7 = __pyx_v_feature; - __pyx_t_8 = __pyx_v_component; + __pyx_t_5 = __pyx_v_feature; + __pyx_t_6 = __pyx_v_component; - /* "lightfm/_lightfm_fast_no_openmp.pyx":423 + /* "lightfm/_lightfm_fast_no_openmp.pyx":429 * * gradients[feature, component] = (rho * gradients[feature, component] * + (1 - rho) * (feature_weight * gradient) ** 2) # <<<<<<<<<<<<<< * local_learning_rate = (sqrt(momentum[feature, component] + eps) * / sqrt(gradients[feature, component] + eps)) */ - __pyx_t_9 = __pyx_v_feature; - __pyx_t_10 = __pyx_v_component; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_9 * __pyx_v_gradients.strides[0]) )) + __pyx_t_10)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_7 * __pyx_v_gradients.strides[0]) )) + __pyx_t_8)) )))) + ((1.0 - __pyx_v_rho) * pow((__pyx_v_feature_weight * __pyx_v_gradient), 2.0))); + __pyx_t_7 = __pyx_v_feature; + __pyx_t_8 = __pyx_v_component; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_7 * __pyx_v_gradients.strides[0]) )) + __pyx_t_8)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_5 * __pyx_v_gradients.strides[0]) )) + __pyx_t_6)) )))) + ((1.0 - __pyx_v_rho) * pow((__pyx_v_feature_weight * __pyx_v_gradient), 2.0))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":424 + /* "lightfm/_lightfm_fast_no_openmp.pyx":430 * gradients[feature, component] = (rho * gradients[feature, component] * + (1 - rho) * (feature_weight * gradient) ** 2) * local_learning_rate = (sqrt(momentum[feature, component] + eps) # <<<<<<<<<<<<<< * / sqrt(gradients[feature, component] + eps)) * update = local_learning_rate * gradient * feature_weight */ - __pyx_t_11 = __pyx_v_feature; - __pyx_t_12 = __pyx_v_component; + __pyx_t_6 = __pyx_v_feature; + __pyx_t_5 = __pyx_v_component; - /* "lightfm/_lightfm_fast_no_openmp.pyx":425 + /* "lightfm/_lightfm_fast_no_openmp.pyx":431 * + (1 - rho) * (feature_weight * gradient) ** 2) * local_learning_rate = (sqrt(momentum[feature, component] + eps) * / sqrt(gradients[feature, component] + eps)) # <<<<<<<<<<<<<< * update = local_learning_rate * gradient * feature_weight * momentum[feature, component] = rho * momentum[feature, component] + (1 - rho) * update ** 2 */ - __pyx_t_13 = __pyx_v_feature; - __pyx_t_14 = __pyx_v_component; - __pyx_v_local_learning_rate = (sqrt(((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_momentum.data + __pyx_t_11 * __pyx_v_momentum.strides[0]) )) + __pyx_t_12)) ))) + __pyx_v_eps)) / sqrt(((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_13 * __pyx_v_gradients.strides[0]) )) + __pyx_t_14)) ))) + __pyx_v_eps))); + __pyx_t_8 = __pyx_v_feature; + __pyx_t_7 = __pyx_v_component; + __pyx_v_local_learning_rate = (sqrt(((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_momentum.data + __pyx_t_6 * __pyx_v_momentum.strides[0]) )) + __pyx_t_5)) ))) + __pyx_v_eps)) / sqrt(((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_8 * __pyx_v_gradients.strides[0]) )) + __pyx_t_7)) ))) + __pyx_v_eps))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":426 + /* "lightfm/_lightfm_fast_no_openmp.pyx":432 * local_learning_rate = (sqrt(momentum[feature, component] + eps) * / sqrt(gradients[feature, component] + eps)) * update = local_learning_rate * gradient * feature_weight # <<<<<<<<<<<<<< @@ -5241,42 +5397,42 @@ static CYTHON_INLINE double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_fe */ __pyx_v_update = ((__pyx_v_local_learning_rate * __pyx_v_gradient) * __pyx_v_feature_weight); - /* "lightfm/_lightfm_fast_no_openmp.pyx":427 + /* "lightfm/_lightfm_fast_no_openmp.pyx":433 * / sqrt(gradients[feature, component] + eps)) * update = local_learning_rate * gradient * feature_weight * momentum[feature, component] = rho * momentum[feature, component] + (1 - rho) * update ** 2 # <<<<<<<<<<<<<< * features[feature, component] -= update * */ - __pyx_t_15 = __pyx_v_feature; - __pyx_t_16 = __pyx_v_component; - __pyx_t_17 = __pyx_v_feature; - __pyx_t_18 = __pyx_v_component; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_momentum.data + __pyx_t_17 * __pyx_v_momentum.strides[0]) )) + __pyx_t_18)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_momentum.data + __pyx_t_15 * __pyx_v_momentum.strides[0]) )) + __pyx_t_16)) )))) + ((1.0 - __pyx_v_rho) * pow(__pyx_v_update, 2.0))); + __pyx_t_7 = __pyx_v_feature; + __pyx_t_8 = __pyx_v_component; + __pyx_t_5 = __pyx_v_feature; + __pyx_t_6 = __pyx_v_component; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_momentum.data + __pyx_t_5 * __pyx_v_momentum.strides[0]) )) + __pyx_t_6)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_momentum.data + __pyx_t_7 * __pyx_v_momentum.strides[0]) )) + __pyx_t_8)) )))) + ((1.0 - __pyx_v_rho) * pow(__pyx_v_update, 2.0))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":428 + /* "lightfm/_lightfm_fast_no_openmp.pyx":434 * update = local_learning_rate * gradient * feature_weight * momentum[feature, component] = rho * momentum[feature, component] + (1 - rho) * update ** 2 * features[feature, component] -= update # <<<<<<<<<<<<<< * * # Lazy regularization: scale up by the regularization */ - __pyx_t_19 = __pyx_v_feature; - __pyx_t_20 = __pyx_v_component; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_19 * __pyx_v_features.strides[0]) )) + __pyx_t_20)) )) -= __pyx_v_update; + __pyx_t_8 = __pyx_v_feature; + __pyx_t_7 = __pyx_v_component; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_8 * __pyx_v_features.strides[0]) )) + __pyx_t_7)) )) -= __pyx_v_update; - /* "lightfm/_lightfm_fast_no_openmp.pyx":432 + /* "lightfm/_lightfm_fast_no_openmp.pyx":438 * # Lazy regularization: scale up by the regularization * # parameter. * features[feature, component] *= (1.0 + alpha * local_learning_rate) # <<<<<<<<<<<<<< * * sum_learning_rate += local_learning_rate */ - __pyx_t_21 = __pyx_v_feature; - __pyx_t_22 = __pyx_v_component; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_21 * __pyx_v_features.strides[0]) )) + __pyx_t_22)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); + __pyx_t_7 = __pyx_v_feature; + __pyx_t_8 = __pyx_v_component; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_7 * __pyx_v_features.strides[0]) )) + __pyx_t_8)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":434 + /* "lightfm/_lightfm_fast_no_openmp.pyx":440 * features[feature, component] *= (1.0 + alpha * local_learning_rate) * * sum_learning_rate += local_learning_rate # <<<<<<<<<<<<<< @@ -5286,7 +5442,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_fe __pyx_v_sum_learning_rate = (__pyx_v_sum_learning_rate + __pyx_v_local_learning_rate); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":416 + /* "lightfm/_lightfm_fast_no_openmp.pyx":422 * sum_learning_rate = 0.0 * * if adadelta: # <<<<<<<<<<<<<< @@ -5296,7 +5452,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_fe goto __pyx_L3; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":436 + /* "lightfm/_lightfm_fast_no_openmp.pyx":442 * sum_learning_rate += local_learning_rate * else: * for i in range(start, stop): # <<<<<<<<<<<<<< @@ -5309,71 +5465,71 @@ static CYTHON_INLINE double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_fe for (__pyx_t_4 = __pyx_v_start; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "lightfm/_lightfm_fast_no_openmp.pyx":438 + /* "lightfm/_lightfm_fast_no_openmp.pyx":444 * for i in range(start, stop): * * feature = feature_indices.indices[i] # <<<<<<<<<<<<<< * feature_weight = feature_indices.data[i] * */ - __pyx_t_23 = __pyx_v_i; - __pyx_v_feature = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_feature_indices->indices.data) + __pyx_t_23)) ))); + __pyx_t_8 = __pyx_v_i; + __pyx_v_feature = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_feature_indices->indices.data) + __pyx_t_8)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":439 + /* "lightfm/_lightfm_fast_no_openmp.pyx":445 * * feature = feature_indices.indices[i] * feature_weight = feature_indices.data[i] # <<<<<<<<<<<<<< * * local_learning_rate = learning_rate / sqrt(gradients[feature, component]) */ - __pyx_t_24 = __pyx_v_i; - __pyx_v_feature_weight = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_24)) ))); + __pyx_t_8 = __pyx_v_i; + __pyx_v_feature_weight = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_8)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":441 + /* "lightfm/_lightfm_fast_no_openmp.pyx":447 * feature_weight = feature_indices.data[i] * * local_learning_rate = learning_rate / sqrt(gradients[feature, component]) # <<<<<<<<<<<<<< * features[feature, component] -= local_learning_rate * feature_weight * gradient * gradients[feature, component] += (gradient * feature_weight) ** 2 */ - __pyx_t_25 = __pyx_v_feature; - __pyx_t_26 = __pyx_v_component; - __pyx_v_local_learning_rate = (__pyx_v_learning_rate / sqrt((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_25 * __pyx_v_gradients.strides[0]) )) + __pyx_t_26)) ))))); + __pyx_t_8 = __pyx_v_feature; + __pyx_t_7 = __pyx_v_component; + __pyx_v_local_learning_rate = (__pyx_v_learning_rate / sqrt((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_8 * __pyx_v_gradients.strides[0]) )) + __pyx_t_7)) ))))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":442 + /* "lightfm/_lightfm_fast_no_openmp.pyx":448 * * local_learning_rate = learning_rate / sqrt(gradients[feature, component]) * features[feature, component] -= local_learning_rate * feature_weight * gradient # <<<<<<<<<<<<<< * gradients[feature, component] += (gradient * feature_weight) ** 2 * */ - __pyx_t_27 = __pyx_v_feature; - __pyx_t_28 = __pyx_v_component; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_27 * __pyx_v_features.strides[0]) )) + __pyx_t_28)) )) -= ((__pyx_v_local_learning_rate * __pyx_v_feature_weight) * __pyx_v_gradient); + __pyx_t_7 = __pyx_v_feature; + __pyx_t_8 = __pyx_v_component; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_7 * __pyx_v_features.strides[0]) )) + __pyx_t_8)) )) -= ((__pyx_v_local_learning_rate * __pyx_v_feature_weight) * __pyx_v_gradient); - /* "lightfm/_lightfm_fast_no_openmp.pyx":443 + /* "lightfm/_lightfm_fast_no_openmp.pyx":449 * local_learning_rate = learning_rate / sqrt(gradients[feature, component]) * features[feature, component] -= local_learning_rate * feature_weight * gradient * gradients[feature, component] += (gradient * feature_weight) ** 2 # <<<<<<<<<<<<<< * * # Lazy regularization: scale up by the regularization */ - __pyx_t_29 = __pyx_v_feature; - __pyx_t_30 = __pyx_v_component; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_29 * __pyx_v_gradients.strides[0]) )) + __pyx_t_30)) )) += pow((__pyx_v_gradient * __pyx_v_feature_weight), 2.0); + __pyx_t_8 = __pyx_v_feature; + __pyx_t_7 = __pyx_v_component; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_8 * __pyx_v_gradients.strides[0]) )) + __pyx_t_7)) )) += pow((__pyx_v_gradient * __pyx_v_feature_weight), 2.0); - /* "lightfm/_lightfm_fast_no_openmp.pyx":447 + /* "lightfm/_lightfm_fast_no_openmp.pyx":453 * # Lazy regularization: scale up by the regularization * # parameter. * features[feature, component] *= (1.0 + alpha * local_learning_rate) # <<<<<<<<<<<<<< * * sum_learning_rate += local_learning_rate */ - __pyx_t_31 = __pyx_v_feature; - __pyx_t_32 = __pyx_v_component; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_31 * __pyx_v_features.strides[0]) )) + __pyx_t_32)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); + __pyx_t_7 = __pyx_v_feature; + __pyx_t_8 = __pyx_v_component; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_7 * __pyx_v_features.strides[0]) )) + __pyx_t_8)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":449 + /* "lightfm/_lightfm_fast_no_openmp.pyx":455 * features[feature, component] *= (1.0 + alpha * local_learning_rate) * * sum_learning_rate += local_learning_rate # <<<<<<<<<<<<<< @@ -5385,7 +5541,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_fe } __pyx_L3:; - /* "lightfm/_lightfm_fast_no_openmp.pyx":451 + /* "lightfm/_lightfm_fast_no_openmp.pyx":457 * sum_learning_rate += local_learning_rate * * return sum_learning_rate # <<<<<<<<<<<<<< @@ -5395,7 +5551,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_fe __pyx_r = __pyx_v_sum_learning_rate; goto __pyx_L0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":394 + /* "lightfm/_lightfm_fast_no_openmp.pyx":400 * * * cdef inline double update_features(CSRMatrix feature_indices, # <<<<<<<<<<<<<< @@ -5408,7 +5564,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_fe return __pyx_r; } -/* "lightfm/_lightfm_fast_no_openmp.pyx":454 +/* "lightfm/_lightfm_fast_no_openmp.pyx":460 * * * cdef inline void update(double loss, # <<<<<<<<<<<<<< @@ -5429,7 +5585,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub int __pyx_t_2; int __pyx_t_3; - /* "lightfm/_lightfm_fast_no_openmp.pyx":472 + /* "lightfm/_lightfm_fast_no_openmp.pyx":478 * cdef flt item_component, user_component * * avg_learning_rate = 0.0 # <<<<<<<<<<<<<< @@ -5438,7 +5594,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub */ __pyx_v_avg_learning_rate = 0.0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":476 + /* "lightfm/_lightfm_fast_no_openmp.pyx":482 * # Get the iteration ranges for features * # for this training example. * item_start_index = item_features.get_row_start(item_id) # <<<<<<<<<<<<<< @@ -5447,7 +5603,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub */ __pyx_v_item_start_index = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_item_features->__pyx_vtab)->get_row_start(__pyx_v_item_features, __pyx_v_item_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":477 + /* "lightfm/_lightfm_fast_no_openmp.pyx":483 * # for this training example. * item_start_index = item_features.get_row_start(item_id) * item_stop_index = item_features.get_row_end(item_id) # <<<<<<<<<<<<<< @@ -5456,7 +5612,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub */ __pyx_v_item_stop_index = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_item_features->__pyx_vtab)->get_row_end(__pyx_v_item_features, __pyx_v_item_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":479 + /* "lightfm/_lightfm_fast_no_openmp.pyx":485 * item_stop_index = item_features.get_row_end(item_id) * * user_start_index = user_features.get_row_start(user_id) # <<<<<<<<<<<<<< @@ -5465,7 +5621,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub */ __pyx_v_user_start_index = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_user_features->__pyx_vtab)->get_row_start(__pyx_v_user_features, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":480 + /* "lightfm/_lightfm_fast_no_openmp.pyx":486 * * user_start_index = user_features.get_row_start(user_id) * user_stop_index = user_features.get_row_end(user_id) # <<<<<<<<<<<<<< @@ -5474,7 +5630,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub */ __pyx_v_user_stop_index = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_user_features->__pyx_vtab)->get_row_end(__pyx_v_user_features, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":482 + /* "lightfm/_lightfm_fast_no_openmp.pyx":488 * user_stop_index = user_features.get_row_end(user_id) * * avg_learning_rate += update_biases(item_features, item_start_index, item_stop_index, # <<<<<<<<<<<<<< @@ -5483,7 +5639,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(__pyx_v_item_features, __pyx_v_item_start_index, __pyx_v_item_stop_index, __pyx_v_lightfm->item_biases, __pyx_v_lightfm->item_bias_gradients, __pyx_v_lightfm->item_bias_momentum, __pyx_v_loss, __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_item_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":491 + /* "lightfm/_lightfm_fast_no_openmp.pyx":497 * lightfm.rho, * lightfm.eps) * avg_learning_rate += update_biases(user_features, user_start_index, user_stop_index, # <<<<<<<<<<<<<< @@ -5492,7 +5648,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(__pyx_v_user_features, __pyx_v_user_start_index, __pyx_v_user_stop_index, __pyx_v_lightfm->user_biases, __pyx_v_lightfm->user_bias_gradients, __pyx_v_lightfm->user_bias_momentum, __pyx_v_loss, __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_user_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":502 + /* "lightfm/_lightfm_fast_no_openmp.pyx":508 * * # Update latent representations. * for i in range(lightfm.no_components): # <<<<<<<<<<<<<< @@ -5504,7 +5660,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "lightfm/_lightfm_fast_no_openmp.pyx":504 + /* "lightfm/_lightfm_fast_no_openmp.pyx":510 * for i in range(lightfm.no_components): * * user_component = user_repr[i] # <<<<<<<<<<<<<< @@ -5513,7 +5669,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub */ __pyx_v_user_component = (__pyx_v_user_repr[__pyx_v_i]); - /* "lightfm/_lightfm_fast_no_openmp.pyx":505 + /* "lightfm/_lightfm_fast_no_openmp.pyx":511 * * user_component = user_repr[i] * item_component = it_repr[i] # <<<<<<<<<<<<<< @@ -5522,7 +5678,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub */ __pyx_v_item_component = (__pyx_v_it_repr[__pyx_v_i]); - /* "lightfm/_lightfm_fast_no_openmp.pyx":507 + /* "lightfm/_lightfm_fast_no_openmp.pyx":513 * item_component = it_repr[i] * * avg_learning_rate += update_features(item_features, lightfm.item_features, # <<<<<<<<<<<<<< @@ -5531,7 +5687,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_features(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_feature_gradients, __pyx_v_lightfm->item_feature_momentum, __pyx_v_i, __pyx_v_item_start_index, __pyx_v_item_stop_index, (__pyx_v_loss * __pyx_v_user_component), __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_item_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":517 + /* "lightfm/_lightfm_fast_no_openmp.pyx":523 * lightfm.rho, * lightfm.eps) * avg_learning_rate += update_features(user_features, lightfm.user_features, # <<<<<<<<<<<<<< @@ -5541,7 +5697,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_features(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_feature_gradients, __pyx_v_lightfm->user_feature_momentum, __pyx_v_i, __pyx_v_user_start_index, __pyx_v_user_stop_index, (__pyx_v_loss * __pyx_v_item_component), __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_user_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":528 + /* "lightfm/_lightfm_fast_no_openmp.pyx":534 * lightfm.eps) * * avg_learning_rate /= ((lightfm.no_components + 1) * (user_stop_index - user_start_index) # <<<<<<<<<<<<<< @@ -5550,7 +5706,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate / (((__pyx_v_lightfm->no_components + 1) * (__pyx_v_user_stop_index - __pyx_v_user_start_index)) + ((__pyx_v_lightfm->no_components + 1) * (__pyx_v_item_stop_index - __pyx_v_item_start_index)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":533 + /* "lightfm/_lightfm_fast_no_openmp.pyx":539 * # Update the scaling factors for lazy regularization, using the average learning rate * # of features updated for this example. * lightfm.item_scale *= (1.0 + item_alpha * avg_learning_rate) # <<<<<<<<<<<<<< @@ -5559,16 +5715,34 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub */ __pyx_v_lightfm->item_scale = (__pyx_v_lightfm->item_scale * (1.0 + (__pyx_v_item_alpha * __pyx_v_avg_learning_rate))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":534 + /* "lightfm/_lightfm_fast_no_openmp.pyx":540 * # of features updated for this example. * lightfm.item_scale *= (1.0 + item_alpha * avg_learning_rate) * lightfm.user_scale *= (1.0 + user_alpha * avg_learning_rate) # <<<<<<<<<<<<<< * - * + * lightfm.avg_loss_ctr += 1 */ __pyx_v_lightfm->user_scale = (__pyx_v_lightfm->user_scale * (1.0 + (__pyx_v_user_alpha * __pyx_v_avg_learning_rate))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":454 + /* "lightfm/_lightfm_fast_no_openmp.pyx":542 + * lightfm.user_scale *= (1.0 + user_alpha * avg_learning_rate) + * + * lightfm.avg_loss_ctr += 1 # <<<<<<<<<<<<<< + * lightfm.avg_loss = (lightfm.avg_loss * (lightfm.avg_loss_ctr - 1) + loss) / lightfm.avg_loss_ctr + * + */ + __pyx_v_lightfm->avg_loss_ctr = (__pyx_v_lightfm->avg_loss_ctr + 1); + + /* "lightfm/_lightfm_fast_no_openmp.pyx":543 + * + * lightfm.avg_loss_ctr += 1 + * lightfm.avg_loss = (lightfm.avg_loss * (lightfm.avg_loss_ctr - 1) + loss) / lightfm.avg_loss_ctr # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_lightfm->avg_loss = (((__pyx_v_lightfm->avg_loss * (__pyx_v_lightfm->avg_loss_ctr - 1)) + __pyx_v_loss) / __pyx_v_lightfm->avg_loss_ctr); + + /* "lightfm/_lightfm_fast_no_openmp.pyx":460 * * * cdef inline void update(double loss, # <<<<<<<<<<<<<< @@ -5579,7 +5753,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(doub /* function exit code */ } -/* "lightfm/_lightfm_fast_no_openmp.pyx":537 +/* "lightfm/_lightfm_fast_no_openmp.pyx":546 * * * cdef void warp_update(double loss, # <<<<<<<<<<<<<< @@ -5603,7 +5777,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ int __pyx_t_2; int __pyx_t_3; - /* "lightfm/_lightfm_fast_no_openmp.pyx":558 + /* "lightfm/_lightfm_fast_no_openmp.pyx":567 * cdef flt positive_item_component, negative_item_component, user_component * * avg_learning_rate = 0.0 # <<<<<<<<<<<<<< @@ -5612,7 +5786,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_avg_learning_rate = 0.0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":562 + /* "lightfm/_lightfm_fast_no_openmp.pyx":571 * # Get the iteration ranges for features * # for this training example. * positive_item_start_index = item_features.get_row_start(positive_item_id) # <<<<<<<<<<<<<< @@ -5621,7 +5795,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_positive_item_start_index = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_item_features->__pyx_vtab)->get_row_start(__pyx_v_item_features, __pyx_v_positive_item_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":563 + /* "lightfm/_lightfm_fast_no_openmp.pyx":572 * # for this training example. * positive_item_start_index = item_features.get_row_start(positive_item_id) * positive_item_stop_index = item_features.get_row_end(positive_item_id) # <<<<<<<<<<<<<< @@ -5630,7 +5804,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_positive_item_stop_index = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_item_features->__pyx_vtab)->get_row_end(__pyx_v_item_features, __pyx_v_positive_item_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":565 + /* "lightfm/_lightfm_fast_no_openmp.pyx":574 * positive_item_stop_index = item_features.get_row_end(positive_item_id) * * negative_item_start_index = item_features.get_row_start(negative_item_id) # <<<<<<<<<<<<<< @@ -5639,7 +5813,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_negative_item_start_index = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_item_features->__pyx_vtab)->get_row_start(__pyx_v_item_features, __pyx_v_negative_item_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":566 + /* "lightfm/_lightfm_fast_no_openmp.pyx":575 * * negative_item_start_index = item_features.get_row_start(negative_item_id) * negative_item_stop_index = item_features.get_row_end(negative_item_id) # <<<<<<<<<<<<<< @@ -5648,7 +5822,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_negative_item_stop_index = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_item_features->__pyx_vtab)->get_row_end(__pyx_v_item_features, __pyx_v_negative_item_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":568 + /* "lightfm/_lightfm_fast_no_openmp.pyx":577 * negative_item_stop_index = item_features.get_row_end(negative_item_id) * * user_start_index = user_features.get_row_start(user_id) # <<<<<<<<<<<<<< @@ -5657,7 +5831,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_user_start_index = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_user_features->__pyx_vtab)->get_row_start(__pyx_v_user_features, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":569 + /* "lightfm/_lightfm_fast_no_openmp.pyx":578 * * user_start_index = user_features.get_row_start(user_id) * user_stop_index = user_features.get_row_end(user_id) # <<<<<<<<<<<<<< @@ -5666,7 +5840,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_user_stop_index = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_user_features->__pyx_vtab)->get_row_end(__pyx_v_user_features, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":571 + /* "lightfm/_lightfm_fast_no_openmp.pyx":580 * user_stop_index = user_features.get_row_end(user_id) * * avg_learning_rate += update_biases(item_features, positive_item_start_index, # <<<<<<<<<<<<<< @@ -5675,7 +5849,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(__pyx_v_item_features, __pyx_v_positive_item_start_index, __pyx_v_positive_item_stop_index, __pyx_v_lightfm->item_biases, __pyx_v_lightfm->item_bias_gradients, __pyx_v_lightfm->item_bias_momentum, (-__pyx_v_loss), __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_item_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":581 + /* "lightfm/_lightfm_fast_no_openmp.pyx":590 * lightfm.rho, * lightfm.eps) * avg_learning_rate += update_biases(item_features, negative_item_start_index, # <<<<<<<<<<<<<< @@ -5684,7 +5858,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(__pyx_v_item_features, __pyx_v_negative_item_start_index, __pyx_v_negative_item_stop_index, __pyx_v_lightfm->item_biases, __pyx_v_lightfm->item_bias_gradients, __pyx_v_lightfm->item_bias_momentum, __pyx_v_loss, __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_item_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":591 + /* "lightfm/_lightfm_fast_no_openmp.pyx":600 * lightfm.rho, * lightfm.eps) * avg_learning_rate += update_biases(user_features, user_start_index, user_stop_index, # <<<<<<<<<<<<<< @@ -5693,7 +5867,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_biases(__pyx_v_user_features, __pyx_v_user_start_index, __pyx_v_user_stop_index, __pyx_v_lightfm->user_biases, __pyx_v_lightfm->user_bias_gradients, __pyx_v_lightfm->user_bias_momentum, __pyx_v_loss, __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_user_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":602 + /* "lightfm/_lightfm_fast_no_openmp.pyx":611 * * # Update latent representations. * for i in range(lightfm.no_components): # <<<<<<<<<<<<<< @@ -5705,7 +5879,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "lightfm/_lightfm_fast_no_openmp.pyx":604 + /* "lightfm/_lightfm_fast_no_openmp.pyx":613 * for i in range(lightfm.no_components): * * user_component = user_repr[i] # <<<<<<<<<<<<<< @@ -5714,7 +5888,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_user_component = (__pyx_v_user_repr[__pyx_v_i]); - /* "lightfm/_lightfm_fast_no_openmp.pyx":605 + /* "lightfm/_lightfm_fast_no_openmp.pyx":614 * * user_component = user_repr[i] * positive_item_component = pos_it_repr[i] # <<<<<<<<<<<<<< @@ -5723,7 +5897,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_positive_item_component = (__pyx_v_pos_it_repr[__pyx_v_i]); - /* "lightfm/_lightfm_fast_no_openmp.pyx":606 + /* "lightfm/_lightfm_fast_no_openmp.pyx":615 * user_component = user_repr[i] * positive_item_component = pos_it_repr[i] * negative_item_component = neg_it_repr[i] # <<<<<<<<<<<<<< @@ -5732,7 +5906,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_negative_item_component = (__pyx_v_neg_it_repr[__pyx_v_i]); - /* "lightfm/_lightfm_fast_no_openmp.pyx":608 + /* "lightfm/_lightfm_fast_no_openmp.pyx":617 * negative_item_component = neg_it_repr[i] * * avg_learning_rate += update_features(item_features, lightfm.item_features, # <<<<<<<<<<<<<< @@ -5741,7 +5915,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_features(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_feature_gradients, __pyx_v_lightfm->item_feature_momentum, __pyx_v_i, __pyx_v_positive_item_start_index, __pyx_v_positive_item_stop_index, ((-__pyx_v_loss) * __pyx_v_user_component), __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_item_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":618 + /* "lightfm/_lightfm_fast_no_openmp.pyx":627 * lightfm.rho, * lightfm.eps) * avg_learning_rate += update_features(item_features, lightfm.item_features, # <<<<<<<<<<<<<< @@ -5750,7 +5924,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_features(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_feature_gradients, __pyx_v_lightfm->item_feature_momentum, __pyx_v_i, __pyx_v_negative_item_start_index, __pyx_v_negative_item_stop_index, (__pyx_v_loss * __pyx_v_user_component), __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_item_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":628 + /* "lightfm/_lightfm_fast_no_openmp.pyx":637 * lightfm.rho, * lightfm.eps) * avg_learning_rate += update_features(user_features, lightfm.user_features, # <<<<<<<<<<<<<< @@ -5760,7 +5934,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update_features(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_feature_gradients, __pyx_v_lightfm->user_feature_momentum, __pyx_v_i, __pyx_v_user_start_index, __pyx_v_user_stop_index, (__pyx_v_loss * (__pyx_v_negative_item_component - __pyx_v_positive_item_component)), __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_user_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":640 + /* "lightfm/_lightfm_fast_no_openmp.pyx":649 * lightfm.eps) * * avg_learning_rate /= ((lightfm.no_components + 1) * (user_stop_index - user_start_index) # <<<<<<<<<<<<<< @@ -5769,7 +5943,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate / ((((__pyx_v_lightfm->no_components + 1) * (__pyx_v_user_stop_index - __pyx_v_user_start_index)) + ((__pyx_v_lightfm->no_components + 1) * (__pyx_v_positive_item_stop_index - __pyx_v_positive_item_start_index))) + ((__pyx_v_lightfm->no_components + 1) * (__pyx_v_negative_item_stop_index - __pyx_v_negative_item_start_index)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":648 + /* "lightfm/_lightfm_fast_no_openmp.pyx":657 * # Update the scaling factors for lazy regularization, using the average learning rate * # of features updated for this example. * lightfm.item_scale *= (1.0 + item_alpha * avg_learning_rate) # <<<<<<<<<<<<<< @@ -5778,16 +5952,34 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ */ __pyx_v_lightfm->item_scale = (__pyx_v_lightfm->item_scale * (1.0 + (__pyx_v_item_alpha * __pyx_v_avg_learning_rate))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":649 + /* "lightfm/_lightfm_fast_no_openmp.pyx":658 * # of features updated for this example. * lightfm.item_scale *= (1.0 + item_alpha * avg_learning_rate) * lightfm.user_scale *= (1.0 + user_alpha * avg_learning_rate) # <<<<<<<<<<<<<< * - * + * lightfm.avg_loss_ctr += 1 */ __pyx_v_lightfm->user_scale = (__pyx_v_lightfm->user_scale * (1.0 + (__pyx_v_user_alpha * __pyx_v_avg_learning_rate))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":537 + /* "lightfm/_lightfm_fast_no_openmp.pyx":660 + * lightfm.user_scale *= (1.0 + user_alpha * avg_learning_rate) + * + * lightfm.avg_loss_ctr += 1 # <<<<<<<<<<<<<< + * lightfm.avg_loss = (lightfm.avg_loss * (lightfm.avg_loss_ctr - 1) + loss) / lightfm.avg_loss_ctr + * + */ + __pyx_v_lightfm->avg_loss_ctr = (__pyx_v_lightfm->avg_loss_ctr + 1); + + /* "lightfm/_lightfm_fast_no_openmp.pyx":661 + * + * lightfm.avg_loss_ctr += 1 + * lightfm.avg_loss = (lightfm.avg_loss * (lightfm.avg_loss_ctr - 1) + loss) / lightfm.avg_loss_ctr # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_lightfm->avg_loss = (((__pyx_v_lightfm->avg_loss * (__pyx_v_lightfm->avg_loss_ctr - 1)) + __pyx_v_loss) / __pyx_v_lightfm->avg_loss_ctr); + + /* "lightfm/_lightfm_fast_no_openmp.pyx":546 * * * cdef void warp_update(double loss, # <<<<<<<<<<<<<< @@ -5798,7 +5990,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(double __pyx_ /* function exit code */ } -/* "lightfm/_lightfm_fast_no_openmp.pyx":652 +/* "lightfm/_lightfm_fast_no_openmp.pyx":664 * * * cdef void regularize(FastLightFM lightfm, # <<<<<<<<<<<<<< @@ -5819,12 +6011,8 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(struct __pyx_o int __pyx_t_6; Py_ssize_t __pyx_t_7; Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - /* "lightfm/_lightfm_fast_no_openmp.pyx":660 + /* "lightfm/_lightfm_fast_no_openmp.pyx":672 * * cdef int i, j * cdef int no_features = lightfm.item_features.shape[0] # <<<<<<<<<<<<<< @@ -5833,7 +6021,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(struct __pyx_o */ __pyx_v_no_features = (__pyx_v_lightfm->item_features.shape[0]); - /* "lightfm/_lightfm_fast_no_openmp.pyx":661 + /* "lightfm/_lightfm_fast_no_openmp.pyx":673 * cdef int i, j * cdef int no_features = lightfm.item_features.shape[0] * cdef int no_users = lightfm.user_features.shape[0] # <<<<<<<<<<<<<< @@ -5842,7 +6030,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(struct __pyx_o */ __pyx_v_no_users = (__pyx_v_lightfm->user_features.shape[0]); - /* "lightfm/_lightfm_fast_no_openmp.pyx":663 + /* "lightfm/_lightfm_fast_no_openmp.pyx":675 * cdef int no_users = lightfm.user_features.shape[0] * * for i in range(no_features): # <<<<<<<<<<<<<< @@ -5854,7 +6042,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(struct __pyx_o for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "lightfm/_lightfm_fast_no_openmp.pyx":664 + /* "lightfm/_lightfm_fast_no_openmp.pyx":676 * * for i in range(no_features): * for j in range(lightfm.no_components): # <<<<<<<<<<<<<< @@ -5866,7 +6054,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(struct __pyx_o for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6; - /* "lightfm/_lightfm_fast_no_openmp.pyx":665 + /* "lightfm/_lightfm_fast_no_openmp.pyx":677 * for i in range(no_features): * for j in range(lightfm.no_components): * lightfm.item_features[i, j] /= lightfm.item_scale # <<<<<<<<<<<<<< @@ -5878,18 +6066,18 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(struct __pyx_o *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_lightfm->item_features.data + __pyx_t_7 * __pyx_v_lightfm->item_features.strides[0]) )) + __pyx_t_8)) )) /= __pyx_v_lightfm->item_scale; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":667 + /* "lightfm/_lightfm_fast_no_openmp.pyx":679 * lightfm.item_features[i, j] /= lightfm.item_scale * * lightfm.item_biases[i] /= lightfm.item_scale # <<<<<<<<<<<<<< * * for i in range(no_users): */ - __pyx_t_9 = __pyx_v_i; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_lightfm->item_biases.data) + __pyx_t_9)) )) /= __pyx_v_lightfm->item_scale; + __pyx_t_8 = __pyx_v_i; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_lightfm->item_biases.data) + __pyx_t_8)) )) /= __pyx_v_lightfm->item_scale; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":669 + /* "lightfm/_lightfm_fast_no_openmp.pyx":681 * lightfm.item_biases[i] /= lightfm.item_scale * * for i in range(no_users): # <<<<<<<<<<<<<< @@ -5901,7 +6089,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(struct __pyx_o for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "lightfm/_lightfm_fast_no_openmp.pyx":670 + /* "lightfm/_lightfm_fast_no_openmp.pyx":682 * * for i in range(no_users): * for j in range(lightfm.no_components): # <<<<<<<<<<<<<< @@ -5913,30 +6101,30 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(struct __pyx_o for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6; - /* "lightfm/_lightfm_fast_no_openmp.pyx":671 + /* "lightfm/_lightfm_fast_no_openmp.pyx":683 * for i in range(no_users): * for j in range(lightfm.no_components): * lightfm.user_features[i, j] /= lightfm.user_scale # <<<<<<<<<<<<<< * lightfm.user_biases[i] /= lightfm.user_scale * */ - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = __pyx_v_j; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_lightfm->user_features.data + __pyx_t_10 * __pyx_v_lightfm->user_features.strides[0]) )) + __pyx_t_11)) )) /= __pyx_v_lightfm->user_scale; + __pyx_t_8 = __pyx_v_i; + __pyx_t_7 = __pyx_v_j; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ (__pyx_v_lightfm->user_features.data + __pyx_t_8 * __pyx_v_lightfm->user_features.strides[0]) )) + __pyx_t_7)) )) /= __pyx_v_lightfm->user_scale; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":672 + /* "lightfm/_lightfm_fast_no_openmp.pyx":684 * for j in range(lightfm.no_components): * lightfm.user_features[i, j] /= lightfm.user_scale * lightfm.user_biases[i] /= lightfm.user_scale # <<<<<<<<<<<<<< * * lightfm.item_scale = 1.0 */ - __pyx_t_12 = __pyx_v_i; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_lightfm->user_biases.data) + __pyx_t_12)) )) /= __pyx_v_lightfm->user_scale; + __pyx_t_7 = __pyx_v_i; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_lightfm->user_biases.data) + __pyx_t_7)) )) /= __pyx_v_lightfm->user_scale; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":674 + /* "lightfm/_lightfm_fast_no_openmp.pyx":686 * lightfm.user_biases[i] /= lightfm.user_scale * * lightfm.item_scale = 1.0 # <<<<<<<<<<<<<< @@ -5945,7 +6133,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(struct __pyx_o */ __pyx_v_lightfm->item_scale = 1.0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":675 + /* "lightfm/_lightfm_fast_no_openmp.pyx":687 * * lightfm.item_scale = 1.0 * lightfm.user_scale = 1.0 # <<<<<<<<<<<<<< @@ -5954,7 +6142,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(struct __pyx_o */ __pyx_v_lightfm->user_scale = 1.0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":652 + /* "lightfm/_lightfm_fast_no_openmp.pyx":664 * * * cdef void regularize(FastLightFM lightfm, # <<<<<<<<<<<<<< @@ -5965,7 +6153,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(struct __pyx_o /* function exit code */ } -/* "lightfm/_lightfm_fast_no_openmp.pyx":678 +/* "lightfm/_lightfm_fast_no_openmp.pyx":690 * * * cdef void locked_regularize(FastLightFM lightfm, # <<<<<<<<<<<<<< @@ -5977,7 +6165,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_locked_regularize(struct int __pyx_t_1; int __pyx_t_2; - /* "lightfm/_lightfm_fast_no_openmp.pyx":687 + /* "lightfm/_lightfm_fast_no_openmp.pyx":699 * * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< @@ -5995,7 +6183,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_locked_regularize(struct __pyx_L4_bool_binop_done:; if (__pyx_t_1) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":688 + /* "lightfm/_lightfm_fast_no_openmp.pyx":700 * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: * regularize(lightfm, # <<<<<<<<<<<<<< @@ -6004,7 +6192,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_locked_regularize(struct */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_no_openmp.pyx":687 + /* "lightfm/_lightfm_fast_no_openmp.pyx":699 * * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< @@ -6013,7 +6201,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_locked_regularize(struct */ } - /* "lightfm/_lightfm_fast_no_openmp.pyx":678 + /* "lightfm/_lightfm_fast_no_openmp.pyx":690 * * * cdef void locked_regularize(FastLightFM lightfm, # <<<<<<<<<<<<<< @@ -6024,7 +6212,7 @@ static void __pyx_f_7lightfm_23_lightfm_fast_no_openmp_locked_regularize(struct /* function exit code */ } -/* "lightfm/_lightfm_fast_no_openmp.pyx":694 +/* "lightfm/_lightfm_fast_no_openmp.pyx":706 * * * def fit_logistic(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -6049,6 +6237,9 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_1fit_logistic(PyObj double __pyx_v_item_alpha; double __pyx_v_user_alpha; CYTHON_UNUSED int __pyx_v_num_threads; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fit_logistic (wrapper)", 0); @@ -6095,71 +6286,71 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_1fit_logistic(PyObj case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 1); __PYX_ERR(0, 694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 1); __PYX_ERR(0, 706, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 2); __PYX_ERR(0, 694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 2); __PYX_ERR(0, 706, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 3); __PYX_ERR(0, 694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 3); __PYX_ERR(0, 706, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 4); __PYX_ERR(0, 694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 4); __PYX_ERR(0, 706, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sample_weight)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 5); __PYX_ERR(0, 694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 5); __PYX_ERR(0, 706, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shuffle_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 6); __PYX_ERR(0, 694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 6); __PYX_ERR(0, 706, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lightfm)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 7); __PYX_ERR(0, 694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 7); __PYX_ERR(0, 706, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_learning_rate)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 8); __PYX_ERR(0, 694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 8); __PYX_ERR(0, 706, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 9); __PYX_ERR(0, 694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 9); __PYX_ERR(0, 706, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 10); __PYX_ERR(0, 694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 10); __PYX_ERR(0, 706, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 11); __PYX_ERR(0, 694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 11); __PYX_ERR(0, 706, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_logistic") < 0)) __PYX_ERR(0, 694, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_logistic") < 0)) __PYX_ERR(0, 706, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 12) { goto __pyx_L5_argtuple_error; @@ -6179,28 +6370,28 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_1fit_logistic(PyObj } __pyx_v_item_features = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[0]); __pyx_v_user_features = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[1]); - __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 696, __pyx_L3_error) - __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 697, __pyx_L3_error) - __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_Y.memview)) __PYX_ERR(0, 698, __pyx_L3_error) - __pyx_v_sample_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_sample_weight.memview)) __PYX_ERR(0, 699, __pyx_L3_error) - __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 700, __pyx_L3_error) + __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 708, __pyx_L3_error) + __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 709, __pyx_L3_error) + __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_Y.memview)) __PYX_ERR(0, 710, __pyx_L3_error) + __pyx_v_sample_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_sample_weight.memview)) __PYX_ERR(0, 711, __pyx_L3_error) + __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 712, __pyx_L3_error) __pyx_v_lightfm = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *)values[7]); - __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 702, __pyx_L3_error) - __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 703, __pyx_L3_error) - __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 704, __pyx_L3_error) - __pyx_v_num_threads = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 705, __pyx_L3_error) + __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 714, __pyx_L3_error) + __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 715, __pyx_L3_error) + __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 716, __pyx_L3_error) + __pyx_v_num_threads = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 717, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 694, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 706, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_no_openmp.fit_logistic", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 694, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 695, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 701, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 706, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 707, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 713, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(__pyx_self, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_user_ids, __pyx_v_item_ids, __pyx_v_Y, __pyx_v_sample_weight, __pyx_v_shuffle_indices, __pyx_v_lightfm, __pyx_v_learning_rate, __pyx_v_item_alpha, __pyx_v_user_alpha, __pyx_v_num_threads); /* function exit code */ @@ -6231,15 +6422,11 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON int __pyx_t_2; int __pyx_t_3; Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; + int __pyx_t_5; + int __pyx_t_6; __Pyx_RefNannySetupContext("fit_logistic", 0); - /* "lightfm/_lightfm_fast_no_openmp.pyx":717 + /* "lightfm/_lightfm_fast_no_openmp.pyx":729 * cdef flt *it_repr * * no_examples = Y.shape[0] # <<<<<<<<<<<<<< @@ -6248,7 +6435,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON */ __pyx_v_no_examples = (__pyx_v_Y.shape[0]); - /* "lightfm/_lightfm_fast_no_openmp.pyx":719 + /* "lightfm/_lightfm_fast_no_openmp.pyx":731 * no_examples = Y.shape[0] * * with nogil: # <<<<<<<<<<<<<< @@ -6263,7 +6450,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON #endif /*try:*/ { - /* "lightfm/_lightfm_fast_no_openmp.pyx":721 + /* "lightfm/_lightfm_fast_no_openmp.pyx":733 * with nogil: * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -6272,7 +6459,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON */ __pyx_v_user_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":722 + /* "lightfm/_lightfm_fast_no_openmp.pyx":734 * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -6281,7 +6468,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON */ __pyx_v_it_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":724 + /* "lightfm/_lightfm_fast_no_openmp.pyx":736 * it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * * for i in range(no_examples): # <<<<<<<<<<<<<< @@ -6293,7 +6480,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "lightfm/_lightfm_fast_no_openmp.pyx":726 + /* "lightfm/_lightfm_fast_no_openmp.pyx":738 * for i in range(no_examples): * * row = shuffle_indices[i] # <<<<<<<<<<<<<< @@ -6303,37 +6490,37 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON __pyx_t_4 = __pyx_v_i; __pyx_v_row = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_shuffle_indices.data) + __pyx_t_4)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":728 + /* "lightfm/_lightfm_fast_no_openmp.pyx":740 * row = shuffle_indices[i] * * user_id = user_ids[row] # <<<<<<<<<<<<<< * item_id = item_ids[row] * weight = sample_weight[row] */ - __pyx_t_5 = __pyx_v_row; - __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_5)) ))); + __pyx_t_4 = __pyx_v_row; + __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_4)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":729 + /* "lightfm/_lightfm_fast_no_openmp.pyx":741 * * user_id = user_ids[row] * item_id = item_ids[row] # <<<<<<<<<<<<<< * weight = sample_weight[row] * */ - __pyx_t_6 = __pyx_v_row; - __pyx_v_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_6)) ))); + __pyx_t_4 = __pyx_v_row; + __pyx_v_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_4)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":730 + /* "lightfm/_lightfm_fast_no_openmp.pyx":742 * user_id = user_ids[row] * item_id = item_ids[row] * weight = sample_weight[row] # <<<<<<<<<<<<<< * * compute_representation(user_features, */ - __pyx_t_7 = __pyx_v_row; - __pyx_v_weight = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_sample_weight.data) + __pyx_t_7)) ))); + __pyx_t_4 = __pyx_v_row; + __pyx_v_weight = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_sample_weight.data) + __pyx_t_4)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":732 + /* "lightfm/_lightfm_fast_no_openmp.pyx":744 * weight = sample_weight[row] * * compute_representation(user_features, # <<<<<<<<<<<<<< @@ -6342,7 +6529,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_biases, __pyx_v_lightfm, __pyx_v_user_id, __pyx_v_lightfm->user_scale, __pyx_v_user_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":739 + /* "lightfm/_lightfm_fast_no_openmp.pyx":751 * lightfm.user_scale, * user_repr) * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -6351,7 +6538,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_item_id, __pyx_v_lightfm->item_scale, __pyx_v_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":747 + /* "lightfm/_lightfm_fast_no_openmp.pyx":759 * it_repr) * * prediction = sigmoid(compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -6360,27 +6547,27 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON */ __pyx_v_prediction = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_sigmoid(__pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_it_repr, __pyx_v_lightfm->no_components)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":753 + /* "lightfm/_lightfm_fast_no_openmp.pyx":765 * # Any value less or equal to zero * # is a negative interaction. * y_row = Y[row] # <<<<<<<<<<<<<< * if y_row <= 0: * y = 0 */ - __pyx_t_8 = __pyx_v_row; - __pyx_v_y_row = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_Y.data) + __pyx_t_8)) ))); + __pyx_t_4 = __pyx_v_row; + __pyx_v_y_row = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_Y.data) + __pyx_t_4)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":754 + /* "lightfm/_lightfm_fast_no_openmp.pyx":766 * # is a negative interaction. * y_row = Y[row] * if y_row <= 0: # <<<<<<<<<<<<<< * y = 0 * else: */ - __pyx_t_9 = ((__pyx_v_y_row <= 0.0) != 0); - if (__pyx_t_9) { + __pyx_t_5 = ((__pyx_v_y_row <= 0.0) != 0); + if (__pyx_t_5) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":755 + /* "lightfm/_lightfm_fast_no_openmp.pyx":767 * y_row = Y[row] * if y_row <= 0: * y = 0 # <<<<<<<<<<<<<< @@ -6389,7 +6576,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON */ __pyx_v_y = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":754 + /* "lightfm/_lightfm_fast_no_openmp.pyx":766 * # is a negative interaction. * y_row = Y[row] * if y_row <= 0: # <<<<<<<<<<<<<< @@ -6399,7 +6586,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON goto __pyx_L8; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":757 + /* "lightfm/_lightfm_fast_no_openmp.pyx":769 * y = 0 * else: * y = 1 # <<<<<<<<<<<<<< @@ -6411,7 +6598,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON } __pyx_L8:; - /* "lightfm/_lightfm_fast_no_openmp.pyx":759 + /* "lightfm/_lightfm_fast_no_openmp.pyx":771 * y = 1 * * loss = weight * (prediction - y) # <<<<<<<<<<<<<< @@ -6420,7 +6607,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON */ __pyx_v_loss = (__pyx_v_weight * (__pyx_v_prediction - __pyx_v_y)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":760 + /* "lightfm/_lightfm_fast_no_openmp.pyx":772 * * loss = weight * (prediction - y) * update(loss, # <<<<<<<<<<<<<< @@ -6429,25 +6616,25 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_update(__pyx_v_loss, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_user_id, __pyx_v_item_id, __pyx_v_user_repr, __pyx_v_it_repr, __pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_no_openmp.pyx":771 + /* "lightfm/_lightfm_fast_no_openmp.pyx":783 * user_alpha) * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< * locked_regularize(lightfm, * item_alpha, */ - __pyx_t_10 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); - if (!__pyx_t_10) { + __pyx_t_6 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); + if (!__pyx_t_6) { } else { - __pyx_t_9 = __pyx_t_10; + __pyx_t_5 = __pyx_t_6; goto __pyx_L10_bool_binop_done; } - __pyx_t_10 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); - __pyx_t_9 = __pyx_t_10; + __pyx_t_6 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); + __pyx_t_5 = __pyx_t_6; __pyx_L10_bool_binop_done:; - if (__pyx_t_9) { + if (__pyx_t_5) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":772 + /* "lightfm/_lightfm_fast_no_openmp.pyx":784 * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: * locked_regularize(lightfm, # <<<<<<<<<<<<<< @@ -6456,7 +6643,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_locked_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_no_openmp.pyx":771 + /* "lightfm/_lightfm_fast_no_openmp.pyx":783 * user_alpha) * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< @@ -6466,7 +6653,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON } } - /* "lightfm/_lightfm_fast_no_openmp.pyx":776 + /* "lightfm/_lightfm_fast_no_openmp.pyx":788 * user_alpha) * * free(user_repr) # <<<<<<<<<<<<<< @@ -6475,7 +6662,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON */ free(__pyx_v_user_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":777 + /* "lightfm/_lightfm_fast_no_openmp.pyx":789 * * free(user_repr) * free(it_repr) # <<<<<<<<<<<<<< @@ -6485,7 +6672,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON free(__pyx_v_it_repr); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":719 + /* "lightfm/_lightfm_fast_no_openmp.pyx":731 * no_examples = Y.shape[0] * * with nogil: # <<<<<<<<<<<<<< @@ -6504,7 +6691,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON } } - /* "lightfm/_lightfm_fast_no_openmp.pyx":779 + /* "lightfm/_lightfm_fast_no_openmp.pyx":791 * free(it_repr) * * regularize(lightfm, # <<<<<<<<<<<<<< @@ -6513,7 +6700,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_no_openmp.pyx":694 + /* "lightfm/_lightfm_fast_no_openmp.pyx":706 * * * def fit_logistic(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -6533,7 +6720,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_fit_logistic(CYTHON return __pyx_r; } -/* "lightfm/_lightfm_fast_no_openmp.pyx":784 +/* "lightfm/_lightfm_fast_no_openmp.pyx":796 * * * def fit_warp(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -6560,6 +6747,9 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_3fit_warp(PyObject double __pyx_v_user_alpha; int __pyx_v_num_threads; PyObject *__pyx_v_random_state = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fit_warp (wrapper)", 0); @@ -6610,83 +6800,83 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_3fit_warp(PyObject case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 1); __PYX_ERR(0, 784, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 1); __PYX_ERR(0, 796, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interactions)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 2); __PYX_ERR(0, 784, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 2); __PYX_ERR(0, 796, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 3); __PYX_ERR(0, 784, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 3); __PYX_ERR(0, 796, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 4); __PYX_ERR(0, 784, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 4); __PYX_ERR(0, 796, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 5); __PYX_ERR(0, 784, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 5); __PYX_ERR(0, 796, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sample_weight)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 6); __PYX_ERR(0, 784, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 6); __PYX_ERR(0, 796, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shuffle_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 7); __PYX_ERR(0, 784, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 7); __PYX_ERR(0, 796, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lightfm)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 8); __PYX_ERR(0, 784, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 8); __PYX_ERR(0, 796, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_learning_rate)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 9); __PYX_ERR(0, 784, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 9); __PYX_ERR(0, 796, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 10); __PYX_ERR(0, 784, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 10); __PYX_ERR(0, 796, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 11); __PYX_ERR(0, 784, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 11); __PYX_ERR(0, 796, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 12); __PYX_ERR(0, 784, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 12); __PYX_ERR(0, 796, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 13: if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_random_state)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 13); __PYX_ERR(0, 784, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 13); __PYX_ERR(0, 796, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_warp") < 0)) __PYX_ERR(0, 784, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_warp") < 0)) __PYX_ERR(0, 796, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 14) { goto __pyx_L5_argtuple_error; @@ -6709,30 +6899,30 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_3fit_warp(PyObject __pyx_v_item_features = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[0]); __pyx_v_user_features = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[1]); __pyx_v_interactions = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[2]); - __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 787, __pyx_L3_error) - __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 788, __pyx_L3_error) - __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_Y.memview)) __PYX_ERR(0, 789, __pyx_L3_error) - __pyx_v_sample_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_sample_weight.memview)) __PYX_ERR(0, 790, __pyx_L3_error) - __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 791, __pyx_L3_error) + __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 799, __pyx_L3_error) + __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 800, __pyx_L3_error) + __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_Y.memview)) __PYX_ERR(0, 801, __pyx_L3_error) + __pyx_v_sample_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_sample_weight.memview)) __PYX_ERR(0, 802, __pyx_L3_error) + __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 803, __pyx_L3_error) __pyx_v_lightfm = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *)values[8]); - __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 793, __pyx_L3_error) - __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 794, __pyx_L3_error) - __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 795, __pyx_L3_error) - __pyx_v_num_threads = __Pyx_PyInt_As_int(values[12]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 796, __pyx_L3_error) + __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 805, __pyx_L3_error) + __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 806, __pyx_L3_error) + __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 807, __pyx_L3_error) + __pyx_v_num_threads = __Pyx_PyInt_As_int(values[12]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 808, __pyx_L3_error) __pyx_v_random_state = values[13]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 784, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 796, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_no_openmp.fit_warp", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 784, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 785, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interactions), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "interactions", 0))) __PYX_ERR(0, 786, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 792, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 796, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 797, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interactions), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "interactions", 0))) __PYX_ERR(0, 798, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 804, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(__pyx_self, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_interactions, __pyx_v_user_ids, __pyx_v_item_ids, __pyx_v_Y, __pyx_v_sample_weight, __pyx_v_shuffle_indices, __pyx_v_lightfm, __pyx_v_learning_rate, __pyx_v_item_alpha, __pyx_v_user_alpha, __pyx_v_num_threads, __pyx_v_random_state); /* function exit code */ @@ -6774,43 +6964,41 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN int __pyx_t_9; int __pyx_t_10; Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - int __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - double __pyx_t_18; - double __pyx_t_19; - double __pyx_t_20; - int __pyx_t_21; + int __pyx_t_12; + double __pyx_t_13; + double __pyx_t_14; + double __pyx_t_15; + int __pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fit_warp", 0); - /* "lightfm/_lightfm_fast_no_openmp.pyx":812 + /* "lightfm/_lightfm_fast_no_openmp.pyx":824 * cdef unsigned int[::1] random_states * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_randint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 812, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_randint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "lightfm/_lightfm_fast_no_openmp.pyx":813 + /* "lightfm/_lightfm_fast_no_openmp.pyx":825 * * random_states = random_state.randint(0, * np.iinfo(np.int32).max, # <<<<<<<<<<<<<< * size=num_threads).astype(np.uint32) * */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 813, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_iinfo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 813, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_iinfo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 813, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 813, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -6826,21 +7014,21 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 813, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 813, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 825, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":812 + /* "lightfm/_lightfm_fast_no_openmp.pyx":824 * cdef unsigned int[::1] random_states * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 812, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -6849,46 +7037,46 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); __pyx_t_5 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":814 + /* "lightfm/_lightfm_fast_no_openmp.pyx":826 * random_states = random_state.randint(0, * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) # <<<<<<<<<<<<<< * * no_examples = Y.shape[0] */ - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 814, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_num_threads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 814, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_num_threads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_size, __pyx_t_6) < 0) __PYX_ERR(0, 814, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_size, __pyx_t_6) < 0) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":812 + /* "lightfm/_lightfm_fast_no_openmp.pyx":824 * cdef unsigned int[::1] random_states * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 812, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 824, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":814 + /* "lightfm/_lightfm_fast_no_openmp.pyx":826 * random_states = random_state.randint(0, * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) # <<<<<<<<<<<<<< * * no_examples = Y.shape[0] */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 814, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 814, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 814, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -6904,16 +7092,16 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 814, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 814, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 826, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_random_states = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "lightfm/_lightfm_fast_no_openmp.pyx":816 + /* "lightfm/_lightfm_fast_no_openmp.pyx":828 * size=num_threads).astype(np.uint32) * * no_examples = Y.shape[0] # <<<<<<<<<<<<<< @@ -6922,7 +7110,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_v_no_examples = (__pyx_v_Y.shape[0]); - /* "lightfm/_lightfm_fast_no_openmp.pyx":817 + /* "lightfm/_lightfm_fast_no_openmp.pyx":829 * * no_examples = Y.shape[0] * MAX_LOSS = 10.0 # <<<<<<<<<<<<<< @@ -6931,7 +7119,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_v_MAX_LOSS = 10.0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":819 + /* "lightfm/_lightfm_fast_no_openmp.pyx":831 * MAX_LOSS = 10.0 * * with nogil: # <<<<<<<<<<<<<< @@ -6946,7 +7134,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN #endif /*try:*/ { - /* "lightfm/_lightfm_fast_no_openmp.pyx":821 + /* "lightfm/_lightfm_fast_no_openmp.pyx":833 * with nogil: * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -6955,7 +7143,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_v_user_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":822 + /* "lightfm/_lightfm_fast_no_openmp.pyx":834 * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * pos_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -6964,7 +7152,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_v_pos_it_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":823 + /* "lightfm/_lightfm_fast_no_openmp.pyx":835 * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * pos_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * neg_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -6973,7 +7161,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_v_neg_it_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":825 + /* "lightfm/_lightfm_fast_no_openmp.pyx":837 * neg_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * * for i in range(no_examples): # <<<<<<<<<<<<<< @@ -6985,7 +7173,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "lightfm/_lightfm_fast_no_openmp.pyx":826 + /* "lightfm/_lightfm_fast_no_openmp.pyx":838 * * for i in range(no_examples): * row = shuffle_indices[i] # <<<<<<<<<<<<<< @@ -6995,38 +7183,38 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN __pyx_t_11 = __pyx_v_i; __pyx_v_row = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_shuffle_indices.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":828 + /* "lightfm/_lightfm_fast_no_openmp.pyx":840 * row = shuffle_indices[i] * * user_id = user_ids[row] # <<<<<<<<<<<<<< * positive_item_id = item_ids[row] * */ - __pyx_t_12 = __pyx_v_row; - __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_12)) ))); + __pyx_t_11 = __pyx_v_row; + __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":829 + /* "lightfm/_lightfm_fast_no_openmp.pyx":841 * * user_id = user_ids[row] * positive_item_id = item_ids[row] # <<<<<<<<<<<<<< * * if not Y[row] > 0: */ - __pyx_t_13 = __pyx_v_row; - __pyx_v_positive_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_13)) ))); + __pyx_t_11 = __pyx_v_row; + __pyx_v_positive_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":831 + /* "lightfm/_lightfm_fast_no_openmp.pyx":843 * positive_item_id = item_ids[row] * * if not Y[row] > 0: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_14 = __pyx_v_row; - __pyx_t_15 = ((!(((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_Y.data) + __pyx_t_14)) ))) > 0.0) != 0)) != 0); - if (__pyx_t_15) { + __pyx_t_11 = __pyx_v_row; + __pyx_t_12 = ((!(((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_Y.data) + __pyx_t_11)) ))) > 0.0) != 0)) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":832 + /* "lightfm/_lightfm_fast_no_openmp.pyx":844 * * if not Y[row] > 0: * continue # <<<<<<<<<<<<<< @@ -7035,7 +7223,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ goto __pyx_L6_continue; - /* "lightfm/_lightfm_fast_no_openmp.pyx":831 + /* "lightfm/_lightfm_fast_no_openmp.pyx":843 * positive_item_id = item_ids[row] * * if not Y[row] > 0: # <<<<<<<<<<<<<< @@ -7044,17 +7232,17 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ } - /* "lightfm/_lightfm_fast_no_openmp.pyx":834 + /* "lightfm/_lightfm_fast_no_openmp.pyx":846 * continue * * weight = sample_weight[row] # <<<<<<<<<<<<<< * * compute_representation(user_features, */ - __pyx_t_16 = __pyx_v_row; - __pyx_v_weight = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_sample_weight.data) + __pyx_t_16)) ))); + __pyx_t_11 = __pyx_v_row; + __pyx_v_weight = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_sample_weight.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":836 + /* "lightfm/_lightfm_fast_no_openmp.pyx":848 * weight = sample_weight[row] * * compute_representation(user_features, # <<<<<<<<<<<<<< @@ -7063,7 +7251,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_biases, __pyx_v_lightfm, __pyx_v_user_id, __pyx_v_lightfm->user_scale, __pyx_v_user_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":843 + /* "lightfm/_lightfm_fast_no_openmp.pyx":855 * lightfm.user_scale, * user_repr) * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -7072,7 +7260,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_positive_item_id, __pyx_v_lightfm->item_scale, __pyx_v_pos_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":851 + /* "lightfm/_lightfm_fast_no_openmp.pyx":863 * pos_it_repr) * * positive_prediction = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -7081,7 +7269,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_v_positive_prediction = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_pos_it_repr, __pyx_v_lightfm->no_components); - /* "lightfm/_lightfm_fast_no_openmp.pyx":855 + /* "lightfm/_lightfm_fast_no_openmp.pyx":867 * lightfm.no_components) * * sampled = 0 # <<<<<<<<<<<<<< @@ -7090,7 +7278,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_v_sampled = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":857 + /* "lightfm/_lightfm_fast_no_openmp.pyx":869 * sampled = 0 * * while sampled < lightfm.max_sampled: # <<<<<<<<<<<<<< @@ -7098,10 +7286,10 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN * sampled = sampled + 1 */ while (1) { - __pyx_t_15 = ((__pyx_v_sampled < __pyx_v_lightfm->max_sampled) != 0); - if (!__pyx_t_15) break; + __pyx_t_12 = ((__pyx_v_sampled < __pyx_v_lightfm->max_sampled) != 0); + if (!__pyx_t_12) break; - /* "lightfm/_lightfm_fast_no_openmp.pyx":859 + /* "lightfm/_lightfm_fast_no_openmp.pyx":871 * while sampled < lightfm.max_sampled: * * sampled = sampled + 1 # <<<<<<<<<<<<<< @@ -7110,25 +7298,25 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_v_sampled = (__pyx_v_sampled + 1); - /* "lightfm/_lightfm_fast_no_openmp.pyx":860 + /* "lightfm/_lightfm_fast_no_openmp.pyx":872 * * sampled = sampled + 1 * negative_item_id = (rand_r(&random_states[0]) # <<<<<<<<<<<<<< * % item_features.rows) * */ - __pyx_t_17 = 0; + __pyx_t_11 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":861 + /* "lightfm/_lightfm_fast_no_openmp.pyx":873 * sampled = sampled + 1 * negative_item_id = (rand_r(&random_states[0]) * % item_features.rows) # <<<<<<<<<<<<<< * * compute_representation(item_features, */ - __pyx_v_negative_item_id = (__pyx_f_7lightfm_23_lightfm_fast_no_openmp_rand_r((&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_17)) ))))) % __pyx_v_item_features->rows); + __pyx_v_negative_item_id = (__pyx_f_7lightfm_23_lightfm_fast_no_openmp_rand_r((&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_11)) ))))) % __pyx_v_item_features->rows); - /* "lightfm/_lightfm_fast_no_openmp.pyx":863 + /* "lightfm/_lightfm_fast_no_openmp.pyx":875 * % item_features.rows) * * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -7137,7 +7325,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_negative_item_id, __pyx_v_lightfm->item_scale, __pyx_v_neg_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":871 + /* "lightfm/_lightfm_fast_no_openmp.pyx":883 * neg_it_repr) * * negative_prediction = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -7146,27 +7334,27 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_v_negative_prediction = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_neg_it_repr, __pyx_v_lightfm->no_components); - /* "lightfm/_lightfm_fast_no_openmp.pyx":875 + /* "lightfm/_lightfm_fast_no_openmp.pyx":887 * lightfm.no_components) * * if negative_prediction > positive_prediction - 1: # <<<<<<<<<<<<<< * * # Sample again if the sample negative is actually a positive */ - __pyx_t_15 = ((__pyx_v_negative_prediction > (__pyx_v_positive_prediction - 1.0)) != 0); - if (__pyx_t_15) { + __pyx_t_12 = ((__pyx_v_negative_prediction > (__pyx_v_positive_prediction - 1.0)) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":878 + /* "lightfm/_lightfm_fast_no_openmp.pyx":890 * * # Sample again if the sample negative is actually a positive * if in_positives(negative_item_id, user_id, interactions): # <<<<<<<<<<<<<< * continue * */ - __pyx_t_15 = (__pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives(__pyx_v_negative_item_id, __pyx_v_user_id, __pyx_v_interactions) != 0); - if (__pyx_t_15) { + __pyx_t_12 = (__pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives(__pyx_v_negative_item_id, __pyx_v_user_id, __pyx_v_interactions) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":879 + /* "lightfm/_lightfm_fast_no_openmp.pyx":891 * # Sample again if the sample negative is actually a positive * if in_positives(negative_item_id, user_id, interactions): * continue # <<<<<<<<<<<<<< @@ -7175,7 +7363,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ goto __pyx_L9_continue; - /* "lightfm/_lightfm_fast_no_openmp.pyx":878 + /* "lightfm/_lightfm_fast_no_openmp.pyx":890 * * # Sample again if the sample negative is actually a positive * if in_positives(negative_item_id, user_id, interactions): # <<<<<<<<<<<<<< @@ -7184,33 +7372,33 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ } - /* "lightfm/_lightfm_fast_no_openmp.pyx":881 + /* "lightfm/_lightfm_fast_no_openmp.pyx":893 * continue * * loss = weight * log(max(1.0, floor((item_features.rows - 1) / sampled))) # <<<<<<<<<<<<<< * * # Clip gradients for numerical stability. */ - __pyx_t_18 = floor(((__pyx_v_item_features->rows - 1) / __pyx_v_sampled)); - __pyx_t_19 = 1.0; - if (((__pyx_t_18 > __pyx_t_19) != 0)) { - __pyx_t_20 = __pyx_t_18; + __pyx_t_13 = floor(((__pyx_v_item_features->rows - 1) / __pyx_v_sampled)); + __pyx_t_14 = 1.0; + if (((__pyx_t_13 > __pyx_t_14) != 0)) { + __pyx_t_15 = __pyx_t_13; } else { - __pyx_t_20 = __pyx_t_19; + __pyx_t_15 = __pyx_t_14; } - __pyx_v_loss = (__pyx_v_weight * log(__pyx_t_20)); + __pyx_v_loss = (__pyx_v_weight * log(__pyx_t_15)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":884 + /* "lightfm/_lightfm_fast_no_openmp.pyx":896 * * # Clip gradients for numerical stability. * if loss > MAX_LOSS: # <<<<<<<<<<<<<< * loss = MAX_LOSS * */ - __pyx_t_15 = ((__pyx_v_loss > __pyx_v_MAX_LOSS) != 0); - if (__pyx_t_15) { + __pyx_t_12 = ((__pyx_v_loss > __pyx_v_MAX_LOSS) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":885 + /* "lightfm/_lightfm_fast_no_openmp.pyx":897 * # Clip gradients for numerical stability. * if loss > MAX_LOSS: * loss = MAX_LOSS # <<<<<<<<<<<<<< @@ -7219,7 +7407,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_v_loss = __pyx_v_MAX_LOSS; - /* "lightfm/_lightfm_fast_no_openmp.pyx":884 + /* "lightfm/_lightfm_fast_no_openmp.pyx":896 * * # Clip gradients for numerical stability. * if loss > MAX_LOSS: # <<<<<<<<<<<<<< @@ -7228,7 +7416,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ } - /* "lightfm/_lightfm_fast_no_openmp.pyx":887 + /* "lightfm/_lightfm_fast_no_openmp.pyx":899 * loss = MAX_LOSS * * warp_update(loss, # <<<<<<<<<<<<<< @@ -7237,7 +7425,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(__pyx_v_loss, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_user_id, __pyx_v_positive_item_id, __pyx_v_negative_item_id, __pyx_v_user_repr, __pyx_v_pos_it_repr, __pyx_v_neg_it_repr, __pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_no_openmp.pyx":899 + /* "lightfm/_lightfm_fast_no_openmp.pyx":911 * item_alpha, * user_alpha) * break # <<<<<<<<<<<<<< @@ -7246,7 +7434,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ goto __pyx_L10_break; - /* "lightfm/_lightfm_fast_no_openmp.pyx":875 + /* "lightfm/_lightfm_fast_no_openmp.pyx":887 * lightfm.no_components) * * if negative_prediction > positive_prediction - 1: # <<<<<<<<<<<<<< @@ -7258,25 +7446,25 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN } __pyx_L10_break:; - /* "lightfm/_lightfm_fast_no_openmp.pyx":901 + /* "lightfm/_lightfm_fast_no_openmp.pyx":913 * break * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< * locked_regularize(lightfm, * item_alpha, */ - __pyx_t_21 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); - if (!__pyx_t_21) { + __pyx_t_16 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); + if (!__pyx_t_16) { } else { - __pyx_t_15 = __pyx_t_21; + __pyx_t_12 = __pyx_t_16; goto __pyx_L15_bool_binop_done; } - __pyx_t_21 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); - __pyx_t_15 = __pyx_t_21; + __pyx_t_16 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); + __pyx_t_12 = __pyx_t_16; __pyx_L15_bool_binop_done:; - if (__pyx_t_15) { + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":902 + /* "lightfm/_lightfm_fast_no_openmp.pyx":914 * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: * locked_regularize(lightfm, # <<<<<<<<<<<<<< @@ -7285,7 +7473,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_locked_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_no_openmp.pyx":901 + /* "lightfm/_lightfm_fast_no_openmp.pyx":913 * break * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< @@ -7296,7 +7484,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN __pyx_L6_continue:; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":906 + /* "lightfm/_lightfm_fast_no_openmp.pyx":918 * user_alpha) * * free(user_repr) # <<<<<<<<<<<<<< @@ -7305,7 +7493,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ free(__pyx_v_user_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":907 + /* "lightfm/_lightfm_fast_no_openmp.pyx":919 * * free(user_repr) * free(pos_it_repr) # <<<<<<<<<<<<<< @@ -7314,7 +7502,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ free(__pyx_v_pos_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":908 + /* "lightfm/_lightfm_fast_no_openmp.pyx":920 * free(user_repr) * free(pos_it_repr) * free(neg_it_repr) # <<<<<<<<<<<<<< @@ -7324,7 +7512,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN free(__pyx_v_neg_it_repr); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":819 + /* "lightfm/_lightfm_fast_no_openmp.pyx":831 * MAX_LOSS = 10.0 * * with nogil: # <<<<<<<<<<<<<< @@ -7343,7 +7531,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN } } - /* "lightfm/_lightfm_fast_no_openmp.pyx":910 + /* "lightfm/_lightfm_fast_no_openmp.pyx":922 * free(neg_it_repr) * * regularize(lightfm, # <<<<<<<<<<<<<< @@ -7352,7 +7540,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_no_openmp.pyx":784 + /* "lightfm/_lightfm_fast_no_openmp.pyx":796 * * * def fit_warp(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -7385,7 +7573,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_2fit_warp(CYTHON_UN return __pyx_r; } -/* "lightfm/_lightfm_fast_no_openmp.pyx":915 +/* "lightfm/_lightfm_fast_no_openmp.pyx":927 * * * def fit_warp_kos(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -7411,6 +7599,9 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_5fit_warp_kos(PyObj int __pyx_v_n; int __pyx_v_num_threads; PyObject *__pyx_v_random_state = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fit_warp_kos (wrapper)", 0); @@ -7459,77 +7650,77 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_5fit_warp_kos(PyObj case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 1); __PYX_ERR(0, 915, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 1); __PYX_ERR(0, 927, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 2); __PYX_ERR(0, 915, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 2); __PYX_ERR(0, 927, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 3); __PYX_ERR(0, 915, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 3); __PYX_ERR(0, 927, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shuffle_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 4); __PYX_ERR(0, 915, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 4); __PYX_ERR(0, 927, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lightfm)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 5); __PYX_ERR(0, 915, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 5); __PYX_ERR(0, 927, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_learning_rate)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 6); __PYX_ERR(0, 915, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 6); __PYX_ERR(0, 927, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 7); __PYX_ERR(0, 915, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 7); __PYX_ERR(0, 927, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 8); __PYX_ERR(0, 915, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 8); __PYX_ERR(0, 927, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 9); __PYX_ERR(0, 915, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 9); __PYX_ERR(0, 927, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 10); __PYX_ERR(0, 915, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 10); __PYX_ERR(0, 927, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 11); __PYX_ERR(0, 915, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 11); __PYX_ERR(0, 927, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_random_state)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 12); __PYX_ERR(0, 915, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 12); __PYX_ERR(0, 927, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_warp_kos") < 0)) __PYX_ERR(0, 915, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_warp_kos") < 0)) __PYX_ERR(0, 927, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 13) { goto __pyx_L5_argtuple_error; @@ -7551,29 +7742,29 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_5fit_warp_kos(PyObj __pyx_v_item_features = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[0]); __pyx_v_user_features = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[1]); __pyx_v_data = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[2]); - __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 918, __pyx_L3_error) - __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 919, __pyx_L3_error) + __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 930, __pyx_L3_error) + __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 931, __pyx_L3_error) __pyx_v_lightfm = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *)values[5]); - __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 921, __pyx_L3_error) - __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 922, __pyx_L3_error) - __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 923, __pyx_L3_error) - __pyx_v_k = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 924, __pyx_L3_error) - __pyx_v_n = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 925, __pyx_L3_error) - __pyx_v_num_threads = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 926, __pyx_L3_error) + __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 933, __pyx_L3_error) + __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 934, __pyx_L3_error) + __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 935, __pyx_L3_error) + __pyx_v_k = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 936, __pyx_L3_error) + __pyx_v_n = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 937, __pyx_L3_error) + __pyx_v_num_threads = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 938, __pyx_L3_error) __pyx_v_random_state = values[12]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 915, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 927, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_no_openmp.fit_warp_kos", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 915, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 916, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "data", 0))) __PYX_ERR(0, 917, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 920, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 927, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 928, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "data", 0))) __PYX_ERR(0, 929, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 932, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(__pyx_self, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_data, __pyx_v_user_ids, __pyx_v_shuffle_indices, __pyx_v_lightfm, __pyx_v_learning_rate, __pyx_v_item_alpha, __pyx_v_user_alpha, __pyx_v_k, __pyx_v_n, __pyx_v_num_threads, __pyx_v_random_state); /* function exit code */ @@ -7621,43 +7812,43 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO int __pyx_t_9; int __pyx_t_10; Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; + int __pyx_t_12; int __pyx_t_13; int __pyx_t_14; int __pyx_t_15; - int __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_t_19; - Py_ssize_t __pyx_t_20; - int __pyx_t_21; + Py_ssize_t __pyx_t_16; + __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_t_17; + int __pyx_t_18; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fit_warp_kos", 0); - /* "lightfm/_lightfm_fast_no_openmp.pyx":943 + /* "lightfm/_lightfm_fast_no_openmp.pyx":955 * cdef unsigned int[::1] random_states * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_randint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 943, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_randint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 955, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "lightfm/_lightfm_fast_no_openmp.pyx":944 + /* "lightfm/_lightfm_fast_no_openmp.pyx":956 * * random_states = random_state.randint(0, * np.iinfo(np.int32).max, # <<<<<<<<<<<<<< * size=num_threads).astype(np.uint32) * */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 944, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_iinfo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 944, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_iinfo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 944, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 944, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -7673,21 +7864,21 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 944, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 944, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 956, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":943 + /* "lightfm/_lightfm_fast_no_openmp.pyx":955 * cdef unsigned int[::1] random_states * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 943, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 955, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -7696,46 +7887,46 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); __pyx_t_5 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":945 + /* "lightfm/_lightfm_fast_no_openmp.pyx":957 * random_states = random_state.randint(0, * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) # <<<<<<<<<<<<<< * * no_examples = user_ids.shape[0] */ - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 945, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 957, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_num_threads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 945, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_num_threads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 957, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_size, __pyx_t_6) < 0) __PYX_ERR(0, 945, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_size, __pyx_t_6) < 0) __PYX_ERR(0, 957, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":943 + /* "lightfm/_lightfm_fast_no_openmp.pyx":955 * cdef unsigned int[::1] random_states * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 943, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 955, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":945 + /* "lightfm/_lightfm_fast_no_openmp.pyx":957 * random_states = random_state.randint(0, * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) # <<<<<<<<<<<<<< * * no_examples = user_ids.shape[0] */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 945, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 957, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 945, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 957, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 945, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 957, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -7751,16 +7942,16 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 945, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 957, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 945, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 957, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_random_states = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "lightfm/_lightfm_fast_no_openmp.pyx":947 + /* "lightfm/_lightfm_fast_no_openmp.pyx":959 * size=num_threads).astype(np.uint32) * * no_examples = user_ids.shape[0] # <<<<<<<<<<<<<< @@ -7769,7 +7960,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_no_examples = (__pyx_v_user_ids.shape[0]); - /* "lightfm/_lightfm_fast_no_openmp.pyx":948 + /* "lightfm/_lightfm_fast_no_openmp.pyx":960 * * no_examples = user_ids.shape[0] * MAX_LOSS = 10.0 # <<<<<<<<<<<<<< @@ -7778,7 +7969,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_MAX_LOSS = 10.0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":950 + /* "lightfm/_lightfm_fast_no_openmp.pyx":962 * MAX_LOSS = 10.0 * * with nogil: # <<<<<<<<<<<<<< @@ -7793,7 +7984,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO #endif /*try:*/ { - /* "lightfm/_lightfm_fast_no_openmp.pyx":952 + /* "lightfm/_lightfm_fast_no_openmp.pyx":964 * with nogil: * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -7802,7 +7993,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_user_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":953 + /* "lightfm/_lightfm_fast_no_openmp.pyx":965 * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * pos_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -7811,7 +8002,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_pos_it_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":954 + /* "lightfm/_lightfm_fast_no_openmp.pyx":966 * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * pos_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * neg_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -7820,7 +8011,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_neg_it_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":955 + /* "lightfm/_lightfm_fast_no_openmp.pyx":967 * pos_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * neg_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * pos_pairs = malloc(sizeof(Pair) * n) # <<<<<<<<<<<<<< @@ -7829,7 +8020,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_pos_pairs = ((struct __pyx_t_7lightfm_23_lightfm_fast_no_openmp_Pair *)malloc(((sizeof(struct __pyx_t_7lightfm_23_lightfm_fast_no_openmp_Pair)) * __pyx_v_n))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":957 + /* "lightfm/_lightfm_fast_no_openmp.pyx":969 * pos_pairs = malloc(sizeof(Pair) * n) * * for i in range(no_examples): # <<<<<<<<<<<<<< @@ -7841,7 +8032,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "lightfm/_lightfm_fast_no_openmp.pyx":958 + /* "lightfm/_lightfm_fast_no_openmp.pyx":970 * * for i in range(no_examples): * row = shuffle_indices[i] # <<<<<<<<<<<<<< @@ -7851,17 +8042,17 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO __pyx_t_11 = __pyx_v_i; __pyx_v_row = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_shuffle_indices.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":959 + /* "lightfm/_lightfm_fast_no_openmp.pyx":971 * for i in range(no_examples): * row = shuffle_indices[i] * user_id = user_ids[row] # <<<<<<<<<<<<<< * * compute_representation(user_features, */ - __pyx_t_12 = __pyx_v_row; - __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_12)) ))); + __pyx_t_11 = __pyx_v_row; + __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":961 + /* "lightfm/_lightfm_fast_no_openmp.pyx":973 * user_id = user_ids[row] * * compute_representation(user_features, # <<<<<<<<<<<<<< @@ -7870,7 +8061,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_biases, __pyx_v_lightfm, __pyx_v_user_id, __pyx_v_lightfm->user_scale, __pyx_v_user_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":969 + /* "lightfm/_lightfm_fast_no_openmp.pyx":981 * user_repr) * * user_pids_start = data.get_row_start(user_id) # <<<<<<<<<<<<<< @@ -7879,7 +8070,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_user_pids_start = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_data->__pyx_vtab)->get_row_start(__pyx_v_data, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":970 + /* "lightfm/_lightfm_fast_no_openmp.pyx":982 * * user_pids_start = data.get_row_start(user_id) * user_pids_stop = data.get_row_end(user_id) # <<<<<<<<<<<<<< @@ -7888,17 +8079,17 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_user_pids_stop = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_data->__pyx_vtab)->get_row_end(__pyx_v_data, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":972 + /* "lightfm/_lightfm_fast_no_openmp.pyx":984 * user_pids_stop = data.get_row_end(user_id) * * if user_pids_stop == user_pids_start: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_13 = ((__pyx_v_user_pids_stop == __pyx_v_user_pids_start) != 0); - if (__pyx_t_13) { + __pyx_t_12 = ((__pyx_v_user_pids_stop == __pyx_v_user_pids_start) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":973 + /* "lightfm/_lightfm_fast_no_openmp.pyx":985 * * if user_pids_stop == user_pids_start: * continue # <<<<<<<<<<<<<< @@ -7907,7 +8098,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ goto __pyx_L6_continue; - /* "lightfm/_lightfm_fast_no_openmp.pyx":972 + /* "lightfm/_lightfm_fast_no_openmp.pyx":984 * user_pids_stop = data.get_row_end(user_id) * * if user_pids_stop == user_pids_start: # <<<<<<<<<<<<<< @@ -7916,7 +8107,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ } - /* "lightfm/_lightfm_fast_no_openmp.pyx":976 + /* "lightfm/_lightfm_fast_no_openmp.pyx":988 * * # Sample k-th positive item * no_positives = int_min(n, user_pids_stop - user_pids_start) # <<<<<<<<<<<<<< @@ -7925,38 +8116,38 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_no_positives = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_int_min(__pyx_v_n, (__pyx_v_user_pids_stop - __pyx_v_user_pids_start)); - /* "lightfm/_lightfm_fast_no_openmp.pyx":977 + /* "lightfm/_lightfm_fast_no_openmp.pyx":989 * # Sample k-th positive item * no_positives = int_min(n, user_pids_stop - user_pids_start) * for j in range(no_positives): # <<<<<<<<<<<<<< * sampled_positive_item_id = data.indices[sample_range(user_pids_start, * user_pids_stop, */ - __pyx_t_14 = __pyx_v_no_positives; - __pyx_t_15 = __pyx_t_14; - for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { - __pyx_v_j = __pyx_t_16; + __pyx_t_13 = __pyx_v_no_positives; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_j = __pyx_t_15; - /* "lightfm/_lightfm_fast_no_openmp.pyx":980 + /* "lightfm/_lightfm_fast_no_openmp.pyx":992 * sampled_positive_item_id = data.indices[sample_range(user_pids_start, * user_pids_stop, * &random_states[0])] # <<<<<<<<<<<<<< * * compute_representation(item_features, */ - __pyx_t_17 = 0; + __pyx_t_11 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":978 + /* "lightfm/_lightfm_fast_no_openmp.pyx":990 * no_positives = int_min(n, user_pids_stop - user_pids_start) * for j in range(no_positives): * sampled_positive_item_id = data.indices[sample_range(user_pids_start, # <<<<<<<<<<<<<< * user_pids_stop, * &random_states[0])] */ - __pyx_t_18 = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_sample_range(__pyx_v_user_pids_start, __pyx_v_user_pids_stop, (&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_17)) ))))); - __pyx_v_sampled_positive_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_data->indices.data) + __pyx_t_18)) ))); + __pyx_t_16 = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_sample_range(__pyx_v_user_pids_start, __pyx_v_user_pids_stop, (&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_11)) ))))); + __pyx_v_sampled_positive_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_data->indices.data) + __pyx_t_16)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":982 + /* "lightfm/_lightfm_fast_no_openmp.pyx":994 * &random_states[0])] * * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -7965,7 +8156,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_sampled_positive_item_id, __pyx_v_lightfm->item_scale, __pyx_v_pos_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":990 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1002 * pos_it_repr) * * sampled_positive_prediction = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -7974,7 +8165,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_sampled_positive_prediction = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_pos_it_repr, __pyx_v_lightfm->no_components); - /* "lightfm/_lightfm_fast_no_openmp.pyx":994 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1006 * lightfm.no_components) * * pos_pairs[j].idx = sampled_positive_item_id # <<<<<<<<<<<<<< @@ -7983,7 +8174,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ (__pyx_v_pos_pairs[__pyx_v_j]).idx = __pyx_v_sampled_positive_item_id; - /* "lightfm/_lightfm_fast_no_openmp.pyx":995 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1007 * * pos_pairs[j].idx = sampled_positive_item_id * pos_pairs[j].val = sampled_positive_prediction # <<<<<<<<<<<<<< @@ -7993,7 +8184,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO (__pyx_v_pos_pairs[__pyx_v_j]).val = __pyx_v_sampled_positive_prediction; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":997 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1009 * pos_pairs[j].val = sampled_positive_prediction * * qsort(pos_pairs, # <<<<<<<<<<<<<< @@ -8002,27 +8193,27 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ qsort(__pyx_v_pos_pairs, __pyx_v_no_positives, (sizeof(struct __pyx_t_7lightfm_23_lightfm_fast_no_openmp_Pair)), __pyx_f_7lightfm_23_lightfm_fast_no_openmp_reverse_pair_compare); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1002 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1014 * reverse_pair_compare) * * positive_item_id = pos_pairs[int_min(k, no_positives) - 1].idx # <<<<<<<<<<<<<< * positive_prediction = pos_pairs[int_min(k, no_positives) - 1].val * */ - __pyx_t_14 = (__pyx_v_pos_pairs[(__pyx_f_7lightfm_23_lightfm_fast_no_openmp_int_min(__pyx_v_k, __pyx_v_no_positives) - 1)]).idx; - __pyx_v_positive_item_id = __pyx_t_14; + __pyx_t_13 = (__pyx_v_pos_pairs[(__pyx_f_7lightfm_23_lightfm_fast_no_openmp_int_min(__pyx_v_k, __pyx_v_no_positives) - 1)]).idx; + __pyx_v_positive_item_id = __pyx_t_13; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1003 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1015 * * positive_item_id = pos_pairs[int_min(k, no_positives) - 1].idx * positive_prediction = pos_pairs[int_min(k, no_positives) - 1].val # <<<<<<<<<<<<<< * * compute_representation(item_features, */ - __pyx_t_19 = (__pyx_v_pos_pairs[(__pyx_f_7lightfm_23_lightfm_fast_no_openmp_int_min(__pyx_v_k, __pyx_v_no_positives) - 1)]).val; - __pyx_v_positive_prediction = __pyx_t_19; + __pyx_t_17 = (__pyx_v_pos_pairs[(__pyx_f_7lightfm_23_lightfm_fast_no_openmp_int_min(__pyx_v_k, __pyx_v_no_positives) - 1)]).val; + __pyx_v_positive_prediction = __pyx_t_17; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1005 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1017 * positive_prediction = pos_pairs[int_min(k, no_positives) - 1].val * * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -8031,7 +8222,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_positive_item_id, __pyx_v_lightfm->item_scale, __pyx_v_pos_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1014 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1026 * * # Move on to the WARP step * sampled = 0 # <<<<<<<<<<<<<< @@ -8040,7 +8231,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_sampled = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1016 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1028 * sampled = 0 * * while sampled < lightfm.max_sampled: # <<<<<<<<<<<<<< @@ -8048,10 +8239,10 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO * sampled = sampled + 1 */ while (1) { - __pyx_t_13 = ((__pyx_v_sampled < __pyx_v_lightfm->max_sampled) != 0); - if (!__pyx_t_13) break; + __pyx_t_12 = ((__pyx_v_sampled < __pyx_v_lightfm->max_sampled) != 0); + if (!__pyx_t_12) break; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1018 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1030 * while sampled < lightfm.max_sampled: * * sampled = sampled + 1 # <<<<<<<<<<<<<< @@ -8060,25 +8251,25 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_sampled = (__pyx_v_sampled + 1); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1019 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1031 * * sampled = sampled + 1 * negative_item_id = (rand_r(&random_states[0]) # <<<<<<<<<<<<<< * % item_features.rows) * */ - __pyx_t_20 = 0; + __pyx_t_11 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1020 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1032 * sampled = sampled + 1 * negative_item_id = (rand_r(&random_states[0]) * % item_features.rows) # <<<<<<<<<<<<<< * * compute_representation(item_features, */ - __pyx_v_negative_item_id = (__pyx_f_7lightfm_23_lightfm_fast_no_openmp_rand_r((&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_20)) ))))) % __pyx_v_item_features->rows); + __pyx_v_negative_item_id = (__pyx_f_7lightfm_23_lightfm_fast_no_openmp_rand_r((&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_11)) ))))) % __pyx_v_item_features->rows); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1022 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1034 * % item_features.rows) * * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -8087,7 +8278,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_negative_item_id, __pyx_v_lightfm->item_scale, __pyx_v_neg_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1030 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1042 * neg_it_repr) * * negative_prediction = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -8096,27 +8287,27 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_negative_prediction = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_neg_it_repr, __pyx_v_lightfm->no_components); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1034 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1046 * lightfm.no_components) * * if negative_prediction > positive_prediction - 1: # <<<<<<<<<<<<<< * * if in_positives(negative_item_id, user_id, data): */ - __pyx_t_13 = ((__pyx_v_negative_prediction > (__pyx_v_positive_prediction - 1.0)) != 0); - if (__pyx_t_13) { + __pyx_t_12 = ((__pyx_v_negative_prediction > (__pyx_v_positive_prediction - 1.0)) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1036 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1048 * if negative_prediction > positive_prediction - 1: * * if in_positives(negative_item_id, user_id, data): # <<<<<<<<<<<<<< * continue * */ - __pyx_t_13 = (__pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives(__pyx_v_negative_item_id, __pyx_v_user_id, __pyx_v_data) != 0); - if (__pyx_t_13) { + __pyx_t_12 = (__pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives(__pyx_v_negative_item_id, __pyx_v_user_id, __pyx_v_data) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1037 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1049 * * if in_positives(negative_item_id, user_id, data): * continue # <<<<<<<<<<<<<< @@ -8125,7 +8316,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ goto __pyx_L11_continue; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1036 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1048 * if negative_prediction > positive_prediction - 1: * * if in_positives(negative_item_id, user_id, data): # <<<<<<<<<<<<<< @@ -8134,7 +8325,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1039 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1051 * continue * * loss = log(floor((item_features.rows - 1) / sampled)) # <<<<<<<<<<<<<< @@ -8143,17 +8334,17 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_loss = log(floor(((__pyx_v_item_features->rows - 1) / __pyx_v_sampled))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1042 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1054 * * # Clip gradients for numerical stability. * if loss > MAX_LOSS: # <<<<<<<<<<<<<< * loss = MAX_LOSS * */ - __pyx_t_13 = ((__pyx_v_loss > __pyx_v_MAX_LOSS) != 0); - if (__pyx_t_13) { + __pyx_t_12 = ((__pyx_v_loss > __pyx_v_MAX_LOSS) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1043 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1055 * # Clip gradients for numerical stability. * if loss > MAX_LOSS: * loss = MAX_LOSS # <<<<<<<<<<<<<< @@ -8162,7 +8353,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_v_loss = __pyx_v_MAX_LOSS; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1042 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1054 * * # Clip gradients for numerical stability. * if loss > MAX_LOSS: # <<<<<<<<<<<<<< @@ -8171,7 +8362,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1045 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1057 * loss = MAX_LOSS * * warp_update(loss, # <<<<<<<<<<<<<< @@ -8180,7 +8371,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update(__pyx_v_loss, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_user_id, __pyx_v_positive_item_id, __pyx_v_negative_item_id, __pyx_v_user_repr, __pyx_v_pos_it_repr, __pyx_v_neg_it_repr, __pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1057 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1069 * item_alpha, * user_alpha) * break # <<<<<<<<<<<<<< @@ -8189,7 +8380,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ goto __pyx_L12_break; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1034 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1046 * lightfm.no_components) * * if negative_prediction > positive_prediction - 1: # <<<<<<<<<<<<<< @@ -8201,25 +8392,25 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO } __pyx_L12_break:; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1059 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1071 * break * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< * locked_regularize(lightfm, * item_alpha, */ - __pyx_t_21 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); - if (!__pyx_t_21) { + __pyx_t_18 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); + if (!__pyx_t_18) { } else { - __pyx_t_13 = __pyx_t_21; + __pyx_t_12 = __pyx_t_18; goto __pyx_L17_bool_binop_done; } - __pyx_t_21 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); - __pyx_t_13 = __pyx_t_21; + __pyx_t_18 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); + __pyx_t_12 = __pyx_t_18; __pyx_L17_bool_binop_done:; - if (__pyx_t_13) { + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1060 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1072 * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: * locked_regularize(lightfm, # <<<<<<<<<<<<<< @@ -8228,7 +8419,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_locked_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1059 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1071 * break * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< @@ -8239,7 +8430,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO __pyx_L6_continue:; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1064 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1076 * user_alpha) * * free(user_repr) # <<<<<<<<<<<<<< @@ -8248,7 +8439,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ free(__pyx_v_user_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1065 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1077 * * free(user_repr) * free(pos_it_repr) # <<<<<<<<<<<<<< @@ -8257,7 +8448,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ free(__pyx_v_pos_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1066 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1078 * free(user_repr) * free(pos_it_repr) * free(neg_it_repr) # <<<<<<<<<<<<<< @@ -8266,7 +8457,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ free(__pyx_v_neg_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1067 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1079 * free(pos_it_repr) * free(neg_it_repr) * free(pos_pairs) # <<<<<<<<<<<<<< @@ -8276,7 +8467,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO free(__pyx_v_pos_pairs); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":950 + /* "lightfm/_lightfm_fast_no_openmp.pyx":962 * MAX_LOSS = 10.0 * * with nogil: # <<<<<<<<<<<<<< @@ -8295,7 +8486,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO } } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1069 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1081 * free(pos_pairs) * * regularize(lightfm, # <<<<<<<<<<<<<< @@ -8304,7 +8495,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_no_openmp.pyx":915 + /* "lightfm/_lightfm_fast_no_openmp.pyx":927 * * * def fit_warp_kos(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -8334,7 +8525,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_4fit_warp_kos(CYTHO return __pyx_r; } -/* "lightfm/_lightfm_fast_no_openmp.pyx":1074 +/* "lightfm/_lightfm_fast_no_openmp.pyx":1086 * * * def fit_bpr(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -8361,6 +8552,9 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_7fit_bpr(PyObject * double __pyx_v_user_alpha; int __pyx_v_num_threads; PyObject *__pyx_v_random_state = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fit_bpr (wrapper)", 0); @@ -8411,83 +8605,83 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_7fit_bpr(PyObject * case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 1); __PYX_ERR(0, 1074, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 1); __PYX_ERR(0, 1086, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interactions)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 2); __PYX_ERR(0, 1074, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 2); __PYX_ERR(0, 1086, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 3); __PYX_ERR(0, 1074, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 3); __PYX_ERR(0, 1086, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 4); __PYX_ERR(0, 1074, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 4); __PYX_ERR(0, 1086, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 5); __PYX_ERR(0, 1074, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 5); __PYX_ERR(0, 1086, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sample_weight)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 6); __PYX_ERR(0, 1074, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 6); __PYX_ERR(0, 1086, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shuffle_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 7); __PYX_ERR(0, 1074, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 7); __PYX_ERR(0, 1086, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lightfm)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 8); __PYX_ERR(0, 1074, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 8); __PYX_ERR(0, 1086, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_learning_rate)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 9); __PYX_ERR(0, 1074, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 9); __PYX_ERR(0, 1086, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 10); __PYX_ERR(0, 1074, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 10); __PYX_ERR(0, 1086, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 11); __PYX_ERR(0, 1074, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 11); __PYX_ERR(0, 1086, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 12); __PYX_ERR(0, 1074, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 12); __PYX_ERR(0, 1086, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 13: if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_random_state)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 13); __PYX_ERR(0, 1074, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 13); __PYX_ERR(0, 1086, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_bpr") < 0)) __PYX_ERR(0, 1074, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_bpr") < 0)) __PYX_ERR(0, 1086, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 14) { goto __pyx_L5_argtuple_error; @@ -8510,30 +8704,30 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_7fit_bpr(PyObject * __pyx_v_item_features = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[0]); __pyx_v_user_features = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[1]); __pyx_v_interactions = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[2]); - __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 1077, __pyx_L3_error) - __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 1078, __pyx_L3_error) - __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_Y.memview)) __PYX_ERR(0, 1079, __pyx_L3_error) - __pyx_v_sample_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_sample_weight.memview)) __PYX_ERR(0, 1080, __pyx_L3_error) - __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 1081, __pyx_L3_error) + __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 1089, __pyx_L3_error) + __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 1090, __pyx_L3_error) + __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_Y.memview)) __PYX_ERR(0, 1091, __pyx_L3_error) + __pyx_v_sample_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_sample_weight.memview)) __PYX_ERR(0, 1092, __pyx_L3_error) + __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 1093, __pyx_L3_error) __pyx_v_lightfm = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *)values[8]); - __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1083, __pyx_L3_error) - __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1084, __pyx_L3_error) - __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1085, __pyx_L3_error) - __pyx_v_num_threads = __Pyx_PyInt_As_int(values[12]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1086, __pyx_L3_error) + __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1095, __pyx_L3_error) + __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1096, __pyx_L3_error) + __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1097, __pyx_L3_error) + __pyx_v_num_threads = __Pyx_PyInt_As_int(values[12]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1098, __pyx_L3_error) __pyx_v_random_state = values[13]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1074, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1086, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_no_openmp.fit_bpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 1074, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 1075, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interactions), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "interactions", 0))) __PYX_ERR(0, 1076, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 1082, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 1086, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 1087, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interactions), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "interactions", 0))) __PYX_ERR(0, 1088, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 1094, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(__pyx_self, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_interactions, __pyx_v_user_ids, __pyx_v_item_ids, __pyx_v_Y, __pyx_v_sample_weight, __pyx_v_shuffle_indices, __pyx_v_lightfm, __pyx_v_learning_rate, __pyx_v_item_alpha, __pyx_v_user_alpha, __pyx_v_num_threads, __pyx_v_random_state); /* function exit code */ @@ -8573,44 +8767,42 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU int __pyx_t_9; int __pyx_t_10; Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; + int __pyx_t_12; int __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; + int __pyx_t_14; + int __pyx_t_15; Py_ssize_t __pyx_t_16; int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - int __pyx_t_22; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fit_bpr", 0); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1101 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1113 * cdef flt *neg_it_repr * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_randint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1101, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_randint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1102 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1114 * * random_states = random_state.randint(0, * np.iinfo(np.int32).max, # <<<<<<<<<<<<<< * size=num_threads).astype(np.uint32) * */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1102, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_iinfo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1102, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_iinfo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1102, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1102, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -8626,21 +8818,21 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1102, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1102, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1114, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1101 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1113 * cdef flt *neg_it_repr * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1101, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -8649,46 +8841,46 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); __pyx_t_5 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1103 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1115 * random_states = random_state.randint(0, * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) # <<<<<<<<<<<<<< * * no_examples = Y.shape[0] */ - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1103, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_num_threads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1103, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_num_threads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_size, __pyx_t_6) < 0) __PYX_ERR(0, 1103, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_size, __pyx_t_6) < 0) __PYX_ERR(0, 1115, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1101 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1113 * cdef flt *neg_it_repr * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1101, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1113, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1103 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1115 * random_states = random_state.randint(0, * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) # <<<<<<<<<<<<<< * * no_examples = Y.shape[0] */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1103, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1103, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1103, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -8704,16 +8896,16 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1103, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1115, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1103, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1115, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_random_states = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1105 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1117 * size=num_threads).astype(np.uint32) * * no_examples = Y.shape[0] # <<<<<<<<<<<<<< @@ -8722,7 +8914,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ __pyx_v_no_examples = (__pyx_v_Y.shape[0]); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1107 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1119 * no_examples = Y.shape[0] * * with nogil: # <<<<<<<<<<<<<< @@ -8737,7 +8929,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU #endif /*try:*/ { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1109 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1121 * with nogil: * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -8746,7 +8938,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ __pyx_v_user_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1110 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1122 * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * pos_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -8755,7 +8947,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ __pyx_v_pos_it_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1111 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1123 * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * pos_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * neg_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -8764,7 +8956,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ __pyx_v_neg_it_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1113 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1125 * neg_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * * for i in range(no_examples): # <<<<<<<<<<<<<< @@ -8776,7 +8968,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1114 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1126 * * for i in range(no_examples): * row = shuffle_indices[i] # <<<<<<<<<<<<<< @@ -8786,18 +8978,18 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU __pyx_t_11 = __pyx_v_i; __pyx_v_row = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_shuffle_indices.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1116 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1128 * row = shuffle_indices[i] * * if not Y[row] > 0: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_12 = __pyx_v_row; - __pyx_t_13 = ((!(((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_Y.data) + __pyx_t_12)) ))) > 0.0) != 0)) != 0); - if (__pyx_t_13) { + __pyx_t_11 = __pyx_v_row; + __pyx_t_12 = ((!(((*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_Y.data) + __pyx_t_11)) ))) > 0.0) != 0)) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1117 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1129 * * if not Y[row] > 0: * continue # <<<<<<<<<<<<<< @@ -8806,7 +8998,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ goto __pyx_L6_continue; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1116 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1128 * row = shuffle_indices[i] * * if not Y[row] > 0: # <<<<<<<<<<<<<< @@ -8815,78 +9007,78 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1119 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1131 * continue * * weight = sample_weight[row] # <<<<<<<<<<<<<< * user_id = user_ids[row] * positive_item_id = item_ids[row] */ - __pyx_t_14 = __pyx_v_row; - __pyx_v_weight = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_sample_weight.data) + __pyx_t_14)) ))); + __pyx_t_11 = __pyx_v_row; + __pyx_v_weight = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_sample_weight.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1120 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1132 * * weight = sample_weight[row] * user_id = user_ids[row] # <<<<<<<<<<<<<< * positive_item_id = item_ids[row] * */ - __pyx_t_15 = __pyx_v_row; - __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_15)) ))); + __pyx_t_11 = __pyx_v_row; + __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1121 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1133 * weight = sample_weight[row] * user_id = user_ids[row] * positive_item_id = item_ids[row] # <<<<<<<<<<<<<< * * for j in range(no_examples): */ - __pyx_t_16 = __pyx_v_row; - __pyx_v_positive_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_16)) ))); + __pyx_t_11 = __pyx_v_row; + __pyx_v_positive_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1123 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1135 * positive_item_id = item_ids[row] * * for j in range(no_examples): # <<<<<<<<<<<<<< * negative_item_id = item_ids[(rand_r(&random_states[0]) * % no_examples)] */ - __pyx_t_17 = __pyx_v_no_examples; - __pyx_t_18 = __pyx_t_17; - for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { - __pyx_v_j = __pyx_t_19; + __pyx_t_13 = __pyx_v_no_examples; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_j = __pyx_t_15; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1124 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1136 * * for j in range(no_examples): * negative_item_id = item_ids[(rand_r(&random_states[0]) # <<<<<<<<<<<<<< * % no_examples)] * if not in_positives(negative_item_id, user_id, interactions): */ - __pyx_t_20 = 0; + __pyx_t_11 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1125 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1137 * for j in range(no_examples): * negative_item_id = item_ids[(rand_r(&random_states[0]) * % no_examples)] # <<<<<<<<<<<<<< * if not in_positives(negative_item_id, user_id, interactions): * break */ - __pyx_t_21 = (__pyx_f_7lightfm_23_lightfm_fast_no_openmp_rand_r((&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_20)) ))))) % __pyx_v_no_examples); - __pyx_v_negative_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_21)) ))); + __pyx_t_16 = (__pyx_f_7lightfm_23_lightfm_fast_no_openmp_rand_r((&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_11)) ))))) % __pyx_v_no_examples); + __pyx_v_negative_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_16)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1126 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1138 * negative_item_id = item_ids[(rand_r(&random_states[0]) * % no_examples)] * if not in_positives(negative_item_id, user_id, interactions): # <<<<<<<<<<<<<< * break * */ - __pyx_t_13 = ((!(__pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives(__pyx_v_negative_item_id, __pyx_v_user_id, __pyx_v_interactions) != 0)) != 0); - if (__pyx_t_13) { + __pyx_t_12 = ((!(__pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives(__pyx_v_negative_item_id, __pyx_v_user_id, __pyx_v_interactions) != 0)) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1127 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1139 * % no_examples)] * if not in_positives(negative_item_id, user_id, interactions): * break # <<<<<<<<<<<<<< @@ -8895,7 +9087,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ goto __pyx_L10_break; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1126 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1138 * negative_item_id = item_ids[(rand_r(&random_states[0]) * % no_examples)] * if not in_positives(negative_item_id, user_id, interactions): # <<<<<<<<<<<<<< @@ -8906,7 +9098,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU } __pyx_L10_break:; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1129 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1141 * break * * compute_representation(user_features, # <<<<<<<<<<<<<< @@ -8915,7 +9107,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_biases, __pyx_v_lightfm, __pyx_v_user_id, __pyx_v_lightfm->user_scale, __pyx_v_user_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1136 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1148 * lightfm.user_scale, * user_repr) * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -8924,7 +9116,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_positive_item_id, __pyx_v_lightfm->item_scale, __pyx_v_pos_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1143 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1155 * lightfm.item_scale, * pos_it_repr) * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -8933,7 +9125,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_negative_item_id, __pyx_v_lightfm->item_scale, __pyx_v_neg_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1151 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1163 * neg_it_repr) * * positive_prediction = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -8942,7 +9134,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ __pyx_v_positive_prediction = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_pos_it_repr, __pyx_v_lightfm->no_components); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1154 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1166 * pos_it_repr, * lightfm.no_components) * negative_prediction = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -8951,7 +9143,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ __pyx_v_negative_prediction = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_neg_it_repr, __pyx_v_lightfm->no_components); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1158 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1170 * lightfm.no_components) * * warp_update(weight * (1.0 - sigmoid(positive_prediction - negative_prediction)), # <<<<<<<<<<<<<< @@ -8960,25 +9152,25 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_warp_update((__pyx_v_weight * (1.0 - __pyx_f_7lightfm_23_lightfm_fast_no_openmp_sigmoid((__pyx_v_positive_prediction - __pyx_v_negative_prediction)))), __pyx_v_item_features, __pyx_v_user_features, __pyx_v_user_id, __pyx_v_positive_item_id, __pyx_v_negative_item_id, __pyx_v_user_repr, __pyx_v_pos_it_repr, __pyx_v_neg_it_repr, __pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1171 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1183 * user_alpha) * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< * locked_regularize(lightfm, * item_alpha, */ - __pyx_t_22 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); - if (!__pyx_t_22) { + __pyx_t_17 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); + if (!__pyx_t_17) { } else { - __pyx_t_13 = __pyx_t_22; + __pyx_t_12 = __pyx_t_17; goto __pyx_L13_bool_binop_done; } - __pyx_t_22 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); - __pyx_t_13 = __pyx_t_22; + __pyx_t_17 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE) != 0); + __pyx_t_12 = __pyx_t_17; __pyx_L13_bool_binop_done:; - if (__pyx_t_13) { + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1172 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1184 * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: * locked_regularize(lightfm, # <<<<<<<<<<<<<< @@ -8987,7 +9179,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_locked_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1171 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1183 * user_alpha) * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< @@ -8998,7 +9190,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU __pyx_L6_continue:; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1176 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1188 * user_alpha) * * free(user_repr) # <<<<<<<<<<<<<< @@ -9007,7 +9199,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ free(__pyx_v_user_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1177 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1189 * * free(user_repr) * free(pos_it_repr) # <<<<<<<<<<<<<< @@ -9016,7 +9208,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ free(__pyx_v_pos_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1178 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1190 * free(user_repr) * free(pos_it_repr) * free(neg_it_repr) # <<<<<<<<<<<<<< @@ -9026,7 +9218,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU free(__pyx_v_neg_it_repr); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1107 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1119 * no_examples = Y.shape[0] * * with nogil: # <<<<<<<<<<<<<< @@ -9045,7 +9237,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU } } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1180 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1192 * free(neg_it_repr) * * regularize(lightfm, # <<<<<<<<<<<<<< @@ -9054,7 +9246,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1074 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1086 * * * def fit_bpr(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -9087,7 +9279,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_6fit_bpr(CYTHON_UNU return __pyx_r; } -/* "lightfm/_lightfm_fast_no_openmp.pyx":1185 +/* "lightfm/_lightfm_fast_no_openmp.pyx":1197 * * * def predict_lightfm(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -9107,6 +9299,9 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_9predict_lightfm(Py __Pyx_memviewslice __pyx_v_predictions = { 0, 0, { 0 }, { 0 }, { 0 } }; struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *__pyx_v_lightfm = 0; CYTHON_UNUSED int __pyx_v_num_threads; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("predict_lightfm (wrapper)", 0); @@ -9143,41 +9338,41 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_9predict_lightfm(Py case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 1); __PYX_ERR(0, 1185, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 1); __PYX_ERR(0, 1197, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 2); __PYX_ERR(0, 1185, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 2); __PYX_ERR(0, 1197, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 3); __PYX_ERR(0, 1185, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 3); __PYX_ERR(0, 1197, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_predictions)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 4); __PYX_ERR(0, 1185, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 4); __PYX_ERR(0, 1197, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lightfm)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 5); __PYX_ERR(0, 1185, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 5); __PYX_ERR(0, 1197, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 6); __PYX_ERR(0, 1185, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 6); __PYX_ERR(0, 1197, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict_lightfm") < 0)) __PYX_ERR(0, 1185, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict_lightfm") < 0)) __PYX_ERR(0, 1197, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; @@ -9192,23 +9387,23 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_9predict_lightfm(Py } __pyx_v_item_features = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[0]); __pyx_v_user_features = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[1]); - __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 1187, __pyx_L3_error) - __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 1188, __pyx_L3_error) - __pyx_v_predictions = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_predictions.memview)) __PYX_ERR(0, 1189, __pyx_L3_error) + __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 1199, __pyx_L3_error) + __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 1200, __pyx_L3_error) + __pyx_v_predictions = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_predictions.memview)) __PYX_ERR(0, 1201, __pyx_L3_error) __pyx_v_lightfm = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *)values[5]); - __pyx_v_num_threads = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1191, __pyx_L3_error) + __pyx_v_num_threads = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1203, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1185, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1197, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_no_openmp.predict_lightfm", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 1185, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 1186, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 1190, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 1197, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 1198, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 1202, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_8predict_lightfm(__pyx_self, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_user_ids, __pyx_v_item_ids, __pyx_v_predictions, __pyx_v_lightfm, __pyx_v_num_threads); /* function exit code */ @@ -9231,11 +9426,9 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_8predict_lightfm(CY int __pyx_t_2; int __pyx_t_3; Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; __Pyx_RefNannySetupContext("predict_lightfm", 0); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1200 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1212 * cdef flt *it_repr * * no_examples = predictions.shape[0] # <<<<<<<<<<<<<< @@ -9244,7 +9437,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_8predict_lightfm(CY */ __pyx_v_no_examples = (__pyx_v_predictions.shape[0]); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1202 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1214 * no_examples = predictions.shape[0] * * with nogil: # <<<<<<<<<<<<<< @@ -9259,7 +9452,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_8predict_lightfm(CY #endif /*try:*/ { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1204 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1216 * with nogil: * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -9268,7 +9461,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_8predict_lightfm(CY */ __pyx_v_user_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1205 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1217 * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -9277,7 +9470,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_8predict_lightfm(CY */ __pyx_v_it_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1207 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1219 * it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * * for i in range(no_examples): # <<<<<<<<<<<<<< @@ -9289,7 +9482,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_8predict_lightfm(CY for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1213 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1225 * lightfm.user_biases, * lightfm, * user_ids[i], # <<<<<<<<<<<<<< @@ -9298,7 +9491,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_8predict_lightfm(CY */ __pyx_t_4 = __pyx_v_i; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1209 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1221 * for i in range(no_examples): * * compute_representation(user_features, # <<<<<<<<<<<<<< @@ -9307,36 +9500,36 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_8predict_lightfm(CY */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_biases, __pyx_v_lightfm, (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_4)) ))), __pyx_v_lightfm->user_scale, __pyx_v_user_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1220 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1232 * lightfm.item_biases, * lightfm, * item_ids[i], # <<<<<<<<<<<<<< * lightfm.item_scale, * it_repr) */ - __pyx_t_5 = __pyx_v_i; + __pyx_t_4 = __pyx_v_i; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1216 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1228 * lightfm.user_scale, * user_repr) * compute_representation(item_features, # <<<<<<<<<<<<<< * lightfm.item_features, * lightfm.item_biases, */ - __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_5)) ))), __pyx_v_lightfm->item_scale, __pyx_v_it_repr); + __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_4)) ))), __pyx_v_lightfm->item_scale, __pyx_v_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1224 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1236 * it_repr) * * predictions[i] = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< * it_repr, * lightfm.no_components) */ - __pyx_t_6 = __pyx_v_i; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_predictions.data) + __pyx_t_6)) )) = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_it_repr, __pyx_v_lightfm->no_components); + __pyx_t_4 = __pyx_v_i; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_predictions.data) + __pyx_t_4)) )) = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_it_repr, __pyx_v_lightfm->no_components); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1228 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1240 * lightfm.no_components) * * free(user_repr) # <<<<<<<<<<<<<< @@ -9345,7 +9538,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_8predict_lightfm(CY */ free(__pyx_v_user_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1229 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1241 * * free(user_repr) * free(it_repr) # <<<<<<<<<<<<<< @@ -9355,7 +9548,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_8predict_lightfm(CY free(__pyx_v_it_repr); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1202 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1214 * no_examples = predictions.shape[0] * * with nogil: # <<<<<<<<<<<<<< @@ -9374,7 +9567,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_8predict_lightfm(CY } } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1185 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1197 * * * def predict_lightfm(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -9392,7 +9585,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_8predict_lightfm(CY return __pyx_r; } -/* "lightfm/_lightfm_fast_no_openmp.pyx":1232 +/* "lightfm/_lightfm_fast_no_openmp.pyx":1244 * * * def predict_ranks(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -9412,6 +9605,9 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_11predict_ranks(PyO __Pyx_memviewslice __pyx_v_ranks = { 0, 0, { 0 }, { 0 }, { 0 } }; struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *__pyx_v_lightfm = 0; CYTHON_UNUSED int __pyx_v_num_threads; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("predict_ranks (wrapper)", 0); @@ -9448,41 +9644,41 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_11predict_ranks(PyO case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 1); __PYX_ERR(0, 1232, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 1); __PYX_ERR(0, 1244, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_test_interactions)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 2); __PYX_ERR(0, 1232, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 2); __PYX_ERR(0, 1244, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_train_interactions)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 3); __PYX_ERR(0, 1232, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 3); __PYX_ERR(0, 1244, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ranks)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 4); __PYX_ERR(0, 1232, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 4); __PYX_ERR(0, 1244, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lightfm)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 5); __PYX_ERR(0, 1232, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 5); __PYX_ERR(0, 1244, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 6); __PYX_ERR(0, 1232, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 6); __PYX_ERR(0, 1244, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict_ranks") < 0)) __PYX_ERR(0, 1232, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict_ranks") < 0)) __PYX_ERR(0, 1244, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; @@ -9499,23 +9695,23 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_11predict_ranks(PyO __pyx_v_user_features = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[1]); __pyx_v_test_interactions = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[2]); __pyx_v_train_interactions = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[3]); - __pyx_v_ranks = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ranks.memview)) __PYX_ERR(0, 1236, __pyx_L3_error) + __pyx_v_ranks = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ranks.memview)) __PYX_ERR(0, 1248, __pyx_L3_error) __pyx_v_lightfm = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *)values[5]); - __pyx_v_num_threads = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1238, __pyx_L3_error) + __pyx_v_num_threads = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1250, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1232, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1244, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_no_openmp.predict_ranks", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 1232, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 1233, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_test_interactions), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "test_interactions", 0))) __PYX_ERR(0, 1234, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_train_interactions), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "train_interactions", 0))) __PYX_ERR(0, 1235, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 1237, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 1244, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 1245, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_test_interactions), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "test_interactions", 0))) __PYX_ERR(0, 1246, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_train_interactions), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "train_interactions", 0))) __PYX_ERR(0, 1247, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 1249, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(__pyx_self, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_test_interactions, __pyx_v_train_interactions, __pyx_v_ranks, __pyx_v_lightfm, __pyx_v_num_threads); /* function exit code */ @@ -9553,10 +9749,9 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT int __pyx_t_10; int __pyx_t_11; int __pyx_t_12; - Py_ssize_t __pyx_t_13; __Pyx_RefNannySetupContext("predict_ranks", 0); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1248 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1260 * cdef flt prediction, rank * * predictions_size = 0 # <<<<<<<<<<<<<< @@ -9565,7 +9760,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ __pyx_v_predictions_size = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1252 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1264 * # Figure out the max size of the predictions * # buffer. * for user_id in range(test_interactions.rows): # <<<<<<<<<<<<<< @@ -9577,7 +9772,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_user_id = __pyx_t_3; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1253 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1265 * # buffer. * for user_id in range(test_interactions.rows): * predictions_size = int_max(predictions_size, # <<<<<<<<<<<<<< @@ -9587,7 +9782,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT __pyx_v_predictions_size = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_int_max(__pyx_v_predictions_size, (((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_test_interactions->__pyx_vtab)->get_row_end(__pyx_v_test_interactions, __pyx_v_user_id) - ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_test_interactions->__pyx_vtab)->get_row_start(__pyx_v_test_interactions, __pyx_v_user_id))); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1257 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1269 * - test_interactions.get_row_start(user_id)) * * with nogil: # <<<<<<<<<<<<<< @@ -9602,7 +9797,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT #endif /*try:*/ { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1259 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1271 * with nogil: * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -9611,7 +9806,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ __pyx_v_user_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1260 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1272 * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -9620,7 +9815,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ __pyx_v_it_repr = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1261 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1273 * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * item_ids = malloc(sizeof(int) * predictions_size) # <<<<<<<<<<<<<< @@ -9629,7 +9824,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ __pyx_v_item_ids = ((int *)malloc(((sizeof(int)) * __pyx_v_predictions_size))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1262 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1274 * it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * item_ids = malloc(sizeof(int) * predictions_size) * predictions = malloc(sizeof(flt) * predictions_size) # <<<<<<<<<<<<<< @@ -9638,7 +9833,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ __pyx_v_predictions = ((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)) * __pyx_v_predictions_size))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1264 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1276 * predictions = malloc(sizeof(flt) * predictions_size) * * for user_id in range(test_interactions.rows): # <<<<<<<<<<<<<< @@ -9650,7 +9845,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_user_id = __pyx_t_3; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1266 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1278 * for user_id in range(test_interactions.rows): * * row_start = test_interactions.get_row_start(user_id) # <<<<<<<<<<<<<< @@ -9659,7 +9854,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ __pyx_v_row_start = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_test_interactions->__pyx_vtab)->get_row_start(__pyx_v_test_interactions, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1267 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1279 * * row_start = test_interactions.get_row_start(user_id) * row_stop = test_interactions.get_row_end(user_id) # <<<<<<<<<<<<<< @@ -9668,7 +9863,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ __pyx_v_row_stop = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_test_interactions->__pyx_vtab)->get_row_end(__pyx_v_test_interactions, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1269 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1281 * row_stop = test_interactions.get_row_end(user_id) * * if row_stop == row_start: # <<<<<<<<<<<<<< @@ -9678,7 +9873,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT __pyx_t_4 = ((__pyx_v_row_stop == __pyx_v_row_start) != 0); if (__pyx_t_4) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1271 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1283 * if row_stop == row_start: * # No test interactions for this user * continue # <<<<<<<<<<<<<< @@ -9687,7 +9882,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ goto __pyx_L8_continue; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1269 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1281 * row_stop = test_interactions.get_row_end(user_id) * * if row_stop == row_start: # <<<<<<<<<<<<<< @@ -9696,7 +9891,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1273 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1285 * continue * * compute_representation(user_features, # <<<<<<<<<<<<<< @@ -9705,7 +9900,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_biases, __pyx_v_lightfm, __pyx_v_user_id, __pyx_v_lightfm->user_scale, __pyx_v_user_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1283 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1295 * # Compute predictions for the items whose * # ranks we want to know * for i in range(row_stop - row_start): # <<<<<<<<<<<<<< @@ -9717,7 +9912,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1285 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1297 * for i in range(row_stop - row_start): * * item_id = test_interactions.indices[row_start + i] # <<<<<<<<<<<<<< @@ -9727,7 +9922,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT __pyx_t_8 = (__pyx_v_row_start + __pyx_v_i); __pyx_v_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_test_interactions->indices.data) + __pyx_t_8)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1287 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1299 * item_id = test_interactions.indices[row_start + i] * * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -9736,7 +9931,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_item_id, __pyx_v_lightfm->item_scale, __pyx_v_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1295 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1307 * it_repr) * * item_ids[i] = item_id # <<<<<<<<<<<<<< @@ -9745,7 +9940,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ (__pyx_v_item_ids[__pyx_v_i]) = __pyx_v_item_id; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1296 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1308 * * item_ids[i] = item_id * predictions[i] = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -9755,7 +9950,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT (__pyx_v_predictions[__pyx_v_i]) = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_it_repr, __pyx_v_lightfm->no_components); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1301 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1313 * * # Now we can zip through all the other items and compute ranks * for item_id in range(test_interactions.cols): # <<<<<<<<<<<<<< @@ -9767,7 +9962,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_item_id = __pyx_t_7; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1303 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1315 * for item_id in range(test_interactions.cols): * * if in_positives(item_id, user_id, train_interactions): # <<<<<<<<<<<<<< @@ -9777,7 +9972,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT __pyx_t_4 = (__pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives(__pyx_v_item_id, __pyx_v_user_id, __pyx_v_train_interactions) != 0); if (__pyx_t_4) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1304 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1316 * * if in_positives(item_id, user_id, train_interactions): * continue # <<<<<<<<<<<<<< @@ -9786,7 +9981,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ goto __pyx_L13_continue; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1303 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1315 * for item_id in range(test_interactions.cols): * * if in_positives(item_id, user_id, train_interactions): # <<<<<<<<<<<<<< @@ -9795,7 +9990,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1306 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1318 * continue * * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -9804,7 +9999,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_item_id, __pyx_v_lightfm->item_scale, __pyx_v_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1313 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1325 * lightfm.item_scale, * it_repr) * prediction = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -9813,7 +10008,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ __pyx_v_prediction = __pyx_f_7lightfm_23_lightfm_fast_no_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_it_repr, __pyx_v_lightfm->no_components); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1317 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1329 * lightfm.no_components) * * for i in range(row_stop - row_start): # <<<<<<<<<<<<<< @@ -9825,7 +10020,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1318 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1330 * * for i in range(row_stop - row_start): * if item_id != item_ids[i] and prediction >= predictions[i]: # <<<<<<<<<<<<<< @@ -9843,17 +10038,17 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT __pyx_L19_bool_binop_done:; if (__pyx_t_4) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1319 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1331 * for i in range(row_stop - row_start): * if item_id != item_ids[i] and prediction >= predictions[i]: * ranks[row_start + i] += 1.0 # <<<<<<<<<<<<<< * * free(user_repr) */ - __pyx_t_13 = (__pyx_v_row_start + __pyx_v_i); - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_ranks.data) + __pyx_t_13)) )) += 1.0; + __pyx_t_8 = (__pyx_v_row_start + __pyx_v_i); + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_ranks.data) + __pyx_t_8)) )) += 1.0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1318 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1330 * * for i in range(row_stop - row_start): * if item_id != item_ids[i] and prediction >= predictions[i]: # <<<<<<<<<<<<<< @@ -9867,7 +10062,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT __pyx_L8_continue:; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1321 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1333 * ranks[row_start + i] += 1.0 * * free(user_repr) # <<<<<<<<<<<<<< @@ -9876,7 +10071,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ free(__pyx_v_user_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1322 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1334 * * free(user_repr) * free(it_repr) # <<<<<<<<<<<<<< @@ -9885,7 +10080,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT */ free(__pyx_v_it_repr); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1323 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1335 * free(user_repr) * free(it_repr) * free(predictions) # <<<<<<<<<<<<<< @@ -9895,7 +10090,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT free(__pyx_v_predictions); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1257 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1269 * - test_interactions.get_row_start(user_id)) * * with nogil: # <<<<<<<<<<<<<< @@ -9914,7 +10109,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT } } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1232 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1244 * * * def predict_ranks(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -9930,7 +10125,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_10predict_ranks(CYT return __pyx_r; } -/* "lightfm/_lightfm_fast_no_openmp.pyx":1326 +/* "lightfm/_lightfm_fast_no_openmp.pyx":1338 * * * def calculate_auc_from_rank(CSRMatrix ranks, # <<<<<<<<<<<<<< @@ -9947,6 +10142,9 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_13calculate_auc_fro __Pyx_memviewslice __pyx_v_rank_data = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_auc = { 0, 0, { 0 }, { 0 }, { 0 } }; CYTHON_UNUSED int __pyx_v_num_threads; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calculate_auc_from_rank (wrapper)", 0); @@ -9979,29 +10177,29 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_13calculate_auc_fro case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_train_positives)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 1); __PYX_ERR(0, 1326, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 1); __PYX_ERR(0, 1338, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rank_data)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 2); __PYX_ERR(0, 1326, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 2); __PYX_ERR(0, 1338, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_auc)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 3); __PYX_ERR(0, 1326, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 3); __PYX_ERR(0, 1338, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 4); __PYX_ERR(0, 1326, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 4); __PYX_ERR(0, 1338, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculate_auc_from_rank") < 0)) __PYX_ERR(0, 1326, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculate_auc_from_rank") < 0)) __PYX_ERR(0, 1338, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -10013,20 +10211,20 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_13calculate_auc_fro values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_ranks = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[0]); - __pyx_v_num_train_positives = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_num_train_positives.memview)) __PYX_ERR(0, 1327, __pyx_L3_error) - __pyx_v_rank_data = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rank_data.memview)) __PYX_ERR(0, 1328, __pyx_L3_error) - __pyx_v_auc = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_auc.memview)) __PYX_ERR(0, 1329, __pyx_L3_error) - __pyx_v_num_threads = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1330, __pyx_L3_error) + __pyx_v_num_train_positives = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_num_train_positives.memview)) __PYX_ERR(0, 1339, __pyx_L3_error) + __pyx_v_rank_data = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rank_data.memview)) __PYX_ERR(0, 1340, __pyx_L3_error) + __pyx_v_auc = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_auc.memview)) __PYX_ERR(0, 1341, __pyx_L3_error) + __pyx_v_num_threads = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1342, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1326, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1338, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_no_openmp.calculate_auc_from_rank", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ranks), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "ranks", 0))) __PYX_ERR(0, 1326, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ranks), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "ranks", 0))) __PYX_ERR(0, 1338, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_from_rank(__pyx_self, __pyx_v_ranks, __pyx_v_num_train_positives, __pyx_v_rank_data, __pyx_v_auc, __pyx_v_num_threads); /* function exit code */ @@ -10054,17 +10252,12 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro Py_ssize_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; + int __pyx_t_7; + int __pyx_t_8; int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; __Pyx_RefNannySetupContext("calculate_auc_from_rank", 0); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1335 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1347 * cdef flt rank * * with nogil: # <<<<<<<<<<<<<< @@ -10079,7 +10272,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro #endif /*try:*/ { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1336 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1348 * * with nogil: * for user_id in range(ranks.rows): # <<<<<<<<<<<<<< @@ -10091,7 +10284,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_user_id = __pyx_t_3; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1338 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1350 * for user_id in range(ranks.rows): * * row_start = ranks.get_row_start(user_id) # <<<<<<<<<<<<<< @@ -10100,7 +10293,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro */ __pyx_v_row_start = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_ranks->__pyx_vtab)->get_row_start(__pyx_v_ranks, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1339 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1351 * * row_start = ranks.get_row_start(user_id) * row_stop = ranks.get_row_end(user_id) # <<<<<<<<<<<<<< @@ -10109,7 +10302,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro */ __pyx_v_row_stop = ((struct __pyx_vtabstruct_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)__pyx_v_ranks->__pyx_vtab)->get_row_end(__pyx_v_ranks, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1341 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1353 * row_stop = ranks.get_row_end(user_id) * * num_positives = row_stop - row_start # <<<<<<<<<<<<<< @@ -10118,7 +10311,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro */ __pyx_v_num_positives = (__pyx_v_row_stop - __pyx_v_row_start); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1342 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1354 * * num_positives = row_stop - row_start * num_negatives = ranks.cols - ((row_stop - row_start) + num_train_positives[user_id]) # <<<<<<<<<<<<<< @@ -10128,7 +10321,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro __pyx_t_4 = __pyx_v_user_id; __pyx_v_num_negatives = (__pyx_v_ranks->cols - ((__pyx_v_row_stop - __pyx_v_row_start) + (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_num_train_positives.data) + __pyx_t_4)) ))))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1346 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1358 * # If there is only one class present, * # return 0.5. * if num_positives == 0 or num_negatives == ranks.cols: # <<<<<<<<<<<<<< @@ -10146,17 +10339,17 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro __pyx_L9_bool_binop_done:; if (__pyx_t_5) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1347 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1359 * # return 0.5. * if num_positives == 0 or num_negatives == ranks.cols: * auc[user_id] = 0.5 # <<<<<<<<<<<<<< * continue * */ - __pyx_t_7 = __pyx_v_user_id; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_auc.data) + __pyx_t_7)) )) = 0.5; + __pyx_t_4 = __pyx_v_user_id; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_auc.data) + __pyx_t_4)) )) = 0.5; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1348 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1360 * if num_positives == 0 or num_negatives == ranks.cols: * auc[user_id] = 0.5 * continue # <<<<<<<<<<<<<< @@ -10165,7 +10358,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro */ goto __pyx_L6_continue; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1346 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1358 * # If there is only one class present, * # return 0.5. * if num_positives == 0 or num_negatives == ranks.cols: # <<<<<<<<<<<<<< @@ -10174,47 +10367,47 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro */ } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1352 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1364 * # Sort the positives according to * # increasing rank. * qsort(&rank_data[row_start], # <<<<<<<<<<<<<< * num_positives, * sizeof(flt), */ - __pyx_t_8 = __pyx_v_row_start; + __pyx_t_4 = __pyx_v_row_start; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1355 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1367 * num_positives, * sizeof(flt), * flt_compare) # <<<<<<<<<<<<<< * * for i in range(num_positives): */ - qsort((&(*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_rank_data.data) + __pyx_t_8)) )))), __pyx_v_num_positives, (sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)), __pyx_f_7lightfm_23_lightfm_fast_no_openmp_flt_compare); + qsort((&(*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_rank_data.data) + __pyx_t_4)) )))), __pyx_v_num_positives, (sizeof(__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt)), __pyx_f_7lightfm_23_lightfm_fast_no_openmp_flt_compare); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1357 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1369 * flt_compare) * * for i in range(num_positives): # <<<<<<<<<<<<<< * * rank = ranks.data[row_start + i] */ - __pyx_t_9 = __pyx_v_num_positives; - __pyx_t_10 = __pyx_t_9; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; + __pyx_t_7 = __pyx_v_num_positives; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1359 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1371 * for i in range(num_positives): * * rank = ranks.data[row_start + i] # <<<<<<<<<<<<<< * * # There are i other positives that */ - __pyx_t_12 = (__pyx_v_row_start + __pyx_v_i); - __pyx_v_rank = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_ranks->data.data) + __pyx_t_12)) ))); + __pyx_t_4 = (__pyx_v_row_start + __pyx_v_i); + __pyx_v_rank = (*((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_ranks->data.data) + __pyx_t_4)) ))); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1365 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1377 * # by i. Ignore ties but ensure that * # the resulting rank is nonnegative. * rank = rank - i # <<<<<<<<<<<<<< @@ -10223,7 +10416,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro */ __pyx_v_rank = (__pyx_v_rank - __pyx_v_i); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1367 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1379 * rank = rank - i * * if rank < 0: # <<<<<<<<<<<<<< @@ -10233,7 +10426,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro __pyx_t_5 = ((__pyx_v_rank < 0.0) != 0); if (__pyx_t_5) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1368 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1380 * * if rank < 0: * rank = 0 # <<<<<<<<<<<<<< @@ -10242,7 +10435,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro */ __pyx_v_rank = 0.0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1367 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1379 * rank = rank - i * * if rank < 0: # <<<<<<<<<<<<<< @@ -10251,18 +10444,18 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro */ } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1373 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1385 * # over the total number of negatives: the probability * # of rank inversion. * auc[user_id] += 1.0 - rank / num_negatives # <<<<<<<<<<<<<< * * if num_positives != 0: */ - __pyx_t_13 = __pyx_v_user_id; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_auc.data) + __pyx_t_13)) )) += (1.0 - (__pyx_v_rank / __pyx_v_num_negatives)); + __pyx_t_4 = __pyx_v_user_id; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_auc.data) + __pyx_t_4)) )) += (1.0 - (__pyx_v_rank / __pyx_v_num_negatives)); } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1375 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1387 * auc[user_id] += 1.0 - rank / num_negatives * * if num_positives != 0: # <<<<<<<<<<<<<< @@ -10272,17 +10465,17 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro __pyx_t_5 = ((__pyx_v_num_positives != 0) != 0); if (__pyx_t_5) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1376 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1388 * * if num_positives != 0: * auc[user_id] /= num_positives # <<<<<<<<<<<<<< * * */ - __pyx_t_14 = __pyx_v_user_id; - *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_auc.data) + __pyx_t_14)) )) /= __pyx_v_num_positives; + __pyx_t_4 = __pyx_v_user_id; + *((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt *) __pyx_v_auc.data) + __pyx_t_4)) )) /= __pyx_v_num_positives; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1375 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1387 * auc[user_id] += 1.0 - rank / num_negatives * * if num_positives != 0: # <<<<<<<<<<<<<< @@ -10294,7 +10487,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro } } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1335 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1347 * cdef flt rank * * with nogil: # <<<<<<<<<<<<<< @@ -10313,7 +10506,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro } } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1326 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1338 * * * def calculate_auc_from_rank(CSRMatrix ranks, # <<<<<<<<<<<<<< @@ -10331,7 +10524,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_12calculate_auc_fro return __pyx_r; } -/* "lightfm/_lightfm_fast_no_openmp.pyx":1380 +/* "lightfm/_lightfm_fast_no_openmp.pyx":1392 * * # Expose test functions * def __test_in_positives(int row, int col, CSRMatrix mat): # <<<<<<<<<<<<<< @@ -10346,6 +10539,9 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_15__test_in_positiv int __pyx_v_row; int __pyx_v_col; struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *__pyx_v_mat = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__test_in_positives (wrapper)", 0); @@ -10374,17 +10570,17 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_15__test_in_positiv case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_col)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__test_in_positives", 1, 3, 3, 1); __PYX_ERR(0, 1380, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__test_in_positives", 1, 3, 3, 1); __PYX_ERR(0, 1392, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mat)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__test_in_positives", 1, 3, 3, 2); __PYX_ERR(0, 1380, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__test_in_positives", 1, 3, 3, 2); __PYX_ERR(0, 1392, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__test_in_positives") < 0)) __PYX_ERR(0, 1380, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__test_in_positives") < 0)) __PYX_ERR(0, 1392, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -10393,19 +10589,19 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_15__test_in_positiv values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_row = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_row == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1380, __pyx_L3_error) - __pyx_v_col = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_col == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1380, __pyx_L3_error) + __pyx_v_row = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_row == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1392, __pyx_L3_error) + __pyx_v_col = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_col == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1392, __pyx_L3_error) __pyx_v_mat = ((struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix *)values[2]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__test_in_positives", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1380, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__test_in_positives", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1392, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_no_openmp.__test_in_positives", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "mat", 0))) __PYX_ERR(0, 1380, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix, 1, "mat", 0))) __PYX_ERR(0, 1392, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_23_lightfm_fast_no_openmp_14__test_in_positives(__pyx_self, __pyx_v_row, __pyx_v_col, __pyx_v_mat); /* function exit code */ @@ -10423,7 +10619,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_14__test_in_positiv int __pyx_t_1; __Pyx_RefNannySetupContext("__test_in_positives", 0); - /* "lightfm/_lightfm_fast_no_openmp.pyx":1382 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1394 * def __test_in_positives(int row, int col, CSRMatrix mat): * * if in_positives(col, row, mat): # <<<<<<<<<<<<<< @@ -10433,7 +10629,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_14__test_in_positiv __pyx_t_1 = (__pyx_f_7lightfm_23_lightfm_fast_no_openmp_in_positives(__pyx_v_col, __pyx_v_row, __pyx_v_mat) != 0); if (__pyx_t_1) { - /* "lightfm/_lightfm_fast_no_openmp.pyx":1383 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1395 * * if in_positives(col, row, mat): * return True # <<<<<<<<<<<<<< @@ -10445,7 +10641,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_14__test_in_positiv __pyx_r = Py_True; goto __pyx_L0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1382 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1394 * def __test_in_positives(int row, int col, CSRMatrix mat): * * if in_positives(col, row, mat): # <<<<<<<<<<<<<< @@ -10454,7 +10650,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_14__test_in_positiv */ } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1385 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1397 * return True * else: * return False # <<<<<<<<<<<<<< @@ -10466,7 +10662,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_14__test_in_positiv goto __pyx_L0; } - /* "lightfm/_lightfm_fast_no_openmp.pyx":1380 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1392 * * # Expose test functions * def __test_in_positives(int row, int col, CSRMatrix mat): # <<<<<<<<<<<<<< @@ -10494,6 +10690,9 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_17__pyx_unpickle_CS PyObject *__pyx_v___pyx_type = 0; long __pyx_v___pyx_checksum; PyObject *__pyx_v___pyx_state = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_unpickle_CSRMatrix (wrapper)", 0); @@ -10571,6 +10770,9 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_16__pyx_unpickle_CS PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_unpickle_CSRMatrix", 0); /* "(tree fragment)":4 @@ -10761,6 +10963,9 @@ static PyObject *__pyx_f_7lightfm_23_lightfm_fast_no_openmp___pyx_unpickle_CSRMa PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_unpickle_CSRMatrix__set_state", 0); /* "(tree fragment)":12 @@ -10916,6 +11121,9 @@ static PyObject *__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_19__pyx_unpickle_Fa PyObject *__pyx_v___pyx_type = 0; long __pyx_v___pyx_checksum; PyObject *__pyx_v___pyx_state = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_unpickle_FastLightFM (wrapper)", 0); @@ -10993,23 +11201,26 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_18__pyx_unpickle_Fa PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_unpickle_FastLightFM", 0); /* "(tree fragment)":4 * cdef object __pyx_PickleError * cdef object __pyx_result - * if __pyx_checksum != 0xddf264a: # <<<<<<<<<<<<<< + * if __pyx_checksum != 0x8f3b44c: # <<<<<<<<<<<<<< * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) + * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) */ - __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xddf264a) != 0); + __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x8f3b44c) != 0); if (__pyx_t_1) { /* "(tree fragment)":5 * cdef object __pyx_result - * if __pyx_checksum != 0xddf264a: + * if __pyx_checksum != 0x8f3b44c: * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) + * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) * __pyx_result = FastLightFM.__new__(__pyx_type) */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) @@ -11028,15 +11239,15 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_18__pyx_unpickle_Fa __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "(tree fragment)":6 - * if __pyx_checksum != 0xddf264a: + * if __pyx_checksum != 0x8f3b44c: * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) # <<<<<<<<<<<<<< + * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) # <<<<<<<<<<<<<< * __pyx_result = FastLightFM.__new__(__pyx_type) * if __pyx_state is not None: */ __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xdd, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x8f, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_v___pyx_PickleError); @@ -11063,15 +11274,15 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_18__pyx_unpickle_Fa /* "(tree fragment)":4 * cdef object __pyx_PickleError * cdef object __pyx_result - * if __pyx_checksum != 0xddf264a: # <<<<<<<<<<<<<< + * if __pyx_checksum != 0x8f3b44c: # <<<<<<<<<<<<<< * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) + * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) */ } /* "(tree fragment)":7 * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) + * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) * __pyx_result = FastLightFM.__new__(__pyx_type) # <<<<<<<<<<<<<< * if __pyx_state is not None: * __pyx_unpickle_FastLightFM__set_state( __pyx_result, __pyx_state) @@ -11097,7 +11308,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_18__pyx_unpickle_Fa __pyx_t_3 = 0; /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) + * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) * __pyx_result = FastLightFM.__new__(__pyx_type) * if __pyx_state is not None: # <<<<<<<<<<<<<< * __pyx_unpickle_FastLightFM__set_state( __pyx_result, __pyx_state) @@ -11120,7 +11331,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_18__pyx_unpickle_Fa __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) + * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) * __pyx_result = FastLightFM.__new__(__pyx_type) * if __pyx_state is not None: # <<<<<<<<<<<<<< * __pyx_unpickle_FastLightFM__set_state( __pyx_result, __pyx_state) @@ -11133,7 +11344,7 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_18__pyx_unpickle_Fa * __pyx_unpickle_FastLightFM__set_state( __pyx_result, __pyx_state) * return __pyx_result # <<<<<<<<<<<<<< * cdef __pyx_unpickle_FastLightFM__set_state(FastLightFM __pyx_result, tuple __pyx_state): - * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.eps = __pyx_state[1]; __pyx_result.item_bias_gradients = __pyx_state[2]; __pyx_result.item_bias_momentum = __pyx_state[3]; __pyx_result.item_biases = __pyx_state[4]; __pyx_result.item_feature_gradients = __pyx_state[5]; __pyx_result.item_feature_momentum = __pyx_state[6]; __pyx_result.item_features = __pyx_state[7]; __pyx_result.item_scale = __pyx_state[8]; __pyx_result.learning_rate = __pyx_state[9]; __pyx_result.max_sampled = __pyx_state[10]; __pyx_result.no_components = __pyx_state[11]; __pyx_result.rho = __pyx_state[12]; __pyx_result.user_bias_gradients = __pyx_state[13]; __pyx_result.user_bias_momentum = __pyx_state[14]; __pyx_result.user_biases = __pyx_state[15]; __pyx_result.user_feature_gradients = __pyx_state[16]; __pyx_result.user_feature_momentum = __pyx_state[17]; __pyx_result.user_features = __pyx_state[18]; __pyx_result.user_scale = __pyx_state[19] + * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.avg_loss = __pyx_state[1]; __pyx_result.avg_loss_ctr = __pyx_state[2]; __pyx_result.eps = __pyx_state[3]; __pyx_result.item_bias_gradients = __pyx_state[4]; __pyx_result.item_bias_momentum = __pyx_state[5]; __pyx_result.item_biases = __pyx_state[6]; __pyx_result.item_feature_gradients = __pyx_state[7]; __pyx_result.item_feature_momentum = __pyx_state[8]; __pyx_result.item_features = __pyx_state[9]; __pyx_result.item_scale = __pyx_state[10]; __pyx_result.learning_rate = __pyx_state[11]; __pyx_result.max_sampled = __pyx_state[12]; __pyx_result.no_components = __pyx_state[13]; __pyx_result.rho = __pyx_state[14]; __pyx_result.user_bias_gradients = __pyx_state[15]; __pyx_result.user_bias_momentum = __pyx_state[16]; __pyx_result.user_biases = __pyx_state[17]; __pyx_result.user_feature_gradients = __pyx_state[18]; __pyx_result.user_feature_momentum = __pyx_state[19]; __pyx_result.user_features = __pyx_state[20]; __pyx_result.user_scale = __pyx_state[21] */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v___pyx_result); @@ -11166,18 +11377,18 @@ static PyObject *__pyx_pf_7lightfm_23_lightfm_fast_no_openmp_18__pyx_unpickle_Fa * __pyx_unpickle_FastLightFM__set_state( __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_FastLightFM__set_state(FastLightFM __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.eps = __pyx_state[1]; __pyx_result.item_bias_gradients = __pyx_state[2]; __pyx_result.item_bias_momentum = __pyx_state[3]; __pyx_result.item_biases = __pyx_state[4]; __pyx_result.item_feature_gradients = __pyx_state[5]; __pyx_result.item_feature_momentum = __pyx_state[6]; __pyx_result.item_features = __pyx_state[7]; __pyx_result.item_scale = __pyx_state[8]; __pyx_result.learning_rate = __pyx_state[9]; __pyx_result.max_sampled = __pyx_state[10]; __pyx_result.no_components = __pyx_state[11]; __pyx_result.rho = __pyx_state[12]; __pyx_result.user_bias_gradients = __pyx_state[13]; __pyx_result.user_bias_momentum = __pyx_state[14]; __pyx_result.user_biases = __pyx_state[15]; __pyx_result.user_feature_gradients = __pyx_state[16]; __pyx_result.user_feature_momentum = __pyx_state[17]; __pyx_result.user_features = __pyx_state[18]; __pyx_result.user_scale = __pyx_state[19] - * if len(__pyx_state) > 20 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.avg_loss = __pyx_state[1]; __pyx_result.avg_loss_ctr = __pyx_state[2]; __pyx_result.eps = __pyx_state[3]; __pyx_result.item_bias_gradients = __pyx_state[4]; __pyx_result.item_bias_momentum = __pyx_state[5]; __pyx_result.item_biases = __pyx_state[6]; __pyx_result.item_feature_gradients = __pyx_state[7]; __pyx_result.item_feature_momentum = __pyx_state[8]; __pyx_result.item_features = __pyx_state[9]; __pyx_result.item_scale = __pyx_state[10]; __pyx_result.learning_rate = __pyx_state[11]; __pyx_result.max_sampled = __pyx_state[12]; __pyx_result.no_components = __pyx_state[13]; __pyx_result.rho = __pyx_state[14]; __pyx_result.user_bias_gradients = __pyx_state[15]; __pyx_result.user_bias_momentum = __pyx_state[16]; __pyx_result.user_biases = __pyx_state[17]; __pyx_result.user_feature_gradients = __pyx_state[18]; __pyx_result.user_feature_momentum = __pyx_state[19]; __pyx_result.user_features = __pyx_state[20]; __pyx_result.user_scale = __pyx_state[21] + * if len(__pyx_state) > 22 and hasattr(__pyx_result, '__dict__'): */ static PyObject *__pyx_f_7lightfm_23_lightfm_fast_no_openmp___pyx_unpickle_FastLightFM__set_state(struct __pyx_obj_7lightfm_23_lightfm_fast_no_openmp_FastLightFM *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_t_2; - __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_t_2; + __pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt __pyx_t_3; __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_t_5; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_t_6; Py_ssize_t __pyx_t_7; int __pyx_t_8; @@ -11185,14 +11396,17 @@ static PyObject *__pyx_f_7lightfm_23_lightfm_fast_no_openmp___pyx_unpickle_FastL PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_unpickle_FastLightFM__set_state", 0); /* "(tree fragment)":12 * return __pyx_result * cdef __pyx_unpickle_FastLightFM__set_state(FastLightFM __pyx_result, tuple __pyx_state): - * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.eps = __pyx_state[1]; __pyx_result.item_bias_gradients = __pyx_state[2]; __pyx_result.item_bias_momentum = __pyx_state[3]; __pyx_result.item_biases = __pyx_state[4]; __pyx_result.item_feature_gradients = __pyx_state[5]; __pyx_result.item_feature_momentum = __pyx_state[6]; __pyx_result.item_features = __pyx_state[7]; __pyx_result.item_scale = __pyx_state[8]; __pyx_result.learning_rate = __pyx_state[9]; __pyx_result.max_sampled = __pyx_state[10]; __pyx_result.no_components = __pyx_state[11]; __pyx_result.rho = __pyx_state[12]; __pyx_result.user_bias_gradients = __pyx_state[13]; __pyx_result.user_bias_momentum = __pyx_state[14]; __pyx_result.user_biases = __pyx_state[15]; __pyx_result.user_feature_gradients = __pyx_state[16]; __pyx_result.user_feature_momentum = __pyx_state[17]; __pyx_result.user_features = __pyx_state[18]; __pyx_result.user_scale = __pyx_state[19] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 20 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[20]) + * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.avg_loss = __pyx_state[1]; __pyx_result.avg_loss_ctr = __pyx_state[2]; __pyx_result.eps = __pyx_state[3]; __pyx_result.item_bias_gradients = __pyx_state[4]; __pyx_result.item_bias_momentum = __pyx_state[5]; __pyx_result.item_biases = __pyx_state[6]; __pyx_result.item_feature_gradients = __pyx_state[7]; __pyx_result.item_feature_momentum = __pyx_state[8]; __pyx_result.item_features = __pyx_state[9]; __pyx_result.item_scale = __pyx_state[10]; __pyx_result.learning_rate = __pyx_state[11]; __pyx_result.max_sampled = __pyx_state[12]; __pyx_result.no_components = __pyx_state[13]; __pyx_result.rho = __pyx_state[14]; __pyx_result.user_bias_gradients = __pyx_state[15]; __pyx_result.user_bias_momentum = __pyx_state[16]; __pyx_result.user_biases = __pyx_state[17]; __pyx_result.user_feature_gradients = __pyx_state[18]; __pyx_result.user_feature_momentum = __pyx_state[19]; __pyx_result.user_features = __pyx_state[20]; __pyx_result.user_scale = __pyx_state[21] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 22 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[22]) */ if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); @@ -11204,165 +11418,177 @@ static PyObject *__pyx_f_7lightfm_23_lightfm_fast_no_openmp___pyx_unpickle_FastL PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_2 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v___pyx_state, 1)); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __pyx_v___pyx_result->eps = __pyx_t_2; + __pyx_t_2 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_v___pyx_state, 1)); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->avg_loss = __pyx_t_2; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyInt_As_int(PyTuple_GET_ITEM(__pyx_v___pyx_state, 2)); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->avg_loss_ctr = __pyx_t_1; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_3 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v___pyx_state, 3)); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->eps = __pyx_t_3; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 2), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 4), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->item_bias_gradients, 0); - __pyx_v___pyx_result->item_bias_gradients = __pyx_t_3; - __pyx_t_3.memview = NULL; - __pyx_t_3.data = NULL; + __pyx_v___pyx_result->item_bias_gradients = __pyx_t_4; + __pyx_t_4.memview = NULL; + __pyx_t_4.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 3), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 5), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->item_bias_momentum, 0); - __pyx_v___pyx_result->item_bias_momentum = __pyx_t_3; - __pyx_t_3.memview = NULL; - __pyx_t_3.data = NULL; + __pyx_v___pyx_result->item_bias_momentum = __pyx_t_4; + __pyx_t_4.memview = NULL; + __pyx_t_4.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 4), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 6), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->item_biases, 0); - __pyx_v___pyx_result->item_biases = __pyx_t_3; - __pyx_t_3.memview = NULL; - __pyx_t_3.data = NULL; + __pyx_v___pyx_result->item_biases = __pyx_t_4; + __pyx_t_4.memview = NULL; + __pyx_t_4.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 5), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 7), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->item_feature_gradients, 0); - __pyx_v___pyx_result->item_feature_gradients = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v___pyx_result->item_feature_gradients = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 6), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 8), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->item_feature_momentum, 0); - __pyx_v___pyx_result->item_feature_momentum = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v___pyx_result->item_feature_momentum = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 7), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 9), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->item_features, 0); - __pyx_v___pyx_result->item_features = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v___pyx_result->item_features = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_5 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_v___pyx_state, 8)); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __pyx_v___pyx_result->item_scale = __pyx_t_5; + __pyx_t_2 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_v___pyx_state, 10)); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->item_scale = __pyx_t_2; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_2 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v___pyx_state, 9)); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __pyx_v___pyx_result->learning_rate = __pyx_t_2; + __pyx_t_3 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v___pyx_state, 11)); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->learning_rate = __pyx_t_3; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyInt_As_int(PyTuple_GET_ITEM(__pyx_v___pyx_state, 10)); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_int(PyTuple_GET_ITEM(__pyx_v___pyx_state, 12)); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) __pyx_v___pyx_result->max_sampled = __pyx_t_1; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyInt_As_int(PyTuple_GET_ITEM(__pyx_v___pyx_state, 11)); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_int(PyTuple_GET_ITEM(__pyx_v___pyx_state, 13)); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) __pyx_v___pyx_result->no_components = __pyx_t_1; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_2 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v___pyx_state, 12)); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __pyx_v___pyx_result->rho = __pyx_t_2; + __pyx_t_3 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v___pyx_state, 14)); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->rho = __pyx_t_3; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 13), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 15), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->user_bias_gradients, 0); - __pyx_v___pyx_result->user_bias_gradients = __pyx_t_3; - __pyx_t_3.memview = NULL; - __pyx_t_3.data = NULL; + __pyx_v___pyx_result->user_bias_gradients = __pyx_t_4; + __pyx_t_4.memview = NULL; + __pyx_t_4.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 14), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 16), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->user_bias_momentum, 0); - __pyx_v___pyx_result->user_bias_momentum = __pyx_t_3; - __pyx_t_3.memview = NULL; - __pyx_t_3.data = NULL; + __pyx_v___pyx_result->user_bias_momentum = __pyx_t_4; + __pyx_t_4.memview = NULL; + __pyx_t_4.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 15), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 17), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->user_biases, 0); - __pyx_v___pyx_result->user_biases = __pyx_t_3; - __pyx_t_3.memview = NULL; - __pyx_t_3.data = NULL; + __pyx_v___pyx_result->user_biases = __pyx_t_4; + __pyx_t_4.memview = NULL; + __pyx_t_4.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 16), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 18), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->user_feature_gradients, 0); - __pyx_v___pyx_result->user_feature_gradients = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v___pyx_result->user_feature_gradients = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 17), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 19), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->user_feature_momentum, 0); - __pyx_v___pyx_result->user_feature_momentum = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v___pyx_result->user_feature_momentum = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 18), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_23_lightfm_fast_no_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 20), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->user_features, 0); - __pyx_v___pyx_result->user_features = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v___pyx_result->user_features = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_5 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_v___pyx_state, 19)); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __pyx_v___pyx_result->user_scale = __pyx_t_5; + __pyx_t_2 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_v___pyx_state, 21)); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->user_scale = __pyx_t_2; /* "(tree fragment)":13 * cdef __pyx_unpickle_FastLightFM__set_state(FastLightFM __pyx_result, tuple __pyx_state): - * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.eps = __pyx_state[1]; __pyx_result.item_bias_gradients = __pyx_state[2]; __pyx_result.item_bias_momentum = __pyx_state[3]; __pyx_result.item_biases = __pyx_state[4]; __pyx_result.item_feature_gradients = __pyx_state[5]; __pyx_result.item_feature_momentum = __pyx_state[6]; __pyx_result.item_features = __pyx_state[7]; __pyx_result.item_scale = __pyx_state[8]; __pyx_result.learning_rate = __pyx_state[9]; __pyx_result.max_sampled = __pyx_state[10]; __pyx_result.no_components = __pyx_state[11]; __pyx_result.rho = __pyx_state[12]; __pyx_result.user_bias_gradients = __pyx_state[13]; __pyx_result.user_bias_momentum = __pyx_state[14]; __pyx_result.user_biases = __pyx_state[15]; __pyx_result.user_feature_gradients = __pyx_state[16]; __pyx_result.user_feature_momentum = __pyx_state[17]; __pyx_result.user_features = __pyx_state[18]; __pyx_result.user_scale = __pyx_state[19] - * if len(__pyx_state) > 20 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[20]) + * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.avg_loss = __pyx_state[1]; __pyx_result.avg_loss_ctr = __pyx_state[2]; __pyx_result.eps = __pyx_state[3]; __pyx_result.item_bias_gradients = __pyx_state[4]; __pyx_result.item_bias_momentum = __pyx_state[5]; __pyx_result.item_biases = __pyx_state[6]; __pyx_result.item_feature_gradients = __pyx_state[7]; __pyx_result.item_feature_momentum = __pyx_state[8]; __pyx_result.item_features = __pyx_state[9]; __pyx_result.item_scale = __pyx_state[10]; __pyx_result.learning_rate = __pyx_state[11]; __pyx_result.max_sampled = __pyx_state[12]; __pyx_result.no_components = __pyx_state[13]; __pyx_result.rho = __pyx_state[14]; __pyx_result.user_bias_gradients = __pyx_state[15]; __pyx_result.user_bias_momentum = __pyx_state[16]; __pyx_result.user_biases = __pyx_state[17]; __pyx_result.user_feature_gradients = __pyx_state[18]; __pyx_result.user_feature_momentum = __pyx_state[19]; __pyx_result.user_features = __pyx_state[20]; __pyx_result.user_scale = __pyx_state[21] + * if len(__pyx_state) > 22 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[22]) */ if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(1, 13, __pyx_L1_error) } __pyx_t_7 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_8 = ((__pyx_t_7 > 20) != 0); + __pyx_t_8 = ((__pyx_t_7 > 22) != 0); if (__pyx_t_8) { } else { __pyx_t_6 = __pyx_t_8; @@ -11375,9 +11601,9 @@ static PyObject *__pyx_f_7lightfm_23_lightfm_fast_no_openmp___pyx_unpickle_FastL if (__pyx_t_6) { /* "(tree fragment)":14 - * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.eps = __pyx_state[1]; __pyx_result.item_bias_gradients = __pyx_state[2]; __pyx_result.item_bias_momentum = __pyx_state[3]; __pyx_result.item_biases = __pyx_state[4]; __pyx_result.item_feature_gradients = __pyx_state[5]; __pyx_result.item_feature_momentum = __pyx_state[6]; __pyx_result.item_features = __pyx_state[7]; __pyx_result.item_scale = __pyx_state[8]; __pyx_result.learning_rate = __pyx_state[9]; __pyx_result.max_sampled = __pyx_state[10]; __pyx_result.no_components = __pyx_state[11]; __pyx_result.rho = __pyx_state[12]; __pyx_result.user_bias_gradients = __pyx_state[13]; __pyx_result.user_bias_momentum = __pyx_state[14]; __pyx_result.user_biases = __pyx_state[15]; __pyx_result.user_feature_gradients = __pyx_state[16]; __pyx_result.user_feature_momentum = __pyx_state[17]; __pyx_result.user_features = __pyx_state[18]; __pyx_result.user_scale = __pyx_state[19] - * if len(__pyx_state) > 20 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[20]) # <<<<<<<<<<<<<< + * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.avg_loss = __pyx_state[1]; __pyx_result.avg_loss_ctr = __pyx_state[2]; __pyx_result.eps = __pyx_state[3]; __pyx_result.item_bias_gradients = __pyx_state[4]; __pyx_result.item_bias_momentum = __pyx_state[5]; __pyx_result.item_biases = __pyx_state[6]; __pyx_result.item_feature_gradients = __pyx_state[7]; __pyx_result.item_feature_momentum = __pyx_state[8]; __pyx_result.item_features = __pyx_state[9]; __pyx_result.item_scale = __pyx_state[10]; __pyx_result.learning_rate = __pyx_state[11]; __pyx_result.max_sampled = __pyx_state[12]; __pyx_result.no_components = __pyx_state[13]; __pyx_result.rho = __pyx_state[14]; __pyx_result.user_bias_gradients = __pyx_state[15]; __pyx_result.user_bias_momentum = __pyx_state[16]; __pyx_result.user_biases = __pyx_state[17]; __pyx_result.user_feature_gradients = __pyx_state[18]; __pyx_result.user_feature_momentum = __pyx_state[19]; __pyx_result.user_features = __pyx_state[20]; __pyx_result.user_scale = __pyx_state[21] + * if len(__pyx_state) > 22 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[22]) # <<<<<<<<<<<<<< */ __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); @@ -11398,7 +11624,7 @@ static PyObject *__pyx_f_7lightfm_23_lightfm_fast_no_openmp___pyx_unpickle_FastL __Pyx_DECREF_SET(__pyx_t_12, function); } } - __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_11, PyTuple_GET_ITEM(__pyx_v___pyx_state, 20)) : __Pyx_PyObject_CallOneArg(__pyx_t_12, PyTuple_GET_ITEM(__pyx_v___pyx_state, 20)); + __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_11, PyTuple_GET_ITEM(__pyx_v___pyx_state, 22)) : __Pyx_PyObject_CallOneArg(__pyx_t_12, PyTuple_GET_ITEM(__pyx_v___pyx_state, 22)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); @@ -11407,9 +11633,9 @@ static PyObject *__pyx_f_7lightfm_23_lightfm_fast_no_openmp___pyx_unpickle_FastL /* "(tree fragment)":13 * cdef __pyx_unpickle_FastLightFM__set_state(FastLightFM __pyx_result, tuple __pyx_state): - * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.eps = __pyx_state[1]; __pyx_result.item_bias_gradients = __pyx_state[2]; __pyx_result.item_bias_momentum = __pyx_state[3]; __pyx_result.item_biases = __pyx_state[4]; __pyx_result.item_feature_gradients = __pyx_state[5]; __pyx_result.item_feature_momentum = __pyx_state[6]; __pyx_result.item_features = __pyx_state[7]; __pyx_result.item_scale = __pyx_state[8]; __pyx_result.learning_rate = __pyx_state[9]; __pyx_result.max_sampled = __pyx_state[10]; __pyx_result.no_components = __pyx_state[11]; __pyx_result.rho = __pyx_state[12]; __pyx_result.user_bias_gradients = __pyx_state[13]; __pyx_result.user_bias_momentum = __pyx_state[14]; __pyx_result.user_biases = __pyx_state[15]; __pyx_result.user_feature_gradients = __pyx_state[16]; __pyx_result.user_feature_momentum = __pyx_state[17]; __pyx_result.user_features = __pyx_state[18]; __pyx_result.user_scale = __pyx_state[19] - * if len(__pyx_state) > 20 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[20]) + * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.avg_loss = __pyx_state[1]; __pyx_result.avg_loss_ctr = __pyx_state[2]; __pyx_result.eps = __pyx_state[3]; __pyx_result.item_bias_gradients = __pyx_state[4]; __pyx_result.item_bias_momentum = __pyx_state[5]; __pyx_result.item_biases = __pyx_state[6]; __pyx_result.item_feature_gradients = __pyx_state[7]; __pyx_result.item_feature_momentum = __pyx_state[8]; __pyx_result.item_features = __pyx_state[9]; __pyx_result.item_scale = __pyx_state[10]; __pyx_result.learning_rate = __pyx_state[11]; __pyx_result.max_sampled = __pyx_state[12]; __pyx_result.no_components = __pyx_state[13]; __pyx_result.rho = __pyx_state[14]; __pyx_result.user_bias_gradients = __pyx_state[15]; __pyx_result.user_bias_momentum = __pyx_state[16]; __pyx_result.user_biases = __pyx_state[17]; __pyx_result.user_feature_gradients = __pyx_state[18]; __pyx_result.user_feature_momentum = __pyx_state[19]; __pyx_result.user_features = __pyx_state[20]; __pyx_result.user_scale = __pyx_state[21] + * if len(__pyx_state) > 22 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[22]) */ } @@ -11417,16 +11643,16 @@ static PyObject *__pyx_f_7lightfm_23_lightfm_fast_no_openmp___pyx_unpickle_FastL * __pyx_unpickle_FastLightFM__set_state( __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_FastLightFM__set_state(FastLightFM __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.eps = __pyx_state[1]; __pyx_result.item_bias_gradients = __pyx_state[2]; __pyx_result.item_bias_momentum = __pyx_state[3]; __pyx_result.item_biases = __pyx_state[4]; __pyx_result.item_feature_gradients = __pyx_state[5]; __pyx_result.item_feature_momentum = __pyx_state[6]; __pyx_result.item_features = __pyx_state[7]; __pyx_result.item_scale = __pyx_state[8]; __pyx_result.learning_rate = __pyx_state[9]; __pyx_result.max_sampled = __pyx_state[10]; __pyx_result.no_components = __pyx_state[11]; __pyx_result.rho = __pyx_state[12]; __pyx_result.user_bias_gradients = __pyx_state[13]; __pyx_result.user_bias_momentum = __pyx_state[14]; __pyx_result.user_biases = __pyx_state[15]; __pyx_result.user_feature_gradients = __pyx_state[16]; __pyx_result.user_feature_momentum = __pyx_state[17]; __pyx_result.user_features = __pyx_state[18]; __pyx_result.user_scale = __pyx_state[19] - * if len(__pyx_state) > 20 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.avg_loss = __pyx_state[1]; __pyx_result.avg_loss_ctr = __pyx_state[2]; __pyx_result.eps = __pyx_state[3]; __pyx_result.item_bias_gradients = __pyx_state[4]; __pyx_result.item_bias_momentum = __pyx_state[5]; __pyx_result.item_biases = __pyx_state[6]; __pyx_result.item_feature_gradients = __pyx_state[7]; __pyx_result.item_feature_momentum = __pyx_state[8]; __pyx_result.item_features = __pyx_state[9]; __pyx_result.item_scale = __pyx_state[10]; __pyx_result.learning_rate = __pyx_state[11]; __pyx_result.max_sampled = __pyx_state[12]; __pyx_result.no_components = __pyx_state[13]; __pyx_result.rho = __pyx_state[14]; __pyx_result.user_bias_gradients = __pyx_state[15]; __pyx_result.user_bias_momentum = __pyx_state[16]; __pyx_result.user_biases = __pyx_state[17]; __pyx_result.user_feature_gradients = __pyx_state[18]; __pyx_result.user_feature_momentum = __pyx_state[19]; __pyx_result.user_features = __pyx_state[20]; __pyx_result.user_scale = __pyx_state[21] + * if len(__pyx_state) > 22 and hasattr(__pyx_result, '__dict__'): */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1); + __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); @@ -11454,6 +11680,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P PyObject *__pyx_v_format = 0; PyObject *__pyx_v_mode = 0; int __pyx_v_allocate_buffer; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); @@ -11592,6 +11821,9 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ Py_ssize_t __pyx_t_9; PyObject *__pyx_t_10 = NULL; Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); __Pyx_INCREF(__pyx_v_format); @@ -12215,6 +12447,9 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru Py_ssize_t __pyx_t_5; int __pyx_t_6; Py_ssize_t *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; if (__pyx_v_info == NULL) { PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); return -1; @@ -12643,6 +12878,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _ PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":223 @@ -12693,6 +12931,9 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_memview", 0); /* "View.MemoryView":227 @@ -12831,6 +13072,9 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__( __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getattr__", 0); /* "View.MemoryView":234 @@ -12896,6 +13140,9 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__ __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); /* "View.MemoryView":237 @@ -12960,6 +13207,9 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struc int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); /* "View.MemoryView":240 @@ -13017,6 +13267,9 @@ static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __p PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 @@ -13071,6 +13324,9 @@ static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 @@ -13118,6 +13374,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("array_cwrapper", 0); /* "View.MemoryView":248 @@ -13285,6 +13544,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_name = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); @@ -13446,6 +13708,9 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":5 @@ -13671,6 +13936,9 @@ static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_Me PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":17 @@ -13800,6 +14068,9 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar PyObject *__pyx_v_obj = 0; int __pyx_v_flags; int __pyx_v_dtype_is_object; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); @@ -13880,6 +14151,9 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); /* "View.MemoryView":346 @@ -14411,6 +14685,9 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py PyObject *__pyx_t_5 = NULL; Py_ssize_t __pyx_t_6; char *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_item_pointer", 0); /* "View.MemoryView":395 @@ -14558,6 +14835,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; char *__pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); /* "View.MemoryView":404 @@ -14741,6 +15021,9 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); __Pyx_INCREF(__pyx_v_index); @@ -14956,6 +15239,9 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_slice", 0); __Pyx_INCREF(__pyx_v_obj); @@ -15162,6 +15448,9 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); /* "View.MemoryView":445 @@ -15258,6 +15547,9 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); /* "View.MemoryView":451 @@ -15531,6 +15823,9 @@ static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *_ __Pyx_RefNannyDeclarations char *__pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("setitem_indexed", 0); /* "View.MemoryView":482 @@ -15600,6 +15895,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview PyObject *__pyx_t_9 = NULL; size_t __pyx_t_10; int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convert_item_to_object", 0); /* "View.MemoryView":488 @@ -15878,6 +16176,9 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie char *__pyx_t_12; char *__pyx_t_13; char *__pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("assign_item_from_object", 0); /* "View.MemoryView":504 @@ -16117,6 +16418,9 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu void *__pyx_t_6; int __pyx_t_7; Py_ssize_t __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; if (__pyx_v_info == NULL) { PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); return -1; @@ -16453,6 +16757,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct _ __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":554 @@ -16592,6 +16899,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(stru Py_ssize_t *__pyx_t_3; Py_ssize_t *__pyx_t_4; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":564 @@ -16671,6 +16981,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st Py_ssize_t *__pyx_t_4; Py_ssize_t *__pyx_t_5; PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":568 @@ -16782,6 +17095,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ Py_ssize_t *__pyx_t_4; Py_ssize_t *__pyx_t_5; Py_ssize_t *__pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":576 @@ -16891,6 +17207,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struc PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":583 @@ -16951,6 +17270,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(s PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":587 @@ -17013,6 +17335,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(str PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":591 @@ -17088,6 +17413,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc Py_ssize_t *__pyx_t_4; Py_ssize_t *__pyx_t_5; PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":595 @@ -17301,6 +17629,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12 PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); /* "View.MemoryView":612 @@ -17399,6 +17730,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14 __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); /* "View.MemoryView":616 @@ -17477,6 +17811,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16 __Pyx_RefNannyDeclarations __Pyx_memviewslice *__pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_c_contig", 0); /* "View.MemoryView":622 @@ -17550,6 +17887,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18 __Pyx_RefNannyDeclarations __Pyx_memviewslice *__pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_f_contig", 0); /* "View.MemoryView":628 @@ -17623,6 +17963,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20 __Pyx_RefNannyDeclarations __Pyx_memviewslice __pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("copy", 0); /* "View.MemoryView":633 @@ -17715,6 +18058,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 __Pyx_RefNannyDeclarations __Pyx_memviewslice __pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("copy_fortran", 0); /* "View.MemoryView":645 @@ -17801,6 +18147,9 @@ static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struc PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 @@ -17855,6 +18204,9 @@ static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED st PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 @@ -17900,6 +18252,9 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); /* "View.MemoryView":658 @@ -18041,6 +18396,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { int __pyx_t_9; int __pyx_t_10; PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_unellipsify", 0); /* "View.MemoryView":671 @@ -18483,6 +18841,9 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ Py_ssize_t *__pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); /* "View.MemoryView":701 @@ -18590,6 +18951,9 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ Py_ssize_t __pyx_t_10; int __pyx_t_11; Py_ssize_t __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memview_slice", 0); /* "View.MemoryView":711 @@ -19143,6 +19507,9 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; /* "View.MemoryView":827 * cdef bint negative_step @@ -19929,6 +20296,9 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("pybuffer_index", 0); /* "View.MemoryView":912 @@ -20239,6 +20609,9 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; /* "View.MemoryView":944 * @cname('__pyx_memslice_transpose') @@ -20443,6 +20816,9 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convert_item_to_object", 0); /* "View.MemoryView":980 @@ -20527,6 +20903,9 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("assign_item_from_object", 0); /* "View.MemoryView":986 @@ -20669,6 +21048,9 @@ static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 @@ -20723,6 +21105,9 @@ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUS PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 @@ -20776,6 +21161,9 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl Py_ssize_t *__pyx_t_7; Py_ssize_t *__pyx_t_8; Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_fromslice", 0); /* "View.MemoryView":1007 @@ -21151,6 +21539,9 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_slice_from_memview", 0); /* "View.MemoryView":1055 @@ -21375,6 +21766,9 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_copy", 0); /* "View.MemoryView":1083 @@ -21437,6 +21831,9 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview PyObject *(*__pyx_t_3)(char *); int (*__pyx_t_4)(char *, PyObject *); PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); /* "View.MemoryView":1094 @@ -22279,6 +22676,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, struct __pyx_memoryview_obj *__pyx_t_4; int __pyx_t_5; int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; /* "View.MemoryView":1219 * cdef void *result @@ -22526,6 +22926,9 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif @@ -22611,6 +23014,9 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif @@ -22693,6 +23099,9 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif @@ -22810,6 +23219,9 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ int __pyx_t_6; void *__pyx_t_7; int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; /* "View.MemoryView":1276 * Check for overlapping memory and verify the shapes. @@ -23886,6 +24298,9 @@ static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *_ PyObject *__pyx_v___pyx_type = 0; long __pyx_v___pyx_checksum; PyObject *__pyx_v___pyx_state = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); @@ -23963,6 +24378,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); /* "(tree fragment)":4 @@ -24151,6 +24569,9 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); /* "(tree fragment)":12 @@ -24368,6 +24789,9 @@ static PyTypeObject __pyx_type_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyObject *__pyx_tp_new_7lightfm_23_lightfm_fast_no_openmp_FastLightFM(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { @@ -24429,12 +24853,21 @@ static void __pyx_tp_dealloc_7lightfm_23_lightfm_fast_no_openmp_FastLightFM(PyOb (*Py_TYPE(o)->tp_free)(o); } +static PyObject *__pyx_getprop_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_avg_loss(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_8avg_loss_1__get__(o); +} + static PyMethodDef __pyx_methods_7lightfm_23_lightfm_fast_no_openmp_FastLightFM[] = { {"__reduce_cython__", (PyCFunction)__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_3__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_5__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; +static struct PyGetSetDef __pyx_getsets_7lightfm_23_lightfm_fast_no_openmp_FastLightFM[] = { + {(char *)"avg_loss", __pyx_getprop_7lightfm_23_lightfm_fast_no_openmp_11FastLightFM_avg_loss, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; + static PyTypeObject __pyx_type_7lightfm_23_lightfm_fast_no_openmp_FastLightFM = { PyVarObject_HEAD_INIT(0, 0) "lightfm._lightfm_fast_no_openmp.FastLightFM", /*tp_name*/ @@ -24475,7 +24908,7 @@ static PyTypeObject __pyx_type_7lightfm_23_lightfm_fast_no_openmp_FastLightFM = 0, /*tp_iternext*/ __pyx_methods_7lightfm_23_lightfm_fast_no_openmp_FastLightFM, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_7lightfm_23_lightfm_fast_no_openmp_FastLightFM, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -24502,6 +24935,9 @@ static PyTypeObject __pyx_type_7lightfm_23_lightfm_fast_no_openmp_FastLightFM = #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static struct __pyx_vtabstruct_array __pyx_vtable_array; @@ -24535,9 +24971,9 @@ static void __pyx_tp_dealloc_array(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); - Py_SET_REFCNT(o, 1 + Py_REFCNT(o)); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); __pyx_array___dealloc__(o); - Py_SET_REFCNT(o, Py_REFCNT(o) - 1); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->mode); @@ -24691,6 +25127,9 @@ static PyTypeObject __pyx_type___pyx_array = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { @@ -24810,6 +25249,9 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; @@ -24846,9 +25288,9 @@ static void __pyx_tp_dealloc_memoryview(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); - Py_SET_REFCNT(o, 1 + Py_REFCNT(o)); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); __pyx_memoryview___dealloc__(o); - Py_SET_REFCNT(o, Py_REFCNT(o) - 1); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->obj); @@ -25071,6 +25513,9 @@ static PyTypeObject __pyx_type___pyx_memoryview = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; @@ -25096,9 +25541,9 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); - Py_SET_REFCNT(o, 1 + Py_REFCNT(o)); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); __pyx_memoryviewslice___dealloc__(o); - Py_SET_REFCNT(o, Py_REFCNT(o) - 1); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->from_object); @@ -25217,6 +25662,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyMethodDef __pyx_methods[] = { @@ -25276,8 +25724,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, {&__pyx_n_s_FastLightFM, __pyx_k_FastLightFM, sizeof(__pyx_k_FastLightFM), 0, 0, 1, 1}, {&__pyx_kp_s_Incompatible_checksums_s_vs_0x5b, __pyx_k_Incompatible_checksums_s_vs_0x5b, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x5b), 0, 0, 1, 0}, + {&__pyx_kp_s_Incompatible_checksums_s_vs_0x8f, __pyx_k_Incompatible_checksums_s_vs_0x8f, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x8f), 0, 0, 1, 0}, {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0}, - {&__pyx_kp_s_Incompatible_checksums_s_vs_0xdd, __pyx_k_Incompatible_checksums_s_vs_0xdd, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xdd), 0, 0, 1, 0}, {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0}, @@ -25458,7 +25906,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 305, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 311, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 133, __pyx_L1_error) __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error) __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 151, __pyx_L1_error) @@ -25667,101 +26115,101 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); - /* "lightfm/_lightfm_fast_no_openmp.pyx":694 + /* "lightfm/_lightfm_fast_no_openmp.pyx":706 * * * def fit_logistic(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * int[::1] user_ids, */ - __pyx_tuple__19 = PyTuple_Pack(24, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_Y, __pyx_n_s_sample_weight, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_item_id, __pyx_n_s_row, __pyx_n_s_prediction, __pyx_n_s_loss, __pyx_n_s_y, __pyx_n_s_y_row, __pyx_n_s_weight, __pyx_n_s_user_repr, __pyx_n_s_it_repr); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 694, __pyx_L1_error) + __pyx_tuple__19 = PyTuple_Pack(24, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_Y, __pyx_n_s_sample_weight, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_item_id, __pyx_n_s_row, __pyx_n_s_prediction, __pyx_n_s_loss, __pyx_n_s_y, __pyx_n_s_y_row, __pyx_n_s_weight, __pyx_n_s_user_repr, __pyx_n_s_it_repr); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 706, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(12, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_fit_logistic, 694, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 694, __pyx_L1_error) + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(12, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_fit_logistic, 706, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 706, __pyx_L1_error) - /* "lightfm/_lightfm_fast_no_openmp.pyx":784 + /* "lightfm/_lightfm_fast_no_openmp.pyx":796 * * * def fit_warp(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix interactions, */ - __pyx_tuple__21 = PyTuple_Pack(31, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_interactions, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_Y, __pyx_n_s_sample_weight, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_num_threads, __pyx_n_s_random_state, __pyx_n_s_i, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_positive_item_id, __pyx_n_s_gamma, __pyx_n_s_negative_item_id, __pyx_n_s_sampled, __pyx_n_s_row, __pyx_n_s_positive_prediction, __pyx_n_s_negative_prediction, __pyx_n_s_loss, __pyx_n_s_MAX_LOSS, __pyx_n_s_weight, __pyx_n_s_user_repr, __pyx_n_s_pos_it_repr, __pyx_n_s_neg_it_repr, __pyx_n_s_random_states); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 784, __pyx_L1_error) + __pyx_tuple__21 = PyTuple_Pack(31, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_interactions, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_Y, __pyx_n_s_sample_weight, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_num_threads, __pyx_n_s_random_state, __pyx_n_s_i, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_positive_item_id, __pyx_n_s_gamma, __pyx_n_s_negative_item_id, __pyx_n_s_sampled, __pyx_n_s_row, __pyx_n_s_positive_prediction, __pyx_n_s_negative_prediction, __pyx_n_s_loss, __pyx_n_s_MAX_LOSS, __pyx_n_s_weight, __pyx_n_s_user_repr, __pyx_n_s_pos_it_repr, __pyx_n_s_neg_it_repr, __pyx_n_s_random_states); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 796, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(14, 0, 31, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_fit_warp, 784, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 784, __pyx_L1_error) + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(14, 0, 31, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_fit_warp, 796, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 796, __pyx_L1_error) - /* "lightfm/_lightfm_fast_no_openmp.pyx":915 + /* "lightfm/_lightfm_fast_no_openmp.pyx":927 * * * def fit_warp_kos(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix data, */ - __pyx_tuple__23 = PyTuple_Pack(37, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_data, __pyx_n_s_user_ids, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_k, __pyx_n_s_n, __pyx_n_s_num_threads, __pyx_n_s_random_state, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_positive_item_id, __pyx_n_s_gamma, __pyx_n_s_negative_item_id, __pyx_n_s_sampled, __pyx_n_s_row, __pyx_n_s_sampled_positive_item_id, __pyx_n_s_user_pids_start, __pyx_n_s_user_pids_stop, __pyx_n_s_no_positives, __pyx_n_s_POS_SAMPLES, __pyx_n_s_positive_prediction, __pyx_n_s_negative_prediction, __pyx_n_s_loss, __pyx_n_s_MAX_LOSS, __pyx_n_s_sampled_positive_prediction, __pyx_n_s_user_repr, __pyx_n_s_pos_it_repr, __pyx_n_s_neg_it_repr, __pyx_n_s_pos_pairs, __pyx_n_s_random_states); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 915, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(37, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_data, __pyx_n_s_user_ids, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_k, __pyx_n_s_n, __pyx_n_s_num_threads, __pyx_n_s_random_state, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_positive_item_id, __pyx_n_s_gamma, __pyx_n_s_negative_item_id, __pyx_n_s_sampled, __pyx_n_s_row, __pyx_n_s_sampled_positive_item_id, __pyx_n_s_user_pids_start, __pyx_n_s_user_pids_stop, __pyx_n_s_no_positives, __pyx_n_s_POS_SAMPLES, __pyx_n_s_positive_prediction, __pyx_n_s_negative_prediction, __pyx_n_s_loss, __pyx_n_s_MAX_LOSS, __pyx_n_s_sampled_positive_prediction, __pyx_n_s_user_repr, __pyx_n_s_pos_it_repr, __pyx_n_s_neg_it_repr, __pyx_n_s_pos_pairs, __pyx_n_s_random_states); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 927, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(13, 0, 37, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_fit_warp_kos, 915, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 915, __pyx_L1_error) + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(13, 0, 37, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_fit_warp_kos, 927, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 927, __pyx_L1_error) - /* "lightfm/_lightfm_fast_no_openmp.pyx":1074 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1086 * * * def fit_bpr(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix interactions, */ - __pyx_tuple__25 = PyTuple_Pack(29, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_interactions, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_Y, __pyx_n_s_sample_weight, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_num_threads, __pyx_n_s_random_state, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_positive_item_id, __pyx_n_s_negative_item_id, __pyx_n_s_sampled, __pyx_n_s_row, __pyx_n_s_positive_prediction, __pyx_n_s_negative_prediction, __pyx_n_s_weight, __pyx_n_s_random_states, __pyx_n_s_user_repr, __pyx_n_s_pos_it_repr, __pyx_n_s_neg_it_repr); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 1074, __pyx_L1_error) + __pyx_tuple__25 = PyTuple_Pack(29, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_interactions, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_Y, __pyx_n_s_sample_weight, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_num_threads, __pyx_n_s_random_state, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_positive_item_id, __pyx_n_s_negative_item_id, __pyx_n_s_sampled, __pyx_n_s_row, __pyx_n_s_positive_prediction, __pyx_n_s_negative_prediction, __pyx_n_s_weight, __pyx_n_s_random_states, __pyx_n_s_user_repr, __pyx_n_s_pos_it_repr, __pyx_n_s_neg_it_repr); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 1086, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(14, 0, 29, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_fit_bpr, 1074, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 1074, __pyx_L1_error) + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(14, 0, 29, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_fit_bpr, 1086, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 1086, __pyx_L1_error) - /* "lightfm/_lightfm_fast_no_openmp.pyx":1185 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1197 * * * def predict_lightfm(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * int[::1] user_ids, */ - __pyx_tuple__27 = PyTuple_Pack(11, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_predictions, __pyx_n_s_lightfm, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_no_examples, __pyx_n_s_user_repr, __pyx_n_s_it_repr); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 1185, __pyx_L1_error) + __pyx_tuple__27 = PyTuple_Pack(11, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_predictions, __pyx_n_s_lightfm, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_no_examples, __pyx_n_s_user_repr, __pyx_n_s_it_repr); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 1197, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_predict_lightfm, 1185, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 1185, __pyx_L1_error) + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_predict_lightfm, 1197, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 1197, __pyx_L1_error) - /* "lightfm/_lightfm_fast_no_openmp.pyx":1232 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1244 * * * def predict_ranks(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix test_interactions, */ - __pyx_tuple__29 = PyTuple_Pack(20, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_test_interactions, __pyx_n_s_train_interactions, __pyx_n_s_ranks, __pyx_n_s_lightfm, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_user_id, __pyx_n_s_item_id, __pyx_n_s_predictions_size, __pyx_n_s_row_start, __pyx_n_s_row_stop, __pyx_n_s_user_repr, __pyx_n_s_it_repr, __pyx_n_s_predictions, __pyx_n_s_prediction, __pyx_n_s_rank, __pyx_n_s_item_ids); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 1232, __pyx_L1_error) + __pyx_tuple__29 = PyTuple_Pack(20, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_test_interactions, __pyx_n_s_train_interactions, __pyx_n_s_ranks, __pyx_n_s_lightfm, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_user_id, __pyx_n_s_item_id, __pyx_n_s_predictions_size, __pyx_n_s_row_start, __pyx_n_s_row_stop, __pyx_n_s_user_repr, __pyx_n_s_it_repr, __pyx_n_s_predictions, __pyx_n_s_prediction, __pyx_n_s_rank, __pyx_n_s_item_ids); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 1244, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(7, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_predict_ranks, 1232, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 1232, __pyx_L1_error) + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(7, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_predict_ranks, 1244, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 1244, __pyx_L1_error) - /* "lightfm/_lightfm_fast_no_openmp.pyx":1326 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1338 * * * def calculate_auc_from_rank(CSRMatrix ranks, # <<<<<<<<<<<<<< * int[::1] num_train_positives, * flt[::1] rank_data, */ - __pyx_tuple__31 = PyTuple_Pack(13, __pyx_n_s_ranks, __pyx_n_s_num_train_positives, __pyx_n_s_rank_data, __pyx_n_s_auc, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_user_id, __pyx_n_s_row_start, __pyx_n_s_row_stop, __pyx_n_s_num_negatives, __pyx_n_s_num_positives, __pyx_n_s_rank); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 1326, __pyx_L1_error) + __pyx_tuple__31 = PyTuple_Pack(13, __pyx_n_s_ranks, __pyx_n_s_num_train_positives, __pyx_n_s_rank_data, __pyx_n_s_auc, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_user_id, __pyx_n_s_row_start, __pyx_n_s_row_stop, __pyx_n_s_num_negatives, __pyx_n_s_num_positives, __pyx_n_s_rank); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 1338, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_calculate_auc_from_rank, 1326, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 1326, __pyx_L1_error) + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_calculate_auc_from_rank, 1338, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 1338, __pyx_L1_error) - /* "lightfm/_lightfm_fast_no_openmp.pyx":1380 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1392 * * # Expose test functions * def __test_in_positives(int row, int col, CSRMatrix mat): # <<<<<<<<<<<<<< * * if in_positives(col, row, mat): */ - __pyx_tuple__33 = PyTuple_Pack(3, __pyx_n_s_row, __pyx_n_s_col, __pyx_n_s_mat); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 1380, __pyx_L1_error) + __pyx_tuple__33 = PyTuple_Pack(3, __pyx_n_s_row, __pyx_n_s_col, __pyx_n_s_mat); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 1392, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_test_in_positives, 1380, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 1380, __pyx_L1_error) + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_no_openmp, __pyx_n_s_test_in_positives, 1392, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 1392, __pyx_L1_error) /* "(tree fragment)":1 * def __pyx_unpickle_CSRMatrix(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< @@ -25853,8 +26301,8 @@ static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_95829634 = PyInt_FromLong(95829634L); if (unlikely(!__pyx_int_95829634)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_150189132 = PyInt_FromLong(150189132L); if (unlikely(!__pyx_int_150189132)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_232728138 = PyInt_FromLong(232728138L); if (unlikely(!__pyx_int_232728138)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; @@ -25900,6 +26348,9 @@ static int __Pyx_modinit_function_export_code(void) { static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ __pyx_vtabptr_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix = &__pyx_vtable_7lightfm_23_lightfm_fast_no_openmp_CSRMatrix; @@ -26009,17 +26460,19 @@ static int __Pyx_modinit_function_import_code(void) { } -#if PY_MAJOR_VERSION < 3 -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC void -#else +#ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void #endif #else -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyObject * +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * #else -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#define __Pyx_PyMODINIT_FUNC PyObject * #endif #endif @@ -26102,6 +26555,9 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec__lightfm_fast_no_openmp(PyObject * { PyObject *__pyx_t_1 = NULL; static PyThread_type_lock __pyx_t_2[8]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT if (__pyx_m) { @@ -26149,11 +26605,9 @@ if (!__Pyx_RefNanny) { #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - #endif /*--- Module creation code ---*/ #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_m = __pyx_pyinit_module; @@ -26190,14 +26644,14 @@ if (!__Pyx_RefNanny) { } #endif /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error; + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error; + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error; + if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_type_import_code(); (void)__Pyx_modinit_variable_import_code(); (void)__Pyx_modinit_function_import_code(); @@ -26227,100 +26681,100 @@ if (!__Pyx_RefNanny) { */ __pyx_v_7lightfm_23_lightfm_fast_no_openmp_MAX_REG_SCALE = 1000000.0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":694 + /* "lightfm/_lightfm_fast_no_openmp.pyx":706 * * * def fit_logistic(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * int[::1] user_ids, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_1fit_logistic, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 694, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_1fit_logistic, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 706, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_logistic, __pyx_t_1) < 0) __PYX_ERR(0, 694, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_logistic, __pyx_t_1) < 0) __PYX_ERR(0, 706, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":784 + /* "lightfm/_lightfm_fast_no_openmp.pyx":796 * * * def fit_warp(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix interactions, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_3fit_warp, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 784, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_3fit_warp, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 796, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_warp, __pyx_t_1) < 0) __PYX_ERR(0, 784, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_warp, __pyx_t_1) < 0) __PYX_ERR(0, 796, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":915 + /* "lightfm/_lightfm_fast_no_openmp.pyx":927 * * * def fit_warp_kos(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix data, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_5fit_warp_kos, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 915, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_5fit_warp_kos, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 927, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_warp_kos, __pyx_t_1) < 0) __PYX_ERR(0, 915, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_warp_kos, __pyx_t_1) < 0) __PYX_ERR(0, 927, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1074 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1086 * * * def fit_bpr(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix interactions, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_7fit_bpr, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1074, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_7fit_bpr, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1086, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_bpr, __pyx_t_1) < 0) __PYX_ERR(0, 1074, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_bpr, __pyx_t_1) < 0) __PYX_ERR(0, 1086, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1185 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1197 * * * def predict_lightfm(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * int[::1] user_ids, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_9predict_lightfm, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1185, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_9predict_lightfm, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1197, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_predict_lightfm, __pyx_t_1) < 0) __PYX_ERR(0, 1185, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_predict_lightfm, __pyx_t_1) < 0) __PYX_ERR(0, 1197, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1232 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1244 * * * def predict_ranks(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix test_interactions, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_11predict_ranks, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1232, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_11predict_ranks, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1244, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_predict_ranks, __pyx_t_1) < 0) __PYX_ERR(0, 1232, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_predict_ranks, __pyx_t_1) < 0) __PYX_ERR(0, 1244, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1326 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1338 * * * def calculate_auc_from_rank(CSRMatrix ranks, # <<<<<<<<<<<<<< * int[::1] num_train_positives, * flt[::1] rank_data, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_13calculate_auc_from_rank, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1326, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_13calculate_auc_from_rank, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1338, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculate_auc_from_rank, __pyx_t_1) < 0) __PYX_ERR(0, 1326, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculate_auc_from_rank, __pyx_t_1) < 0) __PYX_ERR(0, 1338, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "lightfm/_lightfm_fast_no_openmp.pyx":1380 + /* "lightfm/_lightfm_fast_no_openmp.pyx":1392 * * # Expose test functions * def __test_in_positives(int row, int col, CSRMatrix mat): # <<<<<<<<<<<<<< * * if in_positives(col, row, mat): */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_15__test_in_positives, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1380, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_23_lightfm_fast_no_openmp_15__test_in_positives, NULL, __pyx_n_s_lightfm__lightfm_fast_no_openmp_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1392, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_in_positives, __pyx_t_1) < 0) __PYX_ERR(0, 1380, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_in_positives, __pyx_t_1) < 0) __PYX_ERR(0, 1392, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "(tree fragment)":1 @@ -26614,7 +27068,7 @@ static int __Pyx_ParseOptionalKeywords( } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + if (likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { @@ -26641,7 +27095,7 @@ static int __Pyx_ParseOptionalKeywords( while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; @@ -26657,7 +27111,7 @@ static int __Pyx_ParseOptionalKeywords( while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; @@ -26731,7 +27185,7 @@ __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, int i, retval=-1; Py_buffer *buf = &memview->view; __Pyx_RefNannySetupContext("init_memviewslice", 0); - if (memviewslice->memview || memviewslice->data) { + if (unlikely(memviewslice->memview || memviewslice->data)) { PyErr_SetString(PyExc_ValueError, "memviewslice is already initialized!"); goto fail; @@ -26810,13 +27264,13 @@ __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) { int first_time; struct __pyx_memoryview_obj *memview = memslice->memview; - if (!memview || (PyObject *) memview == Py_None) + if (unlikely(!memview || (PyObject *) memview == Py_None)) return; - if (__pyx_get_slice_count(memview) < 0) + if (unlikely(__pyx_get_slice_count(memview) < 0)) __pyx_fatalerror("Acquisition count is %d (line %d)", __pyx_get_slice_count(memview), lineno); first_time = __pyx_add_acquisition_count(memview) == 0; - if (first_time) { + if (unlikely(first_time)) { if (have_gil) { Py_INCREF((PyObject *) memview); } else { @@ -26830,18 +27284,16 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) { int last_time; struct __pyx_memoryview_obj *memview = memslice->memview; - if (!memview ) { - return; - } else if ((PyObject *) memview == Py_None) { + if (unlikely(!memview || (PyObject *) memview == Py_None)) { memslice->memview = NULL; return; } - if (__pyx_get_slice_count(memview) <= 0) + if (unlikely(__pyx_get_slice_count(memview) <= 0)) __pyx_fatalerror("Acquisition count is %d (line %d)", __pyx_get_slice_count(memview), lineno); last_time = __pyx_sub_acquisition_count(memview) == 1; memslice->data = NULL; - if (last_time) { + if (unlikely(last_time)) { if (have_gil) { Py_CLEAR(memslice->memview); } else { @@ -27219,7 +27671,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; - ternaryfunc call = func->ob_type->tp_call; + ternaryfunc call = Py_TYPE(func)->tp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) @@ -27306,7 +27758,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); #if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { + } else if (__Pyx_PyFastCFunction_Check(func)) { return __Pyx_PyCFunction_FastCall(func, &arg, 1); #endif } @@ -27354,7 +27806,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { { #if PY_MAJOR_VERSION >= 3 if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { + if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); if (!module) { @@ -27867,9 +28319,9 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( if (stop < 0) stop += length; } + if (unlikely(stop <= start)) + return __Pyx_NewRef(__pyx_empty_unicode); length = stop - start; - if (unlikely(length <= 0)) - return PyUnicode_FromUnicode(NULL, 0); cstring += start; if (decode_func) { return decode_func(cstring, length, errors); @@ -28358,6 +28810,28 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { return -1; } +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + /* SetupReduce */ static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; @@ -28385,43 +28859,51 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { PyObject *setstate = NULL; PyObject *setstate_cython = NULL; #if CYTHON_USE_PYTYPE_LOOKUP - if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD; + if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; #else - if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD; + if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; #endif #if CYTHON_USE_PYTYPE_LOOKUP - object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD; + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #else - object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD; + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #endif - reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD; + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; if (reduce_ex == object_reduce_ex) { #if CYTHON_USE_PYTYPE_LOOKUP - object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD; + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; #else - object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD; + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; #endif - reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD; + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { - reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD; - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD; + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); + if (likely(reduce_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; + } setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { - setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD; - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD; + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); + if (likely(setstate_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; + } } PyType_Modified((PyTypeObject*)type_obj); } } - goto GOOD; -BAD: + goto __PYX_GOOD; +__PYX_BAD: if (!PyErr_Occurred()) PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); ret = -1; -GOOD: +__PYX_GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP Py_XDECREF(object_reduce); Py_XDECREF(object_reduce_ex); @@ -28436,7 +28918,7 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON @@ -28466,7 +28948,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -28540,7 +29022,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } @@ -28563,30 +29045,31 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, @@ -28605,11 +29088,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -28734,37 +29222,6 @@ __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) return cobj; } -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) @@ -29137,9 +29594,7 @@ static PyObject * __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) { const char *ts = *tsp; - int i = 0, number; - int ndim = ctx->head->field->type->ndim; -; + int i = 0, number, ndim; ++ts; if (ctx->new_count != 1) { PyErr_SetString(PyExc_ValueError, @@ -29147,6 +29602,7 @@ __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ndim = ctx->head->field->type->ndim; while (*ts && *ts != ')') { switch (*ts) { case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; @@ -29276,8 +29732,8 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': case 'O': case 'p': - if (ctx->enc_type == *ts && got_Z == ctx->is_complex && - ctx->enc_packmode == ctx->new_packmode) { + if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && + (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { ctx->enc_count += ctx->new_count; ctx->new_count = 1; got_Z = 0; @@ -29363,13 +29819,13 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) if (buf->strides) { if (spec & __Pyx_MEMVIEW_CONTIG) { if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) { - if (buf->strides[dim] != sizeof(void *)) { + if (unlikely(buf->strides[dim] != sizeof(void *))) { PyErr_Format(PyExc_ValueError, "Buffer is not indirectly contiguous " "in dimension %d.", dim); goto fail; } - } else if (buf->strides[dim] != buf->itemsize) { + } else if (unlikely(buf->strides[dim] != buf->itemsize)) { PyErr_SetString(PyExc_ValueError, "Buffer and memoryview are not contiguous " "in the same dimension."); @@ -29380,7 +29836,7 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) Py_ssize_t stride = buf->strides[dim]; if (stride < 0) stride = -stride; - if (stride < buf->itemsize) { + if (unlikely(stride < buf->itemsize)) { PyErr_SetString(PyExc_ValueError, "Buffer and memoryview are not contiguous " "in the same dimension."); @@ -29388,17 +29844,17 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) } } } else { - if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) { + if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) { PyErr_Format(PyExc_ValueError, "C-contiguous buffer is not contiguous in " "dimension %d", dim); goto fail; - } else if (spec & (__Pyx_MEMVIEW_PTR)) { + } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) { PyErr_Format(PyExc_ValueError, "C-contiguous buffer is not indirect in " "dimension %d", dim); goto fail; - } else if (buf->suboffsets) { + } else if (unlikely(buf->suboffsets)) { PyErr_SetString(PyExc_ValueError, "Buffer exposes suboffsets but no strides"); goto fail; @@ -29412,7 +29868,7 @@ static int __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec) { if (spec & __Pyx_MEMVIEW_DIRECT) { - if (buf->suboffsets && buf->suboffsets[dim] >= 0) { + if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) { PyErr_Format(PyExc_ValueError, "Buffer not compatible with direct access " "in dimension %d.", dim); @@ -29420,7 +29876,7 @@ __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec } } if (spec & __Pyx_MEMVIEW_PTR) { - if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) { + if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) { PyErr_Format(PyExc_ValueError, "Buffer is not indirectly accessible " "in dimension %d.", dim); @@ -29438,9 +29894,7 @@ __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag) if (c_or_f_flag & __Pyx_IS_F_CONTIG) { Py_ssize_t stride = 1; for (i = 0; i < ndim; i++) { - if (stride * buf->itemsize != buf->strides[i] && - buf->shape[i] > 1) - { + if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) { PyErr_SetString(PyExc_ValueError, "Buffer not fortran contiguous."); goto fail; @@ -29450,8 +29904,7 @@ __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag) } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) { Py_ssize_t stride = 1; for (i = ndim - 1; i >- 1; i--) { - if (stride * buf->itemsize != buf->strides[i] && - buf->shape[i] > 1) { + if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) { PyErr_SetString(PyExc_ValueError, "Buffer not C contiguous."); goto fail; @@ -29492,7 +29945,7 @@ static int __Pyx_ValidateAndInit_memviewslice( goto fail; } buf = &memview->view; - if (buf->ndim != ndim) { + if (unlikely(buf->ndim != ndim)) { PyErr_Format(PyExc_ValueError, "Buffer has wrong number of dimensions (expected %d, got %d)", ndim, buf->ndim); @@ -29500,9 +29953,9 @@ static int __Pyx_ValidateAndInit_memviewslice( } if (new_memview) { __Pyx_BufFmt_Init(&ctx, stack, dtype); - if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail; } - if ((unsigned) buf->itemsize != dtype->size) { + if (unlikely((unsigned) buf->itemsize != dtype->size)) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) " "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)", @@ -29513,15 +29966,17 @@ static int __Pyx_ValidateAndInit_memviewslice( (dtype->size > 1) ? "s" : ""); goto fail; } - for (i = 0; i < ndim; i++) { - spec = axes_specs[i]; - if (!__pyx_check_strides(buf, i, ndim, spec)) - goto fail; - if (!__pyx_check_suboffsets(buf, i, ndim, spec)) + if (buf->len > 0) { + for (i = 0; i < ndim; i++) { + spec = axes_specs[i]; + if (unlikely(!__pyx_check_strides(buf, i, ndim, spec))) + goto fail; + if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec))) + goto fail; + } + if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))) goto fail; } - if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)) - goto fail; if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice, new_memview != NULL) == -1)) { goto fail; @@ -29617,35 +30072,27 @@ static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) return result; } -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); +/* ObjectToMemviewSlice */ + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(PyObject *obj, int writable_flag) { + __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_BufFmt_StackElem stack[1]; + int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; + int retcode; + if (obj == Py_None) { + result.memview = (struct __pyx_memoryview_obj *) Py_None; + return result; } + retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG, + (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1, + &__Pyx_TypeInfo_unsigned_int, stack, + &result, obj); + if (unlikely(retcode == -1)) + goto __pyx_fail; + return result; +__pyx_fail: + result.memview = NULL; + result.data = NULL; + return result; } /* MemviewSliceCopyTemplate */ @@ -29666,7 +30113,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, struct __pyx_memoryview_obj *memview_obj = NULL; __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0); for (i = 0; i < ndim; i++) { - if (from_mvs->suboffsets[i] >= 0) { + if (unlikely(from_mvs->suboffsets[i] >= 0)) { PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with " "indirect dimensions (axis %d)", i); goto fail; @@ -29715,9 +30162,54 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return new_mvs; } +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); + } +} + /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -29906,7 +30398,14 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -30093,9 +30592,54 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return (long) -1; } +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} + /* CIntFromPy */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { - const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const char neg_one = (char) -1, const_zero = (char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -30282,29 +30826,6 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return (char) -1; } -/* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(PyObject *obj, int writable_flag) { - __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_BufFmt_StackElem stack[1]; - int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; - int retcode; - if (obj == Py_None) { - result.memview = (struct __pyx_memoryview_obj *) Py_None; - return result; - } - retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG, - (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1, - &__Pyx_TypeInfo_unsigned_int, stack, - &result, obj); - if (unlikely(retcode == -1)) - goto __pyx_fail; - return result; -__pyx_fail: - result.memview = NULL; - result.data = NULL; - return result; -} - /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; @@ -30569,6 +31090,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } diff --git a/lightfm/_lightfm_fast_openmp.c b/lightfm/_lightfm_fast_openmp.c index c64534c9..aaf52993 100644 --- a/lightfm/_lightfm_fast_openmp.c +++ b/lightfm/_lightfm_fast_openmp.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.29.14 */ +/* Generated by Cython 0.29.26 */ /* BEGIN: Cython Metadata { @@ -16,15 +16,17 @@ } END: Cython Metadata */ +#ifndef PY_SSIZE_T_CLEAN #define PY_SSIZE_T_CLEAN +#endif /* PY_SSIZE_T_CLEAN */ #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #elif PY_VERSION_HEX < 0x02060000 || (0x03000000 <= PY_VERSION_HEX && PY_VERSION_HEX < 0x03030000) #error Cython requires Python 2.6+ or Python 3.3+. #else -#define CYTHON_ABI "0_29_14" -#define CYTHON_HEX_VERSION 0x001D0EF0 +#define CYTHON_ABI "0_29_26" +#define CYTHON_HEX_VERSION 0x001D1AF0 #define CYTHON_FUTURE_DIVISION 0 #include #ifndef offsetof @@ -171,7 +173,7 @@ END: Cython Metadata */ #ifndef CYTHON_USE_UNICODE_INTERNALS #define CYTHON_USE_UNICODE_INTERNALS 1 #endif - #if PY_VERSION_HEX < 0x030300F0 + #if PY_VERSION_HEX < 0x030300F0 || PY_VERSION_HEX >= 0x030B00A2 #undef CYTHON_USE_UNICODE_WRITER #define CYTHON_USE_UNICODE_WRITER 0 #elif !defined(CYTHON_USE_UNICODE_WRITER) @@ -190,7 +192,7 @@ END: Cython Metadata */ #define CYTHON_FAST_THREAD_STATE 1 #endif #ifndef CYTHON_FAST_PYCALL - #define CYTHON_FAST_PYCALL 1 + #define CYTHON_FAST_PYCALL (PY_VERSION_HEX < 0x030B00A1) #endif #ifndef CYTHON_PEP489_MULTI_PHASE_INIT #define CYTHON_PEP489_MULTI_PHASE_INIT (PY_VERSION_HEX >= 0x03050000) @@ -209,7 +211,9 @@ END: Cython Metadata */ #define CYTHON_FAST_PYCCALL (CYTHON_FAST_PYCALL && PY_VERSION_HEX >= 0x030600B1) #endif #if CYTHON_USE_PYLONG_INTERNALS - #include "longintrepr.h" + #if PY_MAJOR_VERSION < 3 + #include "longintrepr.h" + #endif #undef SHIFT #undef BASE #undef MASK @@ -326,9 +330,68 @@ END: Cython Metadata */ #define __Pyx_DefaultClassType PyClass_Type #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" -#if PY_VERSION_HEX >= 0x030800A4 && PY_VERSION_HEX < 0x030800B2 - #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ - PyCode_New(a, 0, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) + #define __Pyx_DefaultClassType PyType_Type +#if PY_VERSION_HEX >= 0x030B00A1 + static CYTHON_INLINE PyCodeObject* __Pyx_PyCode_New(int a, int k, int l, int s, int f, + PyObject *code, PyObject *c, PyObject* n, PyObject *v, + PyObject *fv, PyObject *cell, PyObject* fn, + PyObject *name, int fline, PyObject *lnos) { + PyObject *kwds=NULL, *argcount=NULL, *posonlyargcount=NULL, *kwonlyargcount=NULL; + PyObject *nlocals=NULL, *stacksize=NULL, *flags=NULL, *replace=NULL, *call_result=NULL, *empty=NULL; + const char *fn_cstr=NULL; + const char *name_cstr=NULL; + PyCodeObject* co=NULL; + PyObject *type, *value, *traceback; + PyErr_Fetch(&type, &value, &traceback); + if (!(kwds=PyDict_New())) goto end; + if (!(argcount=PyLong_FromLong(a))) goto end; + if (PyDict_SetItemString(kwds, "co_argcount", argcount) != 0) goto end; + if (!(posonlyargcount=PyLong_FromLong(0))) goto end; + if (PyDict_SetItemString(kwds, "co_posonlyargcount", posonlyargcount) != 0) goto end; + if (!(kwonlyargcount=PyLong_FromLong(k))) goto end; + if (PyDict_SetItemString(kwds, "co_kwonlyargcount", kwonlyargcount) != 0) goto end; + if (!(nlocals=PyLong_FromLong(l))) goto end; + if (PyDict_SetItemString(kwds, "co_nlocals", nlocals) != 0) goto end; + if (!(stacksize=PyLong_FromLong(s))) goto end; + if (PyDict_SetItemString(kwds, "co_stacksize", stacksize) != 0) goto end; + if (!(flags=PyLong_FromLong(f))) goto end; + if (PyDict_SetItemString(kwds, "co_flags", flags) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_code", code) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_consts", c) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_names", n) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_varnames", v) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_freevars", fv) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_cellvars", cell) != 0) goto end; + if (PyDict_SetItemString(kwds, "co_linetable", lnos) != 0) goto end; + if (!(fn_cstr=PyUnicode_AsUTF8AndSize(fn, NULL))) goto end; + if (!(name_cstr=PyUnicode_AsUTF8AndSize(name, NULL))) goto end; + if (!(co = PyCode_NewEmpty(fn_cstr, name_cstr, fline))) goto end; + if (!(replace = PyObject_GetAttrString((PyObject*)co, "replace"))) goto cleanup_code_too; + if (!(empty = PyTuple_New(0))) goto cleanup_code_too; // unfortunately __pyx_empty_tuple isn't available here + if (!(call_result = PyObject_Call(replace, empty, kwds))) goto cleanup_code_too; + Py_XDECREF((PyObject*)co); + co = (PyCodeObject*)call_result; + call_result = NULL; + if (0) { + cleanup_code_too: + Py_XDECREF((PyObject*)co); + co = NULL; + } + end: + Py_XDECREF(kwds); + Py_XDECREF(argcount); + Py_XDECREF(posonlyargcount); + Py_XDECREF(kwonlyargcount); + Py_XDECREF(nlocals); + Py_XDECREF(stacksize); + Py_XDECREF(replace); + Py_XDECREF(call_result); + Py_XDECREF(empty); + if (type) { + PyErr_Restore(type, value, traceback); + } + return co; + } #else #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos)\ PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) @@ -442,8 +505,12 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #endif #if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) #define CYTHON_PEP393_ENABLED 1 + #if defined(PyUnicode_IS_READY) #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ?\ 0 : _PyUnicode_Ready((PyObject *)(op))) + #else + #define __Pyx_PyUnicode_READY(op) (0) + #endif #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) #define __Pyx_PyUnicode_MAX_CHAR_VALUE(u) PyUnicode_MAX_CHAR_VALUE(u) @@ -451,7 +518,15 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define __Pyx_PyUnicode_DATA(u) PyUnicode_DATA(u) #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) #define __Pyx_PyUnicode_WRITE(k, d, i, ch) PyUnicode_WRITE(k, d, i, ch) + #if defined(PyUnicode_IS_READY) && defined(PyUnicode_GET_SIZE) + #if CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x03090000 + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : ((PyCompactUnicodeObject *)(u))->wstr_length)) + #else #define __Pyx_PyUnicode_IS_TRUE(u) (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u))) + #endif + #else + #define __Pyx_PyUnicode_IS_TRUE(u) (0 != PyUnicode_GET_LENGTH(u)) + #endif #else #define CYTHON_PEP393_ENABLED 0 #define PyUnicode_1BYTE_KIND 1 @@ -500,8 +575,10 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact +#ifndef PyObject_Unicode #define PyObject_Unicode PyObject_Str #endif +#endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) @@ -512,6 +589,13 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif +#if PY_VERSION_HEX >= 0x030900A4 + #define __Pyx_SET_REFCNT(obj, refcnt) Py_SET_REFCNT(obj, refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SET_SIZE(obj, size) +#else + #define __Pyx_SET_REFCNT(obj, refcnt) Py_REFCNT(obj) = (refcnt) + #define __Pyx_SET_SIZE(obj, size) Py_SIZE(obj) = (size) +#endif #if CYTHON_ASSUME_SAFE_MACROS #define __Pyx_PySequence_SIZE(seq) Py_SIZE(seq) #else @@ -545,13 +629,13 @@ static CYTHON_INLINE void * PyThread_tss_get(Py_tss_t *key) { #if PY_VERSION_HEX < 0x030200A4 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong - #define __Pyx_PyInt_AsHash_t PyInt_AsLong + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsHash_t #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t - #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t + #define __Pyx_PyInt_AsHash_t __Pyx_PyIndex_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 - #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : (Py_INCREF(func), func)) + #define __Pyx_PyMethod_New(func, self, klass) ((self) ? ((void)(klass), PyMethod_New(func, self)) : __Pyx_NewRef(func)) #else #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass) #endif @@ -592,11 +676,10 @@ static CYTHON_INLINE float __PYX_NAN() { #define __Pyx_truncl truncl #endif - +#define __PYX_MARK_ERR_POS(f_index, lineno) \ + { __pyx_filename = __pyx_f[f_index]; (void)__pyx_filename; __pyx_lineno = lineno; (void)__pyx_lineno; __pyx_clineno = __LINE__; (void)__pyx_clineno; } #define __PYX_ERR(f_index, lineno, Ln_error) \ -{ \ - __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \ -} + { __PYX_MARK_ERR_POS(f_index, lineno) goto Ln_error; } #ifndef __PYX_EXTERN_C #ifdef __cplusplus @@ -713,6 +796,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x); (likely(PyTuple_CheckExact(obj)) ? __Pyx_NewRef(obj) : PySequence_Tuple(obj)) static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject*); #if CYTHON_ASSUME_SAFE_MACROS #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #else @@ -1015,6 +1099,8 @@ struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM { int max_sampled; double item_scale; double user_scale; + double avg_loss; + int avg_loss_ctr; }; @@ -1406,6 +1492,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #ifndef Py_MEMBER_SIZE #define Py_MEMBER_SIZE(type, member) sizeof(((type *)0)->member) #endif +#if CYTHON_FAST_PYCALL static size_t __pyx_pyframe_localsplus_offset = 0; #include "frameobject.h" #define __Pxy_PyFrame_Initialize_Offsets()\ @@ -1413,6 +1500,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, (void)(__pyx_pyframe_localsplus_offset = ((size_t)PyFrame_Type.tp_basicsize) - Py_MEMBER_SIZE(PyFrameObject, f_localsplus))) #define __Pyx_PyFrame_GetLocalsplus(frame)\ (assert(__pyx_pyframe_localsplus_offset), (PyObject **)(((char *)(frame)) + __pyx_pyframe_localsplus_offset)) +#endif // CYTHON_FAST_PYCALL #endif /* PyObjectCall.proto */ @@ -1576,7 +1664,7 @@ static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { if (likely(L->allocated > len)) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; + __Pyx_SET_SIZE(list, len + 1); return 0; } return PyList_Append(list, x); @@ -1614,7 +1702,7 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { Py_INCREF(x); PyList_SET_ITEM(list, len, x); - Py_SIZE(list) = len+1; + __Pyx_SET_SIZE(list, len + 1); return 0; } return PyList_Append(list, x); @@ -1643,6 +1731,9 @@ static PyObject* __Pyx_PyObject_GenericGetAttr(PyObject* obj, PyObject* attr_nam /* SetVTable.proto */ static int __Pyx_SetVtable(PyObject *dict, void *vtable); +/* PyObjectGetAttrStrNoError.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name); + /* SetupReduce.proto */ static int __Pyx_setup_reduce(PyObject* type_obj); @@ -1706,8 +1797,10 @@ static int __pyx_slices_overlap(__Pyx_memviewslice *slice1, /* Capsule.proto */ static CYTHON_INLINE PyObject *__pyx_capsule_create(void *p, const char *sig); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); +/* GCCDiagnostics.proto */ +#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) +#define __Pyx_HAS_GCC_DIAGNOSTIC +#endif /* MemviewDtypeToObject.proto */ static CYTHON_INLINE PyObject *__pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(const char *itemp); @@ -1749,8 +1842,8 @@ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_int /* ObjectToMemviewSlice.proto */ static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyObject *, int writable_flag); -/* CIntToPy.proto */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); +/* ObjectToMemviewSlice.proto */ +static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(PyObject *, int writable_flag); /* MemviewSliceCopyTemplate.proto */ static __Pyx_memviewslice @@ -1759,18 +1852,21 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, size_t sizeof_dtype, int contig_flag, int dtype_is_object); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value); + /* CIntFromPy.proto */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *); /* CIntFromPy.proto */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *); +/* CIntToPy.proto */ +static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value); + /* CIntFromPy.proto */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *); -/* ObjectToMemviewSlice.proto */ -static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(PyObject *, int writable_flag); - /* CheckBinaryVersion.proto */ static int __Pyx_check_binary_version(void); @@ -2059,8 +2155,8 @@ static const char __pyx_k_Cannot_assign_to_read_only_memor[] = "Cannot assign to static const char __pyx_k_Cannot_create_writable_memory_vi[] = "Cannot create writable memory view from read-only memoryview"; static const char __pyx_k_Empty_shape_tuple_for_cython_arr[] = "Empty shape tuple for cython.array"; static const char __pyx_k_Incompatible_checksums_s_vs_0x5b[] = "Incompatible checksums (%s vs 0x5b63e82 = (cols, data, indices, indptr, nnz, rows))"; +static const char __pyx_k_Incompatible_checksums_s_vs_0x8f[] = "Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))"; static const char __pyx_k_Incompatible_checksums_s_vs_0xb0[] = "Incompatible checksums (%s vs 0xb068931 = (name))"; -static const char __pyx_k_Incompatible_checksums_s_vs_0xdd[] = "Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))"; static const char __pyx_k_Indirect_dimensions_not_supporte[] = "Indirect dimensions not supported"; static const char __pyx_k_Invalid_mode_expected_c_or_fortr[] = "Invalid mode, expected 'c' or 'fortran', got %s"; static const char __pyx_k_Out_of_bounds_on_buffer_access_a[] = "Out of bounds on buffer access (axis %d)"; @@ -2080,8 +2176,8 @@ static PyObject *__pyx_n_s_Ellipsis; static PyObject *__pyx_kp_s_Empty_shape_tuple_for_cython_arr; static PyObject *__pyx_n_s_FastLightFM; static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x5b; +static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0x8f; static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xb0; -static PyObject *__pyx_kp_s_Incompatible_checksums_s_vs_0xdd; static PyObject *__pyx_n_s_IndexError; static PyObject *__pyx_kp_s_Indirect_dimensions_not_supporte; static PyObject *__pyx_kp_s_Invalid_mode_expected_c_or_fortr; @@ -2263,6 +2359,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_9CSRMatrix___init__(struct _ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_9CSRMatrix_2__reduce_cython__(struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_9CSRMatrix_4__setstate_cython__(struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *__pyx_v_self, __Pyx_memviewslice __pyx_v_item_features, __Pyx_memviewslice __pyx_v_item_feature_gradients, __Pyx_memviewslice __pyx_v_item_feature_momentum, __Pyx_memviewslice __pyx_v_item_biases, __Pyx_memviewslice __pyx_v_item_bias_gradients, __Pyx_memviewslice __pyx_v_item_bias_momentum, __Pyx_memviewslice __pyx_v_user_features, __Pyx_memviewslice __pyx_v_user_feature_gradients, __Pyx_memviewslice __pyx_v_user_feature_momentum, __Pyx_memviewslice __pyx_v_user_biases, __Pyx_memviewslice __pyx_v_user_bias_gradients, __Pyx_memviewslice __pyx_v_user_bias_momentum, int __pyx_v_no_components, int __pyx_v_adadelta, __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_v_learning_rate, __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_v_rho, __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_v_epsilon, int __pyx_v_max_sampled); /* proto */ +static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_8avg_loss___get__(struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_2__reduce_cython__(struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_4__setstate_cython__(struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UNUSED PyObject *__pyx_self, struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *__pyx_v_item_features, struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *__pyx_v_user_features, __Pyx_memviewslice __pyx_v_user_ids, __Pyx_memviewslice __pyx_v_item_ids, __Pyx_memviewslice __pyx_v_Y, __Pyx_memviewslice __pyx_v_sample_weight, __Pyx_memviewslice __pyx_v_shuffle_indices, struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *__pyx_v_lightfm, CYTHON_UNUSED double __pyx_v_learning_rate, double __pyx_v_item_alpha, double __pyx_v_user_alpha, int __pyx_v_num_threads); /* proto */ @@ -2326,8 +2423,8 @@ static PyObject *__pyx_tp_new__memoryviewslice(PyTypeObject *t, PyObject *a, PyO static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_95829634; +static PyObject *__pyx_int_150189132; static PyObject *__pyx_int_184977713; -static PyObject *__pyx_int_232728138; static PyObject *__pyx_int_neg_1; static PyObject *__pyx_tuple_; static PyObject *__pyx_tuple__2; @@ -2963,6 +3060,9 @@ static int __pyx_f_7lightfm_20_lightfm_fast_openmp_flt_compare(const void *__pyx static int __pyx_pw_7lightfm_20_lightfm_fast_openmp_9CSRMatrix_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7lightfm_20_lightfm_fast_openmp_9CSRMatrix_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_csr_matrix = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); @@ -3022,6 +3122,9 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_9CSRMatrix___init__(struct _ int __pyx_t_8; int __pyx_t_9; size_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); /* "lightfm/_lightfm_fast_openmp.pyx":167 @@ -3275,6 +3378,9 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_9CSRMatrix_2__reduce_c PyObject *__pyx_t_7 = NULL; int __pyx_t_8; int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":5 @@ -3530,6 +3636,9 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_9CSRMatrix_4__setstate PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":17 @@ -3562,8 +3671,8 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_9CSRMatrix_4__setstate return __pyx_r; } -/* "lightfm/_lightfm_fast_openmp.pyx":222 - * cdef double user_scale +/* "lightfm/_lightfm_fast_openmp.pyx":225 + * cdef int avg_loss_ctr * * def __init__(self, # <<<<<<<<<<<<<< * flt[:, ::1] item_features, @@ -3591,6 +3700,9 @@ static int __pyx_pw_7lightfm_20_lightfm_fast_openmp_11FastLightFM_1__init__(PyOb __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_v_rho; __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_v_epsilon; int __pyx_v_max_sampled; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); @@ -3649,107 +3761,107 @@ static int __pyx_pw_7lightfm_20_lightfm_fast_openmp_11FastLightFM_1__init__(PyOb case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_feature_gradients)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 1); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 1); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_feature_momentum)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 2); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 2); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_biases)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 3); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 3); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_bias_gradients)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 4); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 4); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_bias_momentum)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 5); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 5); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 6); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 6); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_feature_gradients)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 7); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 7); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_feature_momentum)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 8); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 8); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_biases)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 9); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 9); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_bias_gradients)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 10); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 10); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_bias_momentum)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 11); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 11); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_no_components)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 12); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 12); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 13: if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_adadelta)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 13); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 13); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 14: if (likely((values[14] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_learning_rate)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 14); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 14); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 15: if (likely((values[15] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rho)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 15); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 15); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 16: if (likely((values[16] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_epsilon)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 16); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 16); __PYX_ERR(0, 225, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 17: if (likely((values[17] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_max_sampled)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 17); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, 17); __PYX_ERR(0, 225, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 222, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) __PYX_ERR(0, 225, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 18) { goto __pyx_L5_argtuple_error; @@ -3773,28 +3885,28 @@ static int __pyx_pw_7lightfm_20_lightfm_fast_openmp_11FastLightFM_1__init__(PyOb values[16] = PyTuple_GET_ITEM(__pyx_args, 16); values[17] = PyTuple_GET_ITEM(__pyx_args, 17); } - __pyx_v_item_features = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_features.memview)) __PYX_ERR(0, 223, __pyx_L3_error) - __pyx_v_item_feature_gradients = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_feature_gradients.memview)) __PYX_ERR(0, 224, __pyx_L3_error) - __pyx_v_item_feature_momentum = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_feature_momentum.memview)) __PYX_ERR(0, 225, __pyx_L3_error) - __pyx_v_item_biases = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_biases.memview)) __PYX_ERR(0, 226, __pyx_L3_error) - __pyx_v_item_bias_gradients = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_bias_gradients.memview)) __PYX_ERR(0, 227, __pyx_L3_error) - __pyx_v_item_bias_momentum = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_bias_momentum.memview)) __PYX_ERR(0, 228, __pyx_L3_error) - __pyx_v_user_features = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_features.memview)) __PYX_ERR(0, 229, __pyx_L3_error) - __pyx_v_user_feature_gradients = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_feature_gradients.memview)) __PYX_ERR(0, 230, __pyx_L3_error) - __pyx_v_user_feature_momentum = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_feature_momentum.memview)) __PYX_ERR(0, 231, __pyx_L3_error) - __pyx_v_user_biases = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[9], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_biases.memview)) __PYX_ERR(0, 232, __pyx_L3_error) - __pyx_v_user_bias_gradients = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[10], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_bias_gradients.memview)) __PYX_ERR(0, 233, __pyx_L3_error) - __pyx_v_user_bias_momentum = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[11], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_bias_momentum.memview)) __PYX_ERR(0, 234, __pyx_L3_error) - __pyx_v_no_components = __Pyx_PyInt_As_int(values[12]); if (unlikely((__pyx_v_no_components == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 235, __pyx_L3_error) - __pyx_v_adadelta = __Pyx_PyInt_As_int(values[13]); if (unlikely((__pyx_v_adadelta == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 236, __pyx_L3_error) - __pyx_v_learning_rate = __pyx_PyFloat_AsFloat(values[14]); if (unlikely((__pyx_v_learning_rate == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 237, __pyx_L3_error) - __pyx_v_rho = __pyx_PyFloat_AsFloat(values[15]); if (unlikely((__pyx_v_rho == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L3_error) - __pyx_v_epsilon = __pyx_PyFloat_AsFloat(values[16]); if (unlikely((__pyx_v_epsilon == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 239, __pyx_L3_error) - __pyx_v_max_sampled = __Pyx_PyInt_As_int(values[17]); if (unlikely((__pyx_v_max_sampled == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L3_error) + __pyx_v_item_features = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[0], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_features.memview)) __PYX_ERR(0, 226, __pyx_L3_error) + __pyx_v_item_feature_gradients = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_feature_gradients.memview)) __PYX_ERR(0, 227, __pyx_L3_error) + __pyx_v_item_feature_momentum = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_feature_momentum.memview)) __PYX_ERR(0, 228, __pyx_L3_error) + __pyx_v_item_biases = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_biases.memview)) __PYX_ERR(0, 229, __pyx_L3_error) + __pyx_v_item_bias_gradients = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_bias_gradients.memview)) __PYX_ERR(0, 230, __pyx_L3_error) + __pyx_v_item_bias_momentum = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_bias_momentum.memview)) __PYX_ERR(0, 231, __pyx_L3_error) + __pyx_v_user_features = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_features.memview)) __PYX_ERR(0, 232, __pyx_L3_error) + __pyx_v_user_feature_gradients = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_feature_gradients.memview)) __PYX_ERR(0, 233, __pyx_L3_error) + __pyx_v_user_feature_momentum = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[8], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_feature_momentum.memview)) __PYX_ERR(0, 234, __pyx_L3_error) + __pyx_v_user_biases = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[9], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_biases.memview)) __PYX_ERR(0, 235, __pyx_L3_error) + __pyx_v_user_bias_gradients = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[10], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_bias_gradients.memview)) __PYX_ERR(0, 236, __pyx_L3_error) + __pyx_v_user_bias_momentum = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[11], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_bias_momentum.memview)) __PYX_ERR(0, 237, __pyx_L3_error) + __pyx_v_no_components = __Pyx_PyInt_As_int(values[12]); if (unlikely((__pyx_v_no_components == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 238, __pyx_L3_error) + __pyx_v_adadelta = __Pyx_PyInt_As_int(values[13]); if (unlikely((__pyx_v_adadelta == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 239, __pyx_L3_error) + __pyx_v_learning_rate = __pyx_PyFloat_AsFloat(values[14]); if (unlikely((__pyx_v_learning_rate == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 240, __pyx_L3_error) + __pyx_v_rho = __pyx_PyFloat_AsFloat(values[15]); if (unlikely((__pyx_v_rho == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 241, __pyx_L3_error) + __pyx_v_epsilon = __pyx_PyFloat_AsFloat(values[16]); if (unlikely((__pyx_v_epsilon == (float)-1) && PyErr_Occurred())) __PYX_ERR(0, 242, __pyx_L3_error) + __pyx_v_max_sampled = __Pyx_PyInt_As_int(values[17]); if (unlikely((__pyx_v_max_sampled == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 243, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 222, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__init__", 1, 18, 18, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 225, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_openmp.FastLightFM.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3812,7 +3924,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "lightfm/_lightfm_fast_openmp.pyx":242 + /* "lightfm/_lightfm_fast_openmp.pyx":245 * int max_sampled): * * self.item_features = item_features # <<<<<<<<<<<<<< @@ -3823,7 +3935,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc __PYX_INC_MEMVIEW(&__pyx_v_item_features, 0); __pyx_v_self->item_features = __pyx_v_item_features; - /* "lightfm/_lightfm_fast_openmp.pyx":243 + /* "lightfm/_lightfm_fast_openmp.pyx":246 * * self.item_features = item_features * self.item_feature_gradients = item_feature_gradients # <<<<<<<<<<<<<< @@ -3834,7 +3946,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc __PYX_INC_MEMVIEW(&__pyx_v_item_feature_gradients, 0); __pyx_v_self->item_feature_gradients = __pyx_v_item_feature_gradients; - /* "lightfm/_lightfm_fast_openmp.pyx":244 + /* "lightfm/_lightfm_fast_openmp.pyx":247 * self.item_features = item_features * self.item_feature_gradients = item_feature_gradients * self.item_feature_momentum = item_feature_momentum # <<<<<<<<<<<<<< @@ -3845,7 +3957,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc __PYX_INC_MEMVIEW(&__pyx_v_item_feature_momentum, 0); __pyx_v_self->item_feature_momentum = __pyx_v_item_feature_momentum; - /* "lightfm/_lightfm_fast_openmp.pyx":245 + /* "lightfm/_lightfm_fast_openmp.pyx":248 * self.item_feature_gradients = item_feature_gradients * self.item_feature_momentum = item_feature_momentum * self.item_biases = item_biases # <<<<<<<<<<<<<< @@ -3856,7 +3968,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc __PYX_INC_MEMVIEW(&__pyx_v_item_biases, 0); __pyx_v_self->item_biases = __pyx_v_item_biases; - /* "lightfm/_lightfm_fast_openmp.pyx":246 + /* "lightfm/_lightfm_fast_openmp.pyx":249 * self.item_feature_momentum = item_feature_momentum * self.item_biases = item_biases * self.item_bias_gradients = item_bias_gradients # <<<<<<<<<<<<<< @@ -3867,7 +3979,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc __PYX_INC_MEMVIEW(&__pyx_v_item_bias_gradients, 0); __pyx_v_self->item_bias_gradients = __pyx_v_item_bias_gradients; - /* "lightfm/_lightfm_fast_openmp.pyx":247 + /* "lightfm/_lightfm_fast_openmp.pyx":250 * self.item_biases = item_biases * self.item_bias_gradients = item_bias_gradients * self.item_bias_momentum = item_bias_momentum # <<<<<<<<<<<<<< @@ -3878,7 +3990,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc __PYX_INC_MEMVIEW(&__pyx_v_item_bias_momentum, 0); __pyx_v_self->item_bias_momentum = __pyx_v_item_bias_momentum; - /* "lightfm/_lightfm_fast_openmp.pyx":248 + /* "lightfm/_lightfm_fast_openmp.pyx":251 * self.item_bias_gradients = item_bias_gradients * self.item_bias_momentum = item_bias_momentum * self.user_features = user_features # <<<<<<<<<<<<<< @@ -3889,7 +4001,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc __PYX_INC_MEMVIEW(&__pyx_v_user_features, 0); __pyx_v_self->user_features = __pyx_v_user_features; - /* "lightfm/_lightfm_fast_openmp.pyx":249 + /* "lightfm/_lightfm_fast_openmp.pyx":252 * self.item_bias_momentum = item_bias_momentum * self.user_features = user_features * self.user_feature_gradients = user_feature_gradients # <<<<<<<<<<<<<< @@ -3900,7 +4012,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc __PYX_INC_MEMVIEW(&__pyx_v_user_feature_gradients, 0); __pyx_v_self->user_feature_gradients = __pyx_v_user_feature_gradients; - /* "lightfm/_lightfm_fast_openmp.pyx":250 + /* "lightfm/_lightfm_fast_openmp.pyx":253 * self.user_features = user_features * self.user_feature_gradients = user_feature_gradients * self.user_feature_momentum = user_feature_momentum # <<<<<<<<<<<<<< @@ -3911,7 +4023,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc __PYX_INC_MEMVIEW(&__pyx_v_user_feature_momentum, 0); __pyx_v_self->user_feature_momentum = __pyx_v_user_feature_momentum; - /* "lightfm/_lightfm_fast_openmp.pyx":251 + /* "lightfm/_lightfm_fast_openmp.pyx":254 * self.user_feature_gradients = user_feature_gradients * self.user_feature_momentum = user_feature_momentum * self.user_biases = user_biases # <<<<<<<<<<<<<< @@ -3922,7 +4034,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc __PYX_INC_MEMVIEW(&__pyx_v_user_biases, 0); __pyx_v_self->user_biases = __pyx_v_user_biases; - /* "lightfm/_lightfm_fast_openmp.pyx":252 + /* "lightfm/_lightfm_fast_openmp.pyx":255 * self.user_feature_momentum = user_feature_momentum * self.user_biases = user_biases * self.user_bias_gradients = user_bias_gradients # <<<<<<<<<<<<<< @@ -3933,7 +4045,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc __PYX_INC_MEMVIEW(&__pyx_v_user_bias_gradients, 0); __pyx_v_self->user_bias_gradients = __pyx_v_user_bias_gradients; - /* "lightfm/_lightfm_fast_openmp.pyx":253 + /* "lightfm/_lightfm_fast_openmp.pyx":256 * self.user_biases = user_biases * self.user_bias_gradients = user_bias_gradients * self.user_bias_momentum = user_bias_momentum # <<<<<<<<<<<<<< @@ -3944,7 +4056,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc __PYX_INC_MEMVIEW(&__pyx_v_user_bias_momentum, 0); __pyx_v_self->user_bias_momentum = __pyx_v_user_bias_momentum; - /* "lightfm/_lightfm_fast_openmp.pyx":255 + /* "lightfm/_lightfm_fast_openmp.pyx":258 * self.user_bias_momentum = user_bias_momentum * * self.no_components = no_components # <<<<<<<<<<<<<< @@ -3953,7 +4065,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc */ __pyx_v_self->no_components = __pyx_v_no_components; - /* "lightfm/_lightfm_fast_openmp.pyx":256 + /* "lightfm/_lightfm_fast_openmp.pyx":259 * * self.no_components = no_components * self.learning_rate = learning_rate # <<<<<<<<<<<<<< @@ -3962,7 +4074,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc */ __pyx_v_self->learning_rate = __pyx_v_learning_rate; - /* "lightfm/_lightfm_fast_openmp.pyx":257 + /* "lightfm/_lightfm_fast_openmp.pyx":260 * self.no_components = no_components * self.learning_rate = learning_rate * self.rho = rho # <<<<<<<<<<<<<< @@ -3971,7 +4083,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc */ __pyx_v_self->rho = __pyx_v_rho; - /* "lightfm/_lightfm_fast_openmp.pyx":258 + /* "lightfm/_lightfm_fast_openmp.pyx":261 * self.learning_rate = learning_rate * self.rho = rho * self.eps = epsilon # <<<<<<<<<<<<<< @@ -3980,7 +4092,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc */ __pyx_v_self->eps = __pyx_v_epsilon; - /* "lightfm/_lightfm_fast_openmp.pyx":260 + /* "lightfm/_lightfm_fast_openmp.pyx":263 * self.eps = epsilon * * self.item_scale = 1.0 # <<<<<<<<<<<<<< @@ -3989,7 +4101,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc */ __pyx_v_self->item_scale = 1.0; - /* "lightfm/_lightfm_fast_openmp.pyx":261 + /* "lightfm/_lightfm_fast_openmp.pyx":264 * * self.item_scale = 1.0 * self.user_scale = 1.0 # <<<<<<<<<<<<<< @@ -3998,7 +4110,7 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc */ __pyx_v_self->user_scale = 1.0; - /* "lightfm/_lightfm_fast_openmp.pyx":263 + /* "lightfm/_lightfm_fast_openmp.pyx":266 * self.user_scale = 1.0 * * self.adadelta = adadelta # <<<<<<<<<<<<<< @@ -4007,17 +4119,35 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc */ __pyx_v_self->adadelta = __pyx_v_adadelta; - /* "lightfm/_lightfm_fast_openmp.pyx":265 + /* "lightfm/_lightfm_fast_openmp.pyx":268 * self.adadelta = adadelta * * self.max_sampled = max_sampled # <<<<<<<<<<<<<< * - * + * self.avg_loss = 0.0 */ __pyx_v_self->max_sampled = __pyx_v_max_sampled; - /* "lightfm/_lightfm_fast_openmp.pyx":222 - * cdef double user_scale + /* "lightfm/_lightfm_fast_openmp.pyx":270 + * self.max_sampled = max_sampled + * + * self.avg_loss = 0.0 # <<<<<<<<<<<<<< + * self.avg_loss_ctr = 0 + * + */ + __pyx_v_self->avg_loss = 0.0; + + /* "lightfm/_lightfm_fast_openmp.pyx":271 + * + * self.avg_loss = 0.0 + * self.avg_loss_ctr = 0 # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_self->avg_loss_ctr = 0; + + /* "lightfm/_lightfm_fast_openmp.pyx":225 + * cdef int avg_loss_ctr * * def __init__(self, # <<<<<<<<<<<<<< * flt[:, ::1] item_features, @@ -4042,6 +4172,53 @@ static int __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM___init__(struc return __pyx_r; } +/* "lightfm/_lightfm_fast_openmp.pyx":222 + * cdef double user_scale + * + * cdef readonly double avg_loss # <<<<<<<<<<<<<< + * cdef int avg_loss_ctr + * + */ + +/* Python wrapper */ +static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_11FastLightFM_8avg_loss_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_11FastLightFM_8avg_loss_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_8avg_loss___get__(((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *)__pyx_v_self)); + + /* function exit code */ + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_8avg_loss___get__(struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->avg_loss); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 222, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + /* function exit code */ + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("lightfm._lightfm_fast_openmp.FastLightFM.avg_loss.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< * cdef tuple state @@ -4088,99 +4265,112 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_2__reduc PyObject *__pyx_t_19 = NULL; PyObject *__pyx_t_20 = NULL; PyObject *__pyx_t_21 = NULL; - int __pyx_t_22; - int __pyx_t_23; + PyObject *__pyx_t_22 = NULL; + PyObject *__pyx_t_23 = NULL; + int __pyx_t_24; + int __pyx_t_25; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":5 * cdef object _dict * cdef bint use_setstate - * state = (self.adadelta, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) # <<<<<<<<<<<<<< + * state = (self.adadelta, self.avg_loss, self.avg_loss_ctr, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) # <<<<<<<<<<<<<< * _dict = getattr(self, '__dict__', None) * if _dict is not None: */ __pyx_t_1 = __Pyx_PyInt_From_int(__pyx_v_self->adadelta); if (unlikely(!__pyx_t_1)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->eps); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->avg_loss); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_memoryview_fromslice(__pyx_v_self->item_bias_gradients, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyInt_From_int(__pyx_v_self->avg_loss_ctr); if (unlikely(!__pyx_t_3)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __pyx_memoryview_fromslice(__pyx_v_self->item_bias_momentum, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->eps); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_self->item_biases, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_5 = __pyx_memoryview_fromslice(__pyx_v_self->item_bias_gradients, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_5)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_self->item_feature_gradients, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_6 = __pyx_memoryview_fromslice(__pyx_v_self->item_bias_momentum, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_6)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_self->item_feature_momentum, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_7 = __pyx_memoryview_fromslice(__pyx_v_self->item_biases, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_7)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_self->item_features, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_8 = __pyx_memoryview_fromslice(__pyx_v_self->item_feature_gradients, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_8)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyFloat_FromDouble(__pyx_v_self->item_scale); if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_9 = __pyx_memoryview_fromslice(__pyx_v_self->item_feature_momentum, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_9)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = PyFloat_FromDouble(__pyx_v_self->learning_rate); if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_10 = __pyx_memoryview_fromslice(__pyx_v_self->item_features, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_11 = __Pyx_PyInt_From_int(__pyx_v_self->max_sampled); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_11 = PyFloat_FromDouble(__pyx_v_self->item_scale); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_PyInt_From_int(__pyx_v_self->no_components); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_12 = PyFloat_FromDouble(__pyx_v_self->learning_rate); if (unlikely(!__pyx_t_12)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = PyFloat_FromDouble(__pyx_v_self->rho); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_13 = __Pyx_PyInt_From_int(__pyx_v_self->max_sampled); if (unlikely(!__pyx_t_13)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); - __pyx_t_14 = __pyx_memoryview_fromslice(__pyx_v_self->user_bias_gradients, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_14 = __Pyx_PyInt_From_int(__pyx_v_self->no_components); if (unlikely(!__pyx_t_14)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_14); - __pyx_t_15 = __pyx_memoryview_fromslice(__pyx_v_self->user_bias_momentum, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_15 = PyFloat_FromDouble(__pyx_v_self->rho); if (unlikely(!__pyx_t_15)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_15); - __pyx_t_16 = __pyx_memoryview_fromslice(__pyx_v_self->user_biases, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_16 = __pyx_memoryview_fromslice(__pyx_v_self->user_bias_gradients, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_16)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_16); - __pyx_t_17 = __pyx_memoryview_fromslice(__pyx_v_self->user_feature_gradients, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_17 = __pyx_memoryview_fromslice(__pyx_v_self->user_bias_momentum, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_17)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_17); - __pyx_t_18 = __pyx_memoryview_fromslice(__pyx_v_self->user_feature_momentum, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_18 = __pyx_memoryview_fromslice(__pyx_v_self->user_biases, 1, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_18)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_18); - __pyx_t_19 = __pyx_memoryview_fromslice(__pyx_v_self->user_features, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_19 = __pyx_memoryview_fromslice(__pyx_v_self->user_feature_gradients, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_19); - __pyx_t_20 = PyFloat_FromDouble(__pyx_v_self->user_scale); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_20 = __pyx_memoryview_fromslice(__pyx_v_self->user_feature_momentum, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_20); - __pyx_t_21 = PyTuple_New(20); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 5, __pyx_L1_error) + __pyx_t_21 = __pyx_memoryview_fromslice(__pyx_v_self->user_features, 2, (PyObject *(*)(char *)) __pyx_memview_get_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, (int (*)(char *, PyObject *)) __pyx_memview_set_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt, 0);; if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); + __pyx_t_22 = PyFloat_FromDouble(__pyx_v_self->user_scale); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_23 = PyTuple_New(22); if (unlikely(!__pyx_t_23)) __PYX_ERR(1, 5, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_4); - PyTuple_SET_ITEM(__pyx_t_21, 3, __pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_23, 3, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_21, 4, __pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_23, 4, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_21, 5, __pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_23, 5, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_21, 6, __pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_23, 6, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_8); - PyTuple_SET_ITEM(__pyx_t_21, 7, __pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_23, 7, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_21, 8, __pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_23, 8, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_21, 9, __pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_23, 9, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_11); - PyTuple_SET_ITEM(__pyx_t_21, 10, __pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_23, 10, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_21, 11, __pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_23, 11, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_21, 12, __pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_23, 12, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_14); - PyTuple_SET_ITEM(__pyx_t_21, 13, __pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_23, 13, __pyx_t_14); __Pyx_GIVEREF(__pyx_t_15); - PyTuple_SET_ITEM(__pyx_t_21, 14, __pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_23, 14, __pyx_t_15); __Pyx_GIVEREF(__pyx_t_16); - PyTuple_SET_ITEM(__pyx_t_21, 15, __pyx_t_16); + PyTuple_SET_ITEM(__pyx_t_23, 15, __pyx_t_16); __Pyx_GIVEREF(__pyx_t_17); - PyTuple_SET_ITEM(__pyx_t_21, 16, __pyx_t_17); + PyTuple_SET_ITEM(__pyx_t_23, 16, __pyx_t_17); __Pyx_GIVEREF(__pyx_t_18); - PyTuple_SET_ITEM(__pyx_t_21, 17, __pyx_t_18); + PyTuple_SET_ITEM(__pyx_t_23, 17, __pyx_t_18); __Pyx_GIVEREF(__pyx_t_19); - PyTuple_SET_ITEM(__pyx_t_21, 18, __pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_23, 18, __pyx_t_19); __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_21, 19, __pyx_t_20); + PyTuple_SET_ITEM(__pyx_t_23, 19, __pyx_t_20); + __Pyx_GIVEREF(__pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_23, 20, __pyx_t_21); + __Pyx_GIVEREF(__pyx_t_22); + PyTuple_SET_ITEM(__pyx_t_23, 21, __pyx_t_22); __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; @@ -4201,31 +4391,33 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_2__reduc __pyx_t_18 = 0; __pyx_t_19 = 0; __pyx_t_20 = 0; - __pyx_v_state = ((PyObject*)__pyx_t_21); __pyx_t_21 = 0; + __pyx_t_22 = 0; + __pyx_v_state = ((PyObject*)__pyx_t_23); + __pyx_t_23 = 0; /* "(tree fragment)":6 * cdef bint use_setstate - * state = (self.adadelta, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) + * state = (self.adadelta, self.avg_loss, self.avg_loss_ctr, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) * _dict = getattr(self, '__dict__', None) # <<<<<<<<<<<<<< * if _dict is not None: * state += (_dict,) */ - __pyx_t_21 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 6, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); - __pyx_v__dict = __pyx_t_21; - __pyx_t_21 = 0; + __pyx_t_23 = __Pyx_GetAttr3(((PyObject *)__pyx_v_self), __pyx_n_s_dict, Py_None); if (unlikely(!__pyx_t_23)) __PYX_ERR(1, 6, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); + __pyx_v__dict = __pyx_t_23; + __pyx_t_23 = 0; /* "(tree fragment)":7 - * state = (self.adadelta, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) + * state = (self.adadelta, self.avg_loss, self.avg_loss_ctr, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) * _dict = getattr(self, '__dict__', None) * if _dict is not None: # <<<<<<<<<<<<<< * state += (_dict,) * use_setstate = True */ - __pyx_t_22 = (__pyx_v__dict != Py_None); - __pyx_t_23 = (__pyx_t_22 != 0); - if (__pyx_t_23) { + __pyx_t_24 = (__pyx_v__dict != Py_None); + __pyx_t_25 = (__pyx_t_24 != 0); + if (__pyx_t_25) { /* "(tree fragment)":8 * _dict = getattr(self, '__dict__', None) @@ -4234,16 +4426,16 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_2__reduc * use_setstate = True * else: */ - __pyx_t_21 = PyTuple_New(1); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); + __pyx_t_23 = PyTuple_New(1); if (unlikely(!__pyx_t_23)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); __Pyx_INCREF(__pyx_v__dict); __Pyx_GIVEREF(__pyx_v__dict); - PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_v__dict); - __pyx_t_20 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_21); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 8, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __Pyx_DECREF(__pyx_t_21); __pyx_t_21 = 0; - __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_20)); - __pyx_t_20 = 0; + PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_v__dict); + __pyx_t_22 = PyNumber_InPlaceAdd(__pyx_v_state, __pyx_t_23); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 8, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __Pyx_DECREF_SET(__pyx_v_state, ((PyObject*)__pyx_t_22)); + __pyx_t_22 = 0; /* "(tree fragment)":9 * if _dict is not None: @@ -4255,7 +4447,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_2__reduc __pyx_v_use_setstate = 1; /* "(tree fragment)":7 - * state = (self.adadelta, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) + * state = (self.adadelta, self.avg_loss, self.avg_loss_ctr, self.eps, self.item_bias_gradients, self.item_bias_momentum, self.item_biases, self.item_feature_gradients, self.item_feature_momentum, self.item_features, self.item_scale, self.learning_rate, self.max_sampled, self.no_components, self.rho, self.user_bias_gradients, self.user_bias_momentum, self.user_biases, self.user_feature_gradients, self.user_feature_momentum, self.user_features, self.user_scale) * _dict = getattr(self, '__dict__', None) * if _dict is not None: # <<<<<<<<<<<<<< * state += (_dict,) @@ -4269,7 +4461,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_2__reduc * else: * use_setstate = False # <<<<<<<<<<<<<< * if use_setstate: - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, None), state + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, None), state */ /*else*/ { __pyx_v_use_setstate = 0; @@ -4280,89 +4472,89 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_2__reduc * else: * use_setstate = False * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, None), state + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, None), state * else: */ - __pyx_t_23 = (__pyx_v_use_setstate != 0); - if (__pyx_t_23) { + __pyx_t_25 = (__pyx_v_use_setstate != 0); + if (__pyx_t_25) { /* "(tree fragment)":13 * use_setstate = False * if use_setstate: - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, None), state # <<<<<<<<<<<<<< + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, None), state # <<<<<<<<<<<<<< * else: - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, state) + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, state) */ __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_20, __pyx_n_s_pyx_unpickle_FastLightFM); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_21); + __Pyx_GetModuleGlobalName(__pyx_t_22, __pyx_n_s_pyx_unpickle_FastLightFM); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); + __pyx_t_23 = PyTuple_New(3); if (unlikely(!__pyx_t_23)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_21, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_232728138); - __Pyx_GIVEREF(__pyx_int_232728138); - PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_int_232728138); + PyTuple_SET_ITEM(__pyx_t_23, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_INCREF(__pyx_int_150189132); + __Pyx_GIVEREF(__pyx_int_150189132); + PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_int_150189132); __Pyx_INCREF(Py_None); __Pyx_GIVEREF(Py_None); - PyTuple_SET_ITEM(__pyx_t_21, 2, Py_None); - __pyx_t_19 = PyTuple_New(3); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 13, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __Pyx_GIVEREF(__pyx_t_20); - PyTuple_SET_ITEM(__pyx_t_19, 0, __pyx_t_20); - __Pyx_GIVEREF(__pyx_t_21); - PyTuple_SET_ITEM(__pyx_t_19, 1, __pyx_t_21); + PyTuple_SET_ITEM(__pyx_t_23, 2, Py_None); + __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 13, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_21); + __Pyx_GIVEREF(__pyx_t_22); + PyTuple_SET_ITEM(__pyx_t_21, 0, __pyx_t_22); + __Pyx_GIVEREF(__pyx_t_23); + PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_t_23); __Pyx_INCREF(__pyx_v_state); __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_19, 2, __pyx_v_state); - __pyx_t_20 = 0; + PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_v_state); + __pyx_t_22 = 0; + __pyx_t_23 = 0; + __pyx_r = __pyx_t_21; __pyx_t_21 = 0; - __pyx_r = __pyx_t_19; - __pyx_t_19 = 0; goto __pyx_L0; /* "(tree fragment)":12 * else: * use_setstate = False * if use_setstate: # <<<<<<<<<<<<<< - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, None), state + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, None), state * else: */ } /* "(tree fragment)":15 - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, None), state + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, None), state * else: - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, state) # <<<<<<<<<<<<<< + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, state) # <<<<<<<<<<<<<< * def __setstate_cython__(self, __pyx_state): * __pyx_unpickle_FastLightFM__set_state(self, __pyx_state) */ /*else*/ { __Pyx_XDECREF(__pyx_r); - __Pyx_GetModuleGlobalName(__pyx_t_19, __pyx_n_s_pyx_unpickle_FastLightFM); if (unlikely(!__pyx_t_19)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_19); - __pyx_t_21 = PyTuple_New(3); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_21, __pyx_n_s_pyx_unpickle_FastLightFM); if (unlikely(!__pyx_t_21)) __PYX_ERR(1, 15, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_21); + __pyx_t_23 = PyTuple_New(3); if (unlikely(!__pyx_t_23)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_23); __Pyx_INCREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); __Pyx_GIVEREF(((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - PyTuple_SET_ITEM(__pyx_t_21, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); - __Pyx_INCREF(__pyx_int_232728138); - __Pyx_GIVEREF(__pyx_int_232728138); - PyTuple_SET_ITEM(__pyx_t_21, 1, __pyx_int_232728138); + PyTuple_SET_ITEM(__pyx_t_23, 0, ((PyObject *)Py_TYPE(((PyObject *)__pyx_v_self)))); + __Pyx_INCREF(__pyx_int_150189132); + __Pyx_GIVEREF(__pyx_int_150189132); + PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_int_150189132); __Pyx_INCREF(__pyx_v_state); __Pyx_GIVEREF(__pyx_v_state); - PyTuple_SET_ITEM(__pyx_t_21, 2, __pyx_v_state); - __pyx_t_20 = PyTuple_New(2); if (unlikely(!__pyx_t_20)) __PYX_ERR(1, 15, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_20); - __Pyx_GIVEREF(__pyx_t_19); - PyTuple_SET_ITEM(__pyx_t_20, 0, __pyx_t_19); + PyTuple_SET_ITEM(__pyx_t_23, 2, __pyx_v_state); + __pyx_t_22 = PyTuple_New(2); if (unlikely(!__pyx_t_22)) __PYX_ERR(1, 15, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_22); __Pyx_GIVEREF(__pyx_t_21); - PyTuple_SET_ITEM(__pyx_t_20, 1, __pyx_t_21); - __pyx_t_19 = 0; + PyTuple_SET_ITEM(__pyx_t_22, 0, __pyx_t_21); + __Pyx_GIVEREF(__pyx_t_23); + PyTuple_SET_ITEM(__pyx_t_22, 1, __pyx_t_23); __pyx_t_21 = 0; - __pyx_r = __pyx_t_20; - __pyx_t_20 = 0; + __pyx_t_23 = 0; + __pyx_r = __pyx_t_22; + __pyx_t_22 = 0; goto __pyx_L0; } @@ -4395,6 +4587,8 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_2__reduc __Pyx_XDECREF(__pyx_t_19); __Pyx_XDECREF(__pyx_t_20); __Pyx_XDECREF(__pyx_t_21); + __Pyx_XDECREF(__pyx_t_22); + __Pyx_XDECREF(__pyx_t_23); __Pyx_AddTraceback("lightfm._lightfm_fast_openmp.FastLightFM.__reduce_cython__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -4407,7 +4601,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_2__reduc /* "(tree fragment)":16 * else: - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, state) + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle_FastLightFM__set_state(self, __pyx_state) */ @@ -4429,10 +4623,13 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_4__setst PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":17 - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, state) + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, state) * def __setstate_cython__(self, __pyx_state): * __pyx_unpickle_FastLightFM__set_state(self, __pyx_state) # <<<<<<<<<<<<<< */ @@ -4443,7 +4640,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_4__setst /* "(tree fragment)":16 * else: - * return __pyx_unpickle_FastLightFM, (type(self), 0xddf264a, state) + * return __pyx_unpickle_FastLightFM, (type(self), 0x8f3b44c, state) * def __setstate_cython__(self, __pyx_state): # <<<<<<<<<<<<<< * __pyx_unpickle_FastLightFM__set_state(self, __pyx_state) */ @@ -4461,7 +4658,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_4__setst return __pyx_r; } -/* "lightfm/_lightfm_fast_openmp.pyx":268 +/* "lightfm/_lightfm_fast_openmp.pyx":274 * * * cdef inline flt sigmoid(flt v) nogil: # <<<<<<<<<<<<<< @@ -4472,7 +4669,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_11FastLightFM_4__setst static CYTHON_INLINE __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_f_7lightfm_20_lightfm_fast_openmp_sigmoid(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_v_v) { __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_r; - /* "lightfm/_lightfm_fast_openmp.pyx":273 + /* "lightfm/_lightfm_fast_openmp.pyx":279 * """ * * return 1.0 / (1.0 + exp(-v)) # <<<<<<<<<<<<<< @@ -4482,7 +4679,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_f_7lightf __pyx_r = (1.0 / (1.0 + exp((-__pyx_v_v)))); goto __pyx_L0; - /* "lightfm/_lightfm_fast_openmp.pyx":268 + /* "lightfm/_lightfm_fast_openmp.pyx":274 * * * cdef inline flt sigmoid(flt v) nogil: # <<<<<<<<<<<<<< @@ -4495,7 +4692,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_f_7lightf return __pyx_r; } -/* "lightfm/_lightfm_fast_openmp.pyx":276 +/* "lightfm/_lightfm_fast_openmp.pyx":282 * * * cdef inline int in_positives(int item_id, int user_id, CSRMatrix interactions) nogil: # <<<<<<<<<<<<<< @@ -4510,7 +4707,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(in Py_ssize_t __pyx_t_1; int __pyx_t_2; - /* "lightfm/_lightfm_fast_openmp.pyx":280 + /* "lightfm/_lightfm_fast_openmp.pyx":286 * cdef int i, start_idx, stop_idx * * start_idx = interactions.get_row_start(user_id) # <<<<<<<<<<<<<< @@ -4519,7 +4716,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(in */ __pyx_v_start_idx = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_interactions->__pyx_vtab)->get_row_start(__pyx_v_interactions, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_openmp.pyx":281 + /* "lightfm/_lightfm_fast_openmp.pyx":287 * * start_idx = interactions.get_row_start(user_id) * stop_idx = interactions.get_row_end(user_id) # <<<<<<<<<<<<<< @@ -4528,7 +4725,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(in */ __pyx_v_stop_idx = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_interactions->__pyx_vtab)->get_row_end(__pyx_v_interactions, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_openmp.pyx":284 + /* "lightfm/_lightfm_fast_openmp.pyx":290 * * if bsearch(&item_id, * &interactions.indices[start_idx], # <<<<<<<<<<<<<< @@ -4537,7 +4734,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(in */ __pyx_t_1 = __pyx_v_start_idx; - /* "lightfm/_lightfm_fast_openmp.pyx":287 + /* "lightfm/_lightfm_fast_openmp.pyx":293 * stop_idx - start_idx, * sizeof(int), * int_compare) == NULL: # <<<<<<<<<<<<<< @@ -4546,7 +4743,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(in */ __pyx_t_2 = ((bsearch((&__pyx_v_item_id), (&(*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_interactions->indices.data) + __pyx_t_1)) )))), (__pyx_v_stop_idx - __pyx_v_start_idx), (sizeof(int)), __pyx_f_7lightfm_20_lightfm_fast_openmp_int_compare) == NULL) != 0); - /* "lightfm/_lightfm_fast_openmp.pyx":283 + /* "lightfm/_lightfm_fast_openmp.pyx":289 * stop_idx = interactions.get_row_end(user_id) * * if bsearch(&item_id, # <<<<<<<<<<<<<< @@ -4555,7 +4752,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(in */ if (__pyx_t_2) { - /* "lightfm/_lightfm_fast_openmp.pyx":288 + /* "lightfm/_lightfm_fast_openmp.pyx":294 * sizeof(int), * int_compare) == NULL: * return 0 # <<<<<<<<<<<<<< @@ -4565,7 +4762,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(in __pyx_r = 0; goto __pyx_L0; - /* "lightfm/_lightfm_fast_openmp.pyx":283 + /* "lightfm/_lightfm_fast_openmp.pyx":289 * stop_idx = interactions.get_row_end(user_id) * * if bsearch(&item_id, # <<<<<<<<<<<<<< @@ -4574,7 +4771,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(in */ } - /* "lightfm/_lightfm_fast_openmp.pyx":290 + /* "lightfm/_lightfm_fast_openmp.pyx":296 * return 0 * else: * return 1 # <<<<<<<<<<<<<< @@ -4586,7 +4783,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(in goto __pyx_L0; } - /* "lightfm/_lightfm_fast_openmp.pyx":276 + /* "lightfm/_lightfm_fast_openmp.pyx":282 * * * cdef inline int in_positives(int item_id, int user_id, CSRMatrix interactions) nogil: # <<<<<<<<<<<<<< @@ -4599,7 +4796,7 @@ static CYTHON_INLINE int __pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(in return __pyx_r; } -/* "lightfm/_lightfm_fast_openmp.pyx":293 +/* "lightfm/_lightfm_fast_openmp.pyx":299 * * * cdef inline void compute_representation(CSRMatrix features, # <<<<<<<<<<<<<< @@ -4620,16 +4817,13 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_repres int __pyx_t_4; int __pyx_t_5; Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; + int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; int __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; + Py_ssize_t __pyx_t_11; - /* "lightfm/_lightfm_fast_openmp.pyx":308 + /* "lightfm/_lightfm_fast_openmp.pyx":314 * cdef flt feature_weight * * start_index = features.get_row_start(row_id) # <<<<<<<<<<<<<< @@ -4638,7 +4832,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_repres */ __pyx_v_start_index = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_features->__pyx_vtab)->get_row_start(__pyx_v_features, __pyx_v_row_id); - /* "lightfm/_lightfm_fast_openmp.pyx":309 + /* "lightfm/_lightfm_fast_openmp.pyx":315 * * start_index = features.get_row_start(row_id) * stop_index = features.get_row_end(row_id) # <<<<<<<<<<<<<< @@ -4647,7 +4841,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_repres */ __pyx_v_stop_index = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_features->__pyx_vtab)->get_row_end(__pyx_v_features, __pyx_v_row_id); - /* "lightfm/_lightfm_fast_openmp.pyx":311 + /* "lightfm/_lightfm_fast_openmp.pyx":317 * stop_index = features.get_row_end(row_id) * * for i in range(lightfm.no_components + 1): # <<<<<<<<<<<<<< @@ -4659,7 +4853,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_repres for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "lightfm/_lightfm_fast_openmp.pyx":312 + /* "lightfm/_lightfm_fast_openmp.pyx":318 * * for i in range(lightfm.no_components + 1): * representation[i] = 0.0 # <<<<<<<<<<<<<< @@ -4669,7 +4863,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_repres (__pyx_v_representation[__pyx_v_i]) = 0.0; } - /* "lightfm/_lightfm_fast_openmp.pyx":314 + /* "lightfm/_lightfm_fast_openmp.pyx":320 * representation[i] = 0.0 * * for i in range(start_index, stop_index): # <<<<<<<<<<<<<< @@ -4681,7 +4875,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_repres for (__pyx_t_5 = __pyx_v_start_index; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "lightfm/_lightfm_fast_openmp.pyx":316 + /* "lightfm/_lightfm_fast_openmp.pyx":322 * for i in range(start_index, stop_index): * * feature = features.indices[i] # <<<<<<<<<<<<<< @@ -4691,54 +4885,54 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_repres __pyx_t_6 = __pyx_v_i; __pyx_v_feature = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_features->indices.data) + __pyx_t_6)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":317 + /* "lightfm/_lightfm_fast_openmp.pyx":323 * * feature = features.indices[i] * feature_weight = features.data[i] * scale # <<<<<<<<<<<<<< * * for j in range(lightfm.no_components): */ - __pyx_t_7 = __pyx_v_i; - __pyx_v_feature_weight = ((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_features->data.data) + __pyx_t_7)) ))) * __pyx_v_scale); + __pyx_t_6 = __pyx_v_i; + __pyx_v_feature_weight = ((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_features->data.data) + __pyx_t_6)) ))) * __pyx_v_scale); - /* "lightfm/_lightfm_fast_openmp.pyx":319 + /* "lightfm/_lightfm_fast_openmp.pyx":325 * feature_weight = features.data[i] * scale * * for j in range(lightfm.no_components): # <<<<<<<<<<<<<< * * representation[j] += feature_weight * feature_embeddings[feature, j] */ - __pyx_t_8 = __pyx_v_lightfm->no_components; - __pyx_t_9 = __pyx_t_8; - for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { - __pyx_v_j = __pyx_t_10; + __pyx_t_7 = __pyx_v_lightfm->no_components; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_j = __pyx_t_9; - /* "lightfm/_lightfm_fast_openmp.pyx":321 + /* "lightfm/_lightfm_fast_openmp.pyx":327 * for j in range(lightfm.no_components): * * representation[j] += feature_weight * feature_embeddings[feature, j] # <<<<<<<<<<<<<< * * representation[lightfm.no_components] += feature_weight * feature_biases[feature] */ + __pyx_t_10 = __pyx_v_j; + __pyx_t_6 = __pyx_v_feature; __pyx_t_11 = __pyx_v_j; - __pyx_t_12 = __pyx_v_feature; - __pyx_t_13 = __pyx_v_j; - (__pyx_v_representation[__pyx_t_11]) = ((__pyx_v_representation[__pyx_t_11]) + (__pyx_v_feature_weight * (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_feature_embeddings.data + __pyx_t_12 * __pyx_v_feature_embeddings.strides[0]) )) + __pyx_t_13)) ))))); + (__pyx_v_representation[__pyx_t_10]) = ((__pyx_v_representation[__pyx_t_10]) + (__pyx_v_feature_weight * (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_feature_embeddings.data + __pyx_t_6 * __pyx_v_feature_embeddings.strides[0]) )) + __pyx_t_11)) ))))); } - /* "lightfm/_lightfm_fast_openmp.pyx":323 + /* "lightfm/_lightfm_fast_openmp.pyx":329 * representation[j] += feature_weight * feature_embeddings[feature, j] * * representation[lightfm.no_components] += feature_weight * feature_biases[feature] # <<<<<<<<<<<<<< * * */ - __pyx_t_8 = __pyx_v_lightfm->no_components; - __pyx_t_14 = __pyx_v_feature; - (__pyx_v_representation[__pyx_t_8]) = ((__pyx_v_representation[__pyx_t_8]) + (__pyx_v_feature_weight * (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_feature_biases.data) + __pyx_t_14)) ))))); + __pyx_t_7 = __pyx_v_lightfm->no_components; + __pyx_t_11 = __pyx_v_feature; + (__pyx_v_representation[__pyx_t_7]) = ((__pyx_v_representation[__pyx_t_7]) + (__pyx_v_feature_weight * (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_feature_biases.data) + __pyx_t_11)) ))))); } - /* "lightfm/_lightfm_fast_openmp.pyx":293 + /* "lightfm/_lightfm_fast_openmp.pyx":299 * * * cdef inline void compute_representation(CSRMatrix features, # <<<<<<<<<<<<<< @@ -4749,7 +4943,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_repres /* function exit code */ } -/* "lightfm/_lightfm_fast_openmp.pyx":326 +/* "lightfm/_lightfm_fast_openmp.pyx":332 * * * cdef inline flt compute_prediction_from_repr(flt *user_repr, # <<<<<<<<<<<<<< @@ -4765,7 +4959,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_f_7lightf int __pyx_t_2; int __pyx_t_3; - /* "lightfm/_lightfm_fast_openmp.pyx":334 + /* "lightfm/_lightfm_fast_openmp.pyx":340 * * # Biases * result = user_repr[no_components] + item_repr[no_components] # <<<<<<<<<<<<<< @@ -4774,7 +4968,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_f_7lightf */ __pyx_v_result = ((__pyx_v_user_repr[__pyx_v_no_components]) + (__pyx_v_item_repr[__pyx_v_no_components])); - /* "lightfm/_lightfm_fast_openmp.pyx":337 + /* "lightfm/_lightfm_fast_openmp.pyx":343 * * # Latent factor dot product * for i in range(no_components): # <<<<<<<<<<<<<< @@ -4786,7 +4980,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_f_7lightf for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "lightfm/_lightfm_fast_openmp.pyx":338 + /* "lightfm/_lightfm_fast_openmp.pyx":344 * # Latent factor dot product * for i in range(no_components): * result += user_repr[i] * item_repr[i] # <<<<<<<<<<<<<< @@ -4796,7 +4990,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_f_7lightf __pyx_v_result = (__pyx_v_result + ((__pyx_v_user_repr[__pyx_v_i]) * (__pyx_v_item_repr[__pyx_v_i]))); } - /* "lightfm/_lightfm_fast_openmp.pyx":340 + /* "lightfm/_lightfm_fast_openmp.pyx":346 * result += user_repr[i] * item_repr[i] * * return result # <<<<<<<<<<<<<< @@ -4806,7 +5000,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_f_7lightf __pyx_r = __pyx_v_result; goto __pyx_L0; - /* "lightfm/_lightfm_fast_openmp.pyx":326 + /* "lightfm/_lightfm_fast_openmp.pyx":332 * * * cdef inline flt compute_prediction_from_repr(flt *user_repr, # <<<<<<<<<<<<<< @@ -4819,7 +5013,7 @@ static CYTHON_INLINE __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_f_7lightf return __pyx_r; } -/* "lightfm/_lightfm_fast_openmp.pyx":343 +/* "lightfm/_lightfm_fast_openmp.pyx":349 * * * cdef double update_biases(CSRMatrix feature_indices, # <<<<<<<<<<<<<< @@ -4841,22 +5035,8 @@ static double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(struct __pyx int __pyx_t_4; Py_ssize_t __pyx_t_5; Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - /* "lightfm/_lightfm_fast_openmp.pyx":362 + /* "lightfm/_lightfm_fast_openmp.pyx":368 * cdef double feature_weight, local_learning_rate, sum_learning_rate, update * * sum_learning_rate = 0.0 # <<<<<<<<<<<<<< @@ -4865,7 +5045,7 @@ static double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(struct __pyx */ __pyx_v_sum_learning_rate = 0.0; - /* "lightfm/_lightfm_fast_openmp.pyx":364 + /* "lightfm/_lightfm_fast_openmp.pyx":370 * sum_learning_rate = 0.0 * * if adadelta: # <<<<<<<<<<<<<< @@ -4875,7 +5055,7 @@ static double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(struct __pyx __pyx_t_1 = (__pyx_v_adadelta != 0); if (__pyx_t_1) { - /* "lightfm/_lightfm_fast_openmp.pyx":365 + /* "lightfm/_lightfm_fast_openmp.pyx":371 * * if adadelta: * for i in range(start, stop): # <<<<<<<<<<<<<< @@ -4887,7 +5067,7 @@ static double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(struct __pyx for (__pyx_t_4 = __pyx_v_start; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "lightfm/_lightfm_fast_openmp.pyx":367 + /* "lightfm/_lightfm_fast_openmp.pyx":373 * for i in range(start, stop): * * feature = feature_indices.indices[i] # <<<<<<<<<<<<<< @@ -4897,39 +5077,39 @@ static double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(struct __pyx __pyx_t_5 = __pyx_v_i; __pyx_v_feature = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_feature_indices->indices.data) + __pyx_t_5)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":368 + /* "lightfm/_lightfm_fast_openmp.pyx":374 * * feature = feature_indices.indices[i] * feature_weight = feature_indices.data[i] # <<<<<<<<<<<<<< * * gradients[feature] = rho * gradients[feature] + (1 - rho) * (feature_weight * gradient) ** 2 */ - __pyx_t_6 = __pyx_v_i; - __pyx_v_feature_weight = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_6)) ))); + __pyx_t_5 = __pyx_v_i; + __pyx_v_feature_weight = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_5)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":370 + /* "lightfm/_lightfm_fast_openmp.pyx":376 * feature_weight = feature_indices.data[i] * * gradients[feature] = rho * gradients[feature] + (1 - rho) * (feature_weight * gradient) ** 2 # <<<<<<<<<<<<<< * local_learning_rate = sqrt(momentum[feature] + eps) / sqrt(gradients[feature] + eps) * update = local_learning_rate * gradient * feature_weight */ - __pyx_t_7 = __pyx_v_feature; - __pyx_t_8 = __pyx_v_feature; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_8)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_7)) )))) + ((1.0 - __pyx_v_rho) * pow((__pyx_v_feature_weight * __pyx_v_gradient), 2.0))); + __pyx_t_5 = __pyx_v_feature; + __pyx_t_6 = __pyx_v_feature; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_6)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_5)) )))) + ((1.0 - __pyx_v_rho) * pow((__pyx_v_feature_weight * __pyx_v_gradient), 2.0))); - /* "lightfm/_lightfm_fast_openmp.pyx":371 + /* "lightfm/_lightfm_fast_openmp.pyx":377 * * gradients[feature] = rho * gradients[feature] + (1 - rho) * (feature_weight * gradient) ** 2 * local_learning_rate = sqrt(momentum[feature] + eps) / sqrt(gradients[feature] + eps) # <<<<<<<<<<<<<< * update = local_learning_rate * gradient * feature_weight * momentum[feature] = rho * momentum[feature] + (1 - rho) * update ** 2 */ - __pyx_t_9 = __pyx_v_feature; - __pyx_t_10 = __pyx_v_feature; - __pyx_v_local_learning_rate = (sqrt(((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_momentum.data) + __pyx_t_9)) ))) + __pyx_v_eps)) / sqrt(((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_10)) ))) + __pyx_v_eps))); + __pyx_t_5 = __pyx_v_feature; + __pyx_t_6 = __pyx_v_feature; + __pyx_v_local_learning_rate = (sqrt(((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_momentum.data) + __pyx_t_5)) ))) + __pyx_v_eps)) / sqrt(((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_6)) ))) + __pyx_v_eps))); - /* "lightfm/_lightfm_fast_openmp.pyx":372 + /* "lightfm/_lightfm_fast_openmp.pyx":378 * gradients[feature] = rho * gradients[feature] + (1 - rho) * (feature_weight * gradient) ** 2 * local_learning_rate = sqrt(momentum[feature] + eps) / sqrt(gradients[feature] + eps) * update = local_learning_rate * gradient * feature_weight # <<<<<<<<<<<<<< @@ -4938,38 +5118,38 @@ static double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(struct __pyx */ __pyx_v_update = ((__pyx_v_local_learning_rate * __pyx_v_gradient) * __pyx_v_feature_weight); - /* "lightfm/_lightfm_fast_openmp.pyx":373 + /* "lightfm/_lightfm_fast_openmp.pyx":379 * local_learning_rate = sqrt(momentum[feature] + eps) / sqrt(gradients[feature] + eps) * update = local_learning_rate * gradient * feature_weight * momentum[feature] = rho * momentum[feature] + (1 - rho) * update ** 2 # <<<<<<<<<<<<<< * biases[feature] -= update * */ - __pyx_t_11 = __pyx_v_feature; - __pyx_t_12 = __pyx_v_feature; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_momentum.data) + __pyx_t_12)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_momentum.data) + __pyx_t_11)) )))) + ((1.0 - __pyx_v_rho) * pow(__pyx_v_update, 2.0))); + __pyx_t_6 = __pyx_v_feature; + __pyx_t_5 = __pyx_v_feature; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_momentum.data) + __pyx_t_5)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_momentum.data) + __pyx_t_6)) )))) + ((1.0 - __pyx_v_rho) * pow(__pyx_v_update, 2.0))); - /* "lightfm/_lightfm_fast_openmp.pyx":374 + /* "lightfm/_lightfm_fast_openmp.pyx":380 * update = local_learning_rate * gradient * feature_weight * momentum[feature] = rho * momentum[feature] + (1 - rho) * update ** 2 * biases[feature] -= update # <<<<<<<<<<<<<< * * # Lazy regularization: scale up by the regularization */ - __pyx_t_13 = __pyx_v_feature; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_biases.data) + __pyx_t_13)) )) -= __pyx_v_update; + __pyx_t_6 = __pyx_v_feature; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_biases.data) + __pyx_t_6)) )) -= __pyx_v_update; - /* "lightfm/_lightfm_fast_openmp.pyx":378 + /* "lightfm/_lightfm_fast_openmp.pyx":384 * # Lazy regularization: scale up by the regularization * # parameter. * biases[feature] *= (1.0 + alpha * local_learning_rate) # <<<<<<<<<<<<<< * * sum_learning_rate += local_learning_rate */ - __pyx_t_14 = __pyx_v_feature; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_biases.data) + __pyx_t_14)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); + __pyx_t_6 = __pyx_v_feature; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_biases.data) + __pyx_t_6)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); - /* "lightfm/_lightfm_fast_openmp.pyx":380 + /* "lightfm/_lightfm_fast_openmp.pyx":386 * biases[feature] *= (1.0 + alpha * local_learning_rate) * * sum_learning_rate += local_learning_rate # <<<<<<<<<<<<<< @@ -4979,7 +5159,7 @@ static double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(struct __pyx __pyx_v_sum_learning_rate = (__pyx_v_sum_learning_rate + __pyx_v_local_learning_rate); } - /* "lightfm/_lightfm_fast_openmp.pyx":364 + /* "lightfm/_lightfm_fast_openmp.pyx":370 * sum_learning_rate = 0.0 * * if adadelta: # <<<<<<<<<<<<<< @@ -4989,7 +5169,7 @@ static double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(struct __pyx goto __pyx_L3; } - /* "lightfm/_lightfm_fast_openmp.pyx":382 + /* "lightfm/_lightfm_fast_openmp.pyx":388 * sum_learning_rate += local_learning_rate * else: * for i in range(start, stop): # <<<<<<<<<<<<<< @@ -5002,67 +5182,67 @@ static double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(struct __pyx for (__pyx_t_4 = __pyx_v_start; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "lightfm/_lightfm_fast_openmp.pyx":384 + /* "lightfm/_lightfm_fast_openmp.pyx":390 * for i in range(start, stop): * * feature = feature_indices.indices[i] # <<<<<<<<<<<<<< * feature_weight = feature_indices.data[i] * */ - __pyx_t_15 = __pyx_v_i; - __pyx_v_feature = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_feature_indices->indices.data) + __pyx_t_15)) ))); + __pyx_t_6 = __pyx_v_i; + __pyx_v_feature = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_feature_indices->indices.data) + __pyx_t_6)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":385 + /* "lightfm/_lightfm_fast_openmp.pyx":391 * * feature = feature_indices.indices[i] * feature_weight = feature_indices.data[i] # <<<<<<<<<<<<<< * * local_learning_rate = learning_rate / sqrt(gradients[feature]) */ - __pyx_t_16 = __pyx_v_i; - __pyx_v_feature_weight = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_16)) ))); + __pyx_t_6 = __pyx_v_i; + __pyx_v_feature_weight = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_6)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":387 + /* "lightfm/_lightfm_fast_openmp.pyx":393 * feature_weight = feature_indices.data[i] * * local_learning_rate = learning_rate / sqrt(gradients[feature]) # <<<<<<<<<<<<<< * biases[feature] -= local_learning_rate * feature_weight * gradient * gradients[feature] += (gradient * feature_weight) ** 2 */ - __pyx_t_17 = __pyx_v_feature; - __pyx_v_local_learning_rate = (__pyx_v_learning_rate / sqrt((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_17)) ))))); + __pyx_t_6 = __pyx_v_feature; + __pyx_v_local_learning_rate = (__pyx_v_learning_rate / sqrt((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_6)) ))))); - /* "lightfm/_lightfm_fast_openmp.pyx":388 + /* "lightfm/_lightfm_fast_openmp.pyx":394 * * local_learning_rate = learning_rate / sqrt(gradients[feature]) * biases[feature] -= local_learning_rate * feature_weight * gradient # <<<<<<<<<<<<<< * gradients[feature] += (gradient * feature_weight) ** 2 * */ - __pyx_t_18 = __pyx_v_feature; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_biases.data) + __pyx_t_18)) )) -= ((__pyx_v_local_learning_rate * __pyx_v_feature_weight) * __pyx_v_gradient); + __pyx_t_6 = __pyx_v_feature; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_biases.data) + __pyx_t_6)) )) -= ((__pyx_v_local_learning_rate * __pyx_v_feature_weight) * __pyx_v_gradient); - /* "lightfm/_lightfm_fast_openmp.pyx":389 + /* "lightfm/_lightfm_fast_openmp.pyx":395 * local_learning_rate = learning_rate / sqrt(gradients[feature]) * biases[feature] -= local_learning_rate * feature_weight * gradient * gradients[feature] += (gradient * feature_weight) ** 2 # <<<<<<<<<<<<<< * * # Lazy regularization: scale up by the regularization */ - __pyx_t_19 = __pyx_v_feature; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_19)) )) += pow((__pyx_v_gradient * __pyx_v_feature_weight), 2.0); + __pyx_t_6 = __pyx_v_feature; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_gradients.data) + __pyx_t_6)) )) += pow((__pyx_v_gradient * __pyx_v_feature_weight), 2.0); - /* "lightfm/_lightfm_fast_openmp.pyx":393 + /* "lightfm/_lightfm_fast_openmp.pyx":399 * # Lazy regularization: scale up by the regularization * # parameter. * biases[feature] *= (1.0 + alpha * local_learning_rate) # <<<<<<<<<<<<<< * * sum_learning_rate += local_learning_rate */ - __pyx_t_20 = __pyx_v_feature; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_biases.data) + __pyx_t_20)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); + __pyx_t_6 = __pyx_v_feature; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_biases.data) + __pyx_t_6)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); - /* "lightfm/_lightfm_fast_openmp.pyx":395 + /* "lightfm/_lightfm_fast_openmp.pyx":401 * biases[feature] *= (1.0 + alpha * local_learning_rate) * * sum_learning_rate += local_learning_rate # <<<<<<<<<<<<<< @@ -5074,7 +5254,7 @@ static double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(struct __pyx } __pyx_L3:; - /* "lightfm/_lightfm_fast_openmp.pyx":397 + /* "lightfm/_lightfm_fast_openmp.pyx":403 * sum_learning_rate += local_learning_rate * * return sum_learning_rate # <<<<<<<<<<<<<< @@ -5084,7 +5264,7 @@ static double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(struct __pyx __pyx_r = __pyx_v_sum_learning_rate; goto __pyx_L0; - /* "lightfm/_lightfm_fast_openmp.pyx":343 + /* "lightfm/_lightfm_fast_openmp.pyx":349 * * * cdef double update_biases(CSRMatrix feature_indices, # <<<<<<<<<<<<<< @@ -5097,7 +5277,7 @@ static double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(struct __pyx return __pyx_r; } -/* "lightfm/_lightfm_fast_openmp.pyx":400 +/* "lightfm/_lightfm_fast_openmp.pyx":406 * * * cdef inline double update_features(CSRMatrix feature_indices, # <<<<<<<<<<<<<< @@ -5121,32 +5301,8 @@ static CYTHON_INLINE double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_featu Py_ssize_t __pyx_t_6; Py_ssize_t __pyx_t_7; Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - Py_ssize_t __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - Py_ssize_t __pyx_t_22; - Py_ssize_t __pyx_t_23; - Py_ssize_t __pyx_t_24; - Py_ssize_t __pyx_t_25; - Py_ssize_t __pyx_t_26; - Py_ssize_t __pyx_t_27; - Py_ssize_t __pyx_t_28; - Py_ssize_t __pyx_t_29; - Py_ssize_t __pyx_t_30; - Py_ssize_t __pyx_t_31; - Py_ssize_t __pyx_t_32; - - /* "lightfm/_lightfm_fast_openmp.pyx":420 + + /* "lightfm/_lightfm_fast_openmp.pyx":426 * cdef double feature_weight, local_learning_rate, sum_learning_rate, update * * sum_learning_rate = 0.0 # <<<<<<<<<<<<<< @@ -5155,7 +5311,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_featu */ __pyx_v_sum_learning_rate = 0.0; - /* "lightfm/_lightfm_fast_openmp.pyx":422 + /* "lightfm/_lightfm_fast_openmp.pyx":428 * sum_learning_rate = 0.0 * * if adadelta: # <<<<<<<<<<<<<< @@ -5165,7 +5321,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_featu __pyx_t_1 = (__pyx_v_adadelta != 0); if (__pyx_t_1) { - /* "lightfm/_lightfm_fast_openmp.pyx":423 + /* "lightfm/_lightfm_fast_openmp.pyx":429 * * if adadelta: * for i in range(start, stop): # <<<<<<<<<<<<<< @@ -5177,7 +5333,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_featu for (__pyx_t_4 = __pyx_v_start; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "lightfm/_lightfm_fast_openmp.pyx":425 + /* "lightfm/_lightfm_fast_openmp.pyx":431 * for i in range(start, stop): * * feature = feature_indices.indices[i] # <<<<<<<<<<<<<< @@ -5187,59 +5343,59 @@ static CYTHON_INLINE double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_featu __pyx_t_5 = __pyx_v_i; __pyx_v_feature = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_feature_indices->indices.data) + __pyx_t_5)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":426 + /* "lightfm/_lightfm_fast_openmp.pyx":432 * * feature = feature_indices.indices[i] * feature_weight = feature_indices.data[i] # <<<<<<<<<<<<<< * * gradients[feature, component] = (rho * gradients[feature, component] */ - __pyx_t_6 = __pyx_v_i; - __pyx_v_feature_weight = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_6)) ))); + __pyx_t_5 = __pyx_v_i; + __pyx_v_feature_weight = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_5)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":428 + /* "lightfm/_lightfm_fast_openmp.pyx":434 * feature_weight = feature_indices.data[i] * * gradients[feature, component] = (rho * gradients[feature, component] # <<<<<<<<<<<<<< * + (1 - rho) * (feature_weight * gradient) ** 2) * local_learning_rate = (sqrt(momentum[feature, component] + eps) */ - __pyx_t_7 = __pyx_v_feature; - __pyx_t_8 = __pyx_v_component; + __pyx_t_5 = __pyx_v_feature; + __pyx_t_6 = __pyx_v_component; - /* "lightfm/_lightfm_fast_openmp.pyx":429 + /* "lightfm/_lightfm_fast_openmp.pyx":435 * * gradients[feature, component] = (rho * gradients[feature, component] * + (1 - rho) * (feature_weight * gradient) ** 2) # <<<<<<<<<<<<<< * local_learning_rate = (sqrt(momentum[feature, component] + eps) * / sqrt(gradients[feature, component] + eps)) */ - __pyx_t_9 = __pyx_v_feature; - __pyx_t_10 = __pyx_v_component; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_9 * __pyx_v_gradients.strides[0]) )) + __pyx_t_10)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_7 * __pyx_v_gradients.strides[0]) )) + __pyx_t_8)) )))) + ((1.0 - __pyx_v_rho) * pow((__pyx_v_feature_weight * __pyx_v_gradient), 2.0))); + __pyx_t_7 = __pyx_v_feature; + __pyx_t_8 = __pyx_v_component; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_7 * __pyx_v_gradients.strides[0]) )) + __pyx_t_8)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_5 * __pyx_v_gradients.strides[0]) )) + __pyx_t_6)) )))) + ((1.0 - __pyx_v_rho) * pow((__pyx_v_feature_weight * __pyx_v_gradient), 2.0))); - /* "lightfm/_lightfm_fast_openmp.pyx":430 + /* "lightfm/_lightfm_fast_openmp.pyx":436 * gradients[feature, component] = (rho * gradients[feature, component] * + (1 - rho) * (feature_weight * gradient) ** 2) * local_learning_rate = (sqrt(momentum[feature, component] + eps) # <<<<<<<<<<<<<< * / sqrt(gradients[feature, component] + eps)) * update = local_learning_rate * gradient * feature_weight */ - __pyx_t_11 = __pyx_v_feature; - __pyx_t_12 = __pyx_v_component; + __pyx_t_6 = __pyx_v_feature; + __pyx_t_5 = __pyx_v_component; - /* "lightfm/_lightfm_fast_openmp.pyx":431 + /* "lightfm/_lightfm_fast_openmp.pyx":437 * + (1 - rho) * (feature_weight * gradient) ** 2) * local_learning_rate = (sqrt(momentum[feature, component] + eps) * / sqrt(gradients[feature, component] + eps)) # <<<<<<<<<<<<<< * update = local_learning_rate * gradient * feature_weight * momentum[feature, component] = rho * momentum[feature, component] + (1 - rho) * update ** 2 */ - __pyx_t_13 = __pyx_v_feature; - __pyx_t_14 = __pyx_v_component; - __pyx_v_local_learning_rate = (sqrt(((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_momentum.data + __pyx_t_11 * __pyx_v_momentum.strides[0]) )) + __pyx_t_12)) ))) + __pyx_v_eps)) / sqrt(((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_13 * __pyx_v_gradients.strides[0]) )) + __pyx_t_14)) ))) + __pyx_v_eps))); + __pyx_t_8 = __pyx_v_feature; + __pyx_t_7 = __pyx_v_component; + __pyx_v_local_learning_rate = (sqrt(((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_momentum.data + __pyx_t_6 * __pyx_v_momentum.strides[0]) )) + __pyx_t_5)) ))) + __pyx_v_eps)) / sqrt(((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_8 * __pyx_v_gradients.strides[0]) )) + __pyx_t_7)) ))) + __pyx_v_eps))); - /* "lightfm/_lightfm_fast_openmp.pyx":432 + /* "lightfm/_lightfm_fast_openmp.pyx":438 * local_learning_rate = (sqrt(momentum[feature, component] + eps) * / sqrt(gradients[feature, component] + eps)) * update = local_learning_rate * gradient * feature_weight # <<<<<<<<<<<<<< @@ -5248,42 +5404,42 @@ static CYTHON_INLINE double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_featu */ __pyx_v_update = ((__pyx_v_local_learning_rate * __pyx_v_gradient) * __pyx_v_feature_weight); - /* "lightfm/_lightfm_fast_openmp.pyx":433 + /* "lightfm/_lightfm_fast_openmp.pyx":439 * / sqrt(gradients[feature, component] + eps)) * update = local_learning_rate * gradient * feature_weight * momentum[feature, component] = rho * momentum[feature, component] + (1 - rho) * update ** 2 # <<<<<<<<<<<<<< * features[feature, component] -= update * */ - __pyx_t_15 = __pyx_v_feature; - __pyx_t_16 = __pyx_v_component; - __pyx_t_17 = __pyx_v_feature; - __pyx_t_18 = __pyx_v_component; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_momentum.data + __pyx_t_17 * __pyx_v_momentum.strides[0]) )) + __pyx_t_18)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_momentum.data + __pyx_t_15 * __pyx_v_momentum.strides[0]) )) + __pyx_t_16)) )))) + ((1.0 - __pyx_v_rho) * pow(__pyx_v_update, 2.0))); + __pyx_t_7 = __pyx_v_feature; + __pyx_t_8 = __pyx_v_component; + __pyx_t_5 = __pyx_v_feature; + __pyx_t_6 = __pyx_v_component; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_momentum.data + __pyx_t_5 * __pyx_v_momentum.strides[0]) )) + __pyx_t_6)) )) = ((__pyx_v_rho * (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_momentum.data + __pyx_t_7 * __pyx_v_momentum.strides[0]) )) + __pyx_t_8)) )))) + ((1.0 - __pyx_v_rho) * pow(__pyx_v_update, 2.0))); - /* "lightfm/_lightfm_fast_openmp.pyx":434 + /* "lightfm/_lightfm_fast_openmp.pyx":440 * update = local_learning_rate * gradient * feature_weight * momentum[feature, component] = rho * momentum[feature, component] + (1 - rho) * update ** 2 * features[feature, component] -= update # <<<<<<<<<<<<<< * * # Lazy regularization: scale up by the regularization */ - __pyx_t_19 = __pyx_v_feature; - __pyx_t_20 = __pyx_v_component; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_19 * __pyx_v_features.strides[0]) )) + __pyx_t_20)) )) -= __pyx_v_update; + __pyx_t_8 = __pyx_v_feature; + __pyx_t_7 = __pyx_v_component; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_8 * __pyx_v_features.strides[0]) )) + __pyx_t_7)) )) -= __pyx_v_update; - /* "lightfm/_lightfm_fast_openmp.pyx":438 + /* "lightfm/_lightfm_fast_openmp.pyx":444 * # Lazy regularization: scale up by the regularization * # parameter. * features[feature, component] *= (1.0 + alpha * local_learning_rate) # <<<<<<<<<<<<<< * * sum_learning_rate += local_learning_rate */ - __pyx_t_21 = __pyx_v_feature; - __pyx_t_22 = __pyx_v_component; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_21 * __pyx_v_features.strides[0]) )) + __pyx_t_22)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); + __pyx_t_7 = __pyx_v_feature; + __pyx_t_8 = __pyx_v_component; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_7 * __pyx_v_features.strides[0]) )) + __pyx_t_8)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); - /* "lightfm/_lightfm_fast_openmp.pyx":440 + /* "lightfm/_lightfm_fast_openmp.pyx":446 * features[feature, component] *= (1.0 + alpha * local_learning_rate) * * sum_learning_rate += local_learning_rate # <<<<<<<<<<<<<< @@ -5293,7 +5449,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_featu __pyx_v_sum_learning_rate = (__pyx_v_sum_learning_rate + __pyx_v_local_learning_rate); } - /* "lightfm/_lightfm_fast_openmp.pyx":422 + /* "lightfm/_lightfm_fast_openmp.pyx":428 * sum_learning_rate = 0.0 * * if adadelta: # <<<<<<<<<<<<<< @@ -5303,7 +5459,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_featu goto __pyx_L3; } - /* "lightfm/_lightfm_fast_openmp.pyx":442 + /* "lightfm/_lightfm_fast_openmp.pyx":448 * sum_learning_rate += local_learning_rate * else: * for i in range(start, stop): # <<<<<<<<<<<<<< @@ -5316,71 +5472,71 @@ static CYTHON_INLINE double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_featu for (__pyx_t_4 = __pyx_v_start; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_i = __pyx_t_4; - /* "lightfm/_lightfm_fast_openmp.pyx":444 + /* "lightfm/_lightfm_fast_openmp.pyx":450 * for i in range(start, stop): * * feature = feature_indices.indices[i] # <<<<<<<<<<<<<< * feature_weight = feature_indices.data[i] * */ - __pyx_t_23 = __pyx_v_i; - __pyx_v_feature = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_feature_indices->indices.data) + __pyx_t_23)) ))); + __pyx_t_8 = __pyx_v_i; + __pyx_v_feature = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_feature_indices->indices.data) + __pyx_t_8)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":445 + /* "lightfm/_lightfm_fast_openmp.pyx":451 * * feature = feature_indices.indices[i] * feature_weight = feature_indices.data[i] # <<<<<<<<<<<<<< * * local_learning_rate = learning_rate / sqrt(gradients[feature, component]) */ - __pyx_t_24 = __pyx_v_i; - __pyx_v_feature_weight = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_24)) ))); + __pyx_t_8 = __pyx_v_i; + __pyx_v_feature_weight = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_feature_indices->data.data) + __pyx_t_8)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":447 + /* "lightfm/_lightfm_fast_openmp.pyx":453 * feature_weight = feature_indices.data[i] * * local_learning_rate = learning_rate / sqrt(gradients[feature, component]) # <<<<<<<<<<<<<< * features[feature, component] -= local_learning_rate * feature_weight * gradient * gradients[feature, component] += (gradient * feature_weight) ** 2 */ - __pyx_t_25 = __pyx_v_feature; - __pyx_t_26 = __pyx_v_component; - __pyx_v_local_learning_rate = (__pyx_v_learning_rate / sqrt((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_25 * __pyx_v_gradients.strides[0]) )) + __pyx_t_26)) ))))); + __pyx_t_8 = __pyx_v_feature; + __pyx_t_7 = __pyx_v_component; + __pyx_v_local_learning_rate = (__pyx_v_learning_rate / sqrt((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_8 * __pyx_v_gradients.strides[0]) )) + __pyx_t_7)) ))))); - /* "lightfm/_lightfm_fast_openmp.pyx":448 + /* "lightfm/_lightfm_fast_openmp.pyx":454 * * local_learning_rate = learning_rate / sqrt(gradients[feature, component]) * features[feature, component] -= local_learning_rate * feature_weight * gradient # <<<<<<<<<<<<<< * gradients[feature, component] += (gradient * feature_weight) ** 2 * */ - __pyx_t_27 = __pyx_v_feature; - __pyx_t_28 = __pyx_v_component; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_27 * __pyx_v_features.strides[0]) )) + __pyx_t_28)) )) -= ((__pyx_v_local_learning_rate * __pyx_v_feature_weight) * __pyx_v_gradient); + __pyx_t_7 = __pyx_v_feature; + __pyx_t_8 = __pyx_v_component; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_7 * __pyx_v_features.strides[0]) )) + __pyx_t_8)) )) -= ((__pyx_v_local_learning_rate * __pyx_v_feature_weight) * __pyx_v_gradient); - /* "lightfm/_lightfm_fast_openmp.pyx":449 + /* "lightfm/_lightfm_fast_openmp.pyx":455 * local_learning_rate = learning_rate / sqrt(gradients[feature, component]) * features[feature, component] -= local_learning_rate * feature_weight * gradient * gradients[feature, component] += (gradient * feature_weight) ** 2 # <<<<<<<<<<<<<< * * # Lazy regularization: scale up by the regularization */ - __pyx_t_29 = __pyx_v_feature; - __pyx_t_30 = __pyx_v_component; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_29 * __pyx_v_gradients.strides[0]) )) + __pyx_t_30)) )) += pow((__pyx_v_gradient * __pyx_v_feature_weight), 2.0); + __pyx_t_8 = __pyx_v_feature; + __pyx_t_7 = __pyx_v_component; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_gradients.data + __pyx_t_8 * __pyx_v_gradients.strides[0]) )) + __pyx_t_7)) )) += pow((__pyx_v_gradient * __pyx_v_feature_weight), 2.0); - /* "lightfm/_lightfm_fast_openmp.pyx":453 + /* "lightfm/_lightfm_fast_openmp.pyx":459 * # Lazy regularization: scale up by the regularization * # parameter. * features[feature, component] *= (1.0 + alpha * local_learning_rate) # <<<<<<<<<<<<<< * * sum_learning_rate += local_learning_rate */ - __pyx_t_31 = __pyx_v_feature; - __pyx_t_32 = __pyx_v_component; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_31 * __pyx_v_features.strides[0]) )) + __pyx_t_32)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); + __pyx_t_7 = __pyx_v_feature; + __pyx_t_8 = __pyx_v_component; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_features.data + __pyx_t_7 * __pyx_v_features.strides[0]) )) + __pyx_t_8)) )) *= (1.0 + (__pyx_v_alpha * __pyx_v_local_learning_rate)); - /* "lightfm/_lightfm_fast_openmp.pyx":455 + /* "lightfm/_lightfm_fast_openmp.pyx":461 * features[feature, component] *= (1.0 + alpha * local_learning_rate) * * sum_learning_rate += local_learning_rate # <<<<<<<<<<<<<< @@ -5392,7 +5548,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_featu } __pyx_L3:; - /* "lightfm/_lightfm_fast_openmp.pyx":457 + /* "lightfm/_lightfm_fast_openmp.pyx":463 * sum_learning_rate += local_learning_rate * * return sum_learning_rate # <<<<<<<<<<<<<< @@ -5402,7 +5558,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_featu __pyx_r = __pyx_v_sum_learning_rate; goto __pyx_L0; - /* "lightfm/_lightfm_fast_openmp.pyx":400 + /* "lightfm/_lightfm_fast_openmp.pyx":406 * * * cdef inline double update_features(CSRMatrix feature_indices, # <<<<<<<<<<<<<< @@ -5415,7 +5571,7 @@ static CYTHON_INLINE double __pyx_f_7lightfm_20_lightfm_fast_openmp_update_featu return __pyx_r; } -/* "lightfm/_lightfm_fast_openmp.pyx":460 +/* "lightfm/_lightfm_fast_openmp.pyx":466 * * * cdef inline void update(double loss, # <<<<<<<<<<<<<< @@ -5436,7 +5592,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double int __pyx_t_2; int __pyx_t_3; - /* "lightfm/_lightfm_fast_openmp.pyx":478 + /* "lightfm/_lightfm_fast_openmp.pyx":484 * cdef flt item_component, user_component * * avg_learning_rate = 0.0 # <<<<<<<<<<<<<< @@ -5445,7 +5601,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double */ __pyx_v_avg_learning_rate = 0.0; - /* "lightfm/_lightfm_fast_openmp.pyx":482 + /* "lightfm/_lightfm_fast_openmp.pyx":488 * # Get the iteration ranges for features * # for this training example. * item_start_index = item_features.get_row_start(item_id) # <<<<<<<<<<<<<< @@ -5454,7 +5610,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double */ __pyx_v_item_start_index = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_item_features->__pyx_vtab)->get_row_start(__pyx_v_item_features, __pyx_v_item_id); - /* "lightfm/_lightfm_fast_openmp.pyx":483 + /* "lightfm/_lightfm_fast_openmp.pyx":489 * # for this training example. * item_start_index = item_features.get_row_start(item_id) * item_stop_index = item_features.get_row_end(item_id) # <<<<<<<<<<<<<< @@ -5463,7 +5619,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double */ __pyx_v_item_stop_index = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_item_features->__pyx_vtab)->get_row_end(__pyx_v_item_features, __pyx_v_item_id); - /* "lightfm/_lightfm_fast_openmp.pyx":485 + /* "lightfm/_lightfm_fast_openmp.pyx":491 * item_stop_index = item_features.get_row_end(item_id) * * user_start_index = user_features.get_row_start(user_id) # <<<<<<<<<<<<<< @@ -5472,7 +5628,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double */ __pyx_v_user_start_index = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_user_features->__pyx_vtab)->get_row_start(__pyx_v_user_features, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_openmp.pyx":486 + /* "lightfm/_lightfm_fast_openmp.pyx":492 * * user_start_index = user_features.get_row_start(user_id) * user_stop_index = user_features.get_row_end(user_id) # <<<<<<<<<<<<<< @@ -5481,7 +5637,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double */ __pyx_v_user_stop_index = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_user_features->__pyx_vtab)->get_row_end(__pyx_v_user_features, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_openmp.pyx":488 + /* "lightfm/_lightfm_fast_openmp.pyx":494 * user_stop_index = user_features.get_row_end(user_id) * * avg_learning_rate += update_biases(item_features, item_start_index, item_stop_index, # <<<<<<<<<<<<<< @@ -5490,7 +5646,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(__pyx_v_item_features, __pyx_v_item_start_index, __pyx_v_item_stop_index, __pyx_v_lightfm->item_biases, __pyx_v_lightfm->item_bias_gradients, __pyx_v_lightfm->item_bias_momentum, __pyx_v_loss, __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_item_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_openmp.pyx":497 + /* "lightfm/_lightfm_fast_openmp.pyx":503 * lightfm.rho, * lightfm.eps) * avg_learning_rate += update_biases(user_features, user_start_index, user_stop_index, # <<<<<<<<<<<<<< @@ -5499,7 +5655,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(__pyx_v_user_features, __pyx_v_user_start_index, __pyx_v_user_stop_index, __pyx_v_lightfm->user_biases, __pyx_v_lightfm->user_bias_gradients, __pyx_v_lightfm->user_bias_momentum, __pyx_v_loss, __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_user_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_openmp.pyx":508 + /* "lightfm/_lightfm_fast_openmp.pyx":514 * * # Update latent representations. * for i in range(lightfm.no_components): # <<<<<<<<<<<<<< @@ -5511,7 +5667,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "lightfm/_lightfm_fast_openmp.pyx":510 + /* "lightfm/_lightfm_fast_openmp.pyx":516 * for i in range(lightfm.no_components): * * user_component = user_repr[i] # <<<<<<<<<<<<<< @@ -5520,7 +5676,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double */ __pyx_v_user_component = (__pyx_v_user_repr[__pyx_v_i]); - /* "lightfm/_lightfm_fast_openmp.pyx":511 + /* "lightfm/_lightfm_fast_openmp.pyx":517 * * user_component = user_repr[i] * item_component = it_repr[i] # <<<<<<<<<<<<<< @@ -5529,7 +5685,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double */ __pyx_v_item_component = (__pyx_v_it_repr[__pyx_v_i]); - /* "lightfm/_lightfm_fast_openmp.pyx":513 + /* "lightfm/_lightfm_fast_openmp.pyx":519 * item_component = it_repr[i] * * avg_learning_rate += update_features(item_features, lightfm.item_features, # <<<<<<<<<<<<<< @@ -5538,7 +5694,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_20_lightfm_fast_openmp_update_features(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_feature_gradients, __pyx_v_lightfm->item_feature_momentum, __pyx_v_i, __pyx_v_item_start_index, __pyx_v_item_stop_index, (__pyx_v_loss * __pyx_v_user_component), __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_item_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_openmp.pyx":523 + /* "lightfm/_lightfm_fast_openmp.pyx":529 * lightfm.rho, * lightfm.eps) * avg_learning_rate += update_features(user_features, lightfm.user_features, # <<<<<<<<<<<<<< @@ -5548,7 +5704,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_20_lightfm_fast_openmp_update_features(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_feature_gradients, __pyx_v_lightfm->user_feature_momentum, __pyx_v_i, __pyx_v_user_start_index, __pyx_v_user_stop_index, (__pyx_v_loss * __pyx_v_item_component), __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_user_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); } - /* "lightfm/_lightfm_fast_openmp.pyx":534 + /* "lightfm/_lightfm_fast_openmp.pyx":540 * lightfm.eps) * * avg_learning_rate /= ((lightfm.no_components + 1) * (user_stop_index - user_start_index) # <<<<<<<<<<<<<< @@ -5557,7 +5713,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate / (((__pyx_v_lightfm->no_components + 1) * (__pyx_v_user_stop_index - __pyx_v_user_start_index)) + ((__pyx_v_lightfm->no_components + 1) * (__pyx_v_item_stop_index - __pyx_v_item_start_index)))); - /* "lightfm/_lightfm_fast_openmp.pyx":539 + /* "lightfm/_lightfm_fast_openmp.pyx":545 * # Update the scaling factors for lazy regularization, using the average learning rate * # of features updated for this example. * lightfm.item_scale *= (1.0 + item_alpha * avg_learning_rate) # <<<<<<<<<<<<<< @@ -5566,16 +5722,34 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double */ __pyx_v_lightfm->item_scale = (__pyx_v_lightfm->item_scale * (1.0 + (__pyx_v_item_alpha * __pyx_v_avg_learning_rate))); - /* "lightfm/_lightfm_fast_openmp.pyx":540 + /* "lightfm/_lightfm_fast_openmp.pyx":546 * # of features updated for this example. * lightfm.item_scale *= (1.0 + item_alpha * avg_learning_rate) * lightfm.user_scale *= (1.0 + user_alpha * avg_learning_rate) # <<<<<<<<<<<<<< * - * + * lightfm.avg_loss_ctr += 1 */ __pyx_v_lightfm->user_scale = (__pyx_v_lightfm->user_scale * (1.0 + (__pyx_v_user_alpha * __pyx_v_avg_learning_rate))); - /* "lightfm/_lightfm_fast_openmp.pyx":460 + /* "lightfm/_lightfm_fast_openmp.pyx":548 + * lightfm.user_scale *= (1.0 + user_alpha * avg_learning_rate) + * + * lightfm.avg_loss_ctr += 1 # <<<<<<<<<<<<<< + * lightfm.avg_loss = (lightfm.avg_loss * (lightfm.avg_loss_ctr - 1) + loss) / lightfm.avg_loss_ctr + * + */ + __pyx_v_lightfm->avg_loss_ctr = (__pyx_v_lightfm->avg_loss_ctr + 1); + + /* "lightfm/_lightfm_fast_openmp.pyx":549 + * + * lightfm.avg_loss_ctr += 1 + * lightfm.avg_loss = (lightfm.avg_loss * (lightfm.avg_loss_ctr - 1) + loss) / lightfm.avg_loss_ctr # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_lightfm->avg_loss = (((__pyx_v_lightfm->avg_loss * (__pyx_v_lightfm->avg_loss_ctr - 1)) + __pyx_v_loss) / __pyx_v_lightfm->avg_loss_ctr); + + /* "lightfm/_lightfm_fast_openmp.pyx":466 * * * cdef inline void update(double loss, # <<<<<<<<<<<<<< @@ -5586,7 +5760,7 @@ static CYTHON_INLINE void __pyx_f_7lightfm_20_lightfm_fast_openmp_update(double /* function exit code */ } -/* "lightfm/_lightfm_fast_openmp.pyx":543 +/* "lightfm/_lightfm_fast_openmp.pyx":552 * * * cdef void warp_update(double loss, # <<<<<<<<<<<<<< @@ -5610,7 +5784,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l int __pyx_t_2; int __pyx_t_3; - /* "lightfm/_lightfm_fast_openmp.pyx":564 + /* "lightfm/_lightfm_fast_openmp.pyx":573 * cdef flt positive_item_component, negative_item_component, user_component * * avg_learning_rate = 0.0 # <<<<<<<<<<<<<< @@ -5619,7 +5793,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_avg_learning_rate = 0.0; - /* "lightfm/_lightfm_fast_openmp.pyx":568 + /* "lightfm/_lightfm_fast_openmp.pyx":577 * # Get the iteration ranges for features * # for this training example. * positive_item_start_index = item_features.get_row_start(positive_item_id) # <<<<<<<<<<<<<< @@ -5628,7 +5802,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_positive_item_start_index = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_item_features->__pyx_vtab)->get_row_start(__pyx_v_item_features, __pyx_v_positive_item_id); - /* "lightfm/_lightfm_fast_openmp.pyx":569 + /* "lightfm/_lightfm_fast_openmp.pyx":578 * # for this training example. * positive_item_start_index = item_features.get_row_start(positive_item_id) * positive_item_stop_index = item_features.get_row_end(positive_item_id) # <<<<<<<<<<<<<< @@ -5637,7 +5811,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_positive_item_stop_index = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_item_features->__pyx_vtab)->get_row_end(__pyx_v_item_features, __pyx_v_positive_item_id); - /* "lightfm/_lightfm_fast_openmp.pyx":571 + /* "lightfm/_lightfm_fast_openmp.pyx":580 * positive_item_stop_index = item_features.get_row_end(positive_item_id) * * negative_item_start_index = item_features.get_row_start(negative_item_id) # <<<<<<<<<<<<<< @@ -5646,7 +5820,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_negative_item_start_index = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_item_features->__pyx_vtab)->get_row_start(__pyx_v_item_features, __pyx_v_negative_item_id); - /* "lightfm/_lightfm_fast_openmp.pyx":572 + /* "lightfm/_lightfm_fast_openmp.pyx":581 * * negative_item_start_index = item_features.get_row_start(negative_item_id) * negative_item_stop_index = item_features.get_row_end(negative_item_id) # <<<<<<<<<<<<<< @@ -5655,7 +5829,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_negative_item_stop_index = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_item_features->__pyx_vtab)->get_row_end(__pyx_v_item_features, __pyx_v_negative_item_id); - /* "lightfm/_lightfm_fast_openmp.pyx":574 + /* "lightfm/_lightfm_fast_openmp.pyx":583 * negative_item_stop_index = item_features.get_row_end(negative_item_id) * * user_start_index = user_features.get_row_start(user_id) # <<<<<<<<<<<<<< @@ -5664,7 +5838,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_user_start_index = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_user_features->__pyx_vtab)->get_row_start(__pyx_v_user_features, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_openmp.pyx":575 + /* "lightfm/_lightfm_fast_openmp.pyx":584 * * user_start_index = user_features.get_row_start(user_id) * user_stop_index = user_features.get_row_end(user_id) # <<<<<<<<<<<<<< @@ -5673,7 +5847,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_user_stop_index = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_user_features->__pyx_vtab)->get_row_end(__pyx_v_user_features, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_openmp.pyx":577 + /* "lightfm/_lightfm_fast_openmp.pyx":586 * user_stop_index = user_features.get_row_end(user_id) * * avg_learning_rate += update_biases(item_features, positive_item_start_index, # <<<<<<<<<<<<<< @@ -5682,7 +5856,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(__pyx_v_item_features, __pyx_v_positive_item_start_index, __pyx_v_positive_item_stop_index, __pyx_v_lightfm->item_biases, __pyx_v_lightfm->item_bias_gradients, __pyx_v_lightfm->item_bias_momentum, (-__pyx_v_loss), __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_item_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_openmp.pyx":587 + /* "lightfm/_lightfm_fast_openmp.pyx":596 * lightfm.rho, * lightfm.eps) * avg_learning_rate += update_biases(item_features, negative_item_start_index, # <<<<<<<<<<<<<< @@ -5691,7 +5865,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(__pyx_v_item_features, __pyx_v_negative_item_start_index, __pyx_v_negative_item_stop_index, __pyx_v_lightfm->item_biases, __pyx_v_lightfm->item_bias_gradients, __pyx_v_lightfm->item_bias_momentum, __pyx_v_loss, __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_item_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_openmp.pyx":597 + /* "lightfm/_lightfm_fast_openmp.pyx":606 * lightfm.rho, * lightfm.eps) * avg_learning_rate += update_biases(user_features, user_start_index, user_stop_index, # <<<<<<<<<<<<<< @@ -5700,7 +5874,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_20_lightfm_fast_openmp_update_biases(__pyx_v_user_features, __pyx_v_user_start_index, __pyx_v_user_stop_index, __pyx_v_lightfm->user_biases, __pyx_v_lightfm->user_bias_gradients, __pyx_v_lightfm->user_bias_momentum, __pyx_v_loss, __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_user_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_openmp.pyx":608 + /* "lightfm/_lightfm_fast_openmp.pyx":617 * * # Update latent representations. * for i in range(lightfm.no_components): # <<<<<<<<<<<<<< @@ -5712,7 +5886,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "lightfm/_lightfm_fast_openmp.pyx":610 + /* "lightfm/_lightfm_fast_openmp.pyx":619 * for i in range(lightfm.no_components): * * user_component = user_repr[i] # <<<<<<<<<<<<<< @@ -5721,7 +5895,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_user_component = (__pyx_v_user_repr[__pyx_v_i]); - /* "lightfm/_lightfm_fast_openmp.pyx":611 + /* "lightfm/_lightfm_fast_openmp.pyx":620 * * user_component = user_repr[i] * positive_item_component = pos_it_repr[i] # <<<<<<<<<<<<<< @@ -5730,7 +5904,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_positive_item_component = (__pyx_v_pos_it_repr[__pyx_v_i]); - /* "lightfm/_lightfm_fast_openmp.pyx":612 + /* "lightfm/_lightfm_fast_openmp.pyx":621 * user_component = user_repr[i] * positive_item_component = pos_it_repr[i] * negative_item_component = neg_it_repr[i] # <<<<<<<<<<<<<< @@ -5739,7 +5913,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_negative_item_component = (__pyx_v_neg_it_repr[__pyx_v_i]); - /* "lightfm/_lightfm_fast_openmp.pyx":614 + /* "lightfm/_lightfm_fast_openmp.pyx":623 * negative_item_component = neg_it_repr[i] * * avg_learning_rate += update_features(item_features, lightfm.item_features, # <<<<<<<<<<<<<< @@ -5748,7 +5922,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_20_lightfm_fast_openmp_update_features(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_feature_gradients, __pyx_v_lightfm->item_feature_momentum, __pyx_v_i, __pyx_v_positive_item_start_index, __pyx_v_positive_item_stop_index, ((-__pyx_v_loss) * __pyx_v_user_component), __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_item_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_openmp.pyx":624 + /* "lightfm/_lightfm_fast_openmp.pyx":633 * lightfm.rho, * lightfm.eps) * avg_learning_rate += update_features(item_features, lightfm.item_features, # <<<<<<<<<<<<<< @@ -5757,7 +5931,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_20_lightfm_fast_openmp_update_features(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_feature_gradients, __pyx_v_lightfm->item_feature_momentum, __pyx_v_i, __pyx_v_negative_item_start_index, __pyx_v_negative_item_stop_index, (__pyx_v_loss * __pyx_v_user_component), __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_item_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); - /* "lightfm/_lightfm_fast_openmp.pyx":634 + /* "lightfm/_lightfm_fast_openmp.pyx":643 * lightfm.rho, * lightfm.eps) * avg_learning_rate += update_features(user_features, lightfm.user_features, # <<<<<<<<<<<<<< @@ -5767,7 +5941,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate + __pyx_f_7lightfm_20_lightfm_fast_openmp_update_features(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_feature_gradients, __pyx_v_lightfm->user_feature_momentum, __pyx_v_i, __pyx_v_user_start_index, __pyx_v_user_stop_index, (__pyx_v_loss * (__pyx_v_negative_item_component - __pyx_v_positive_item_component)), __pyx_v_lightfm->adadelta, __pyx_v_lightfm->learning_rate, __pyx_v_user_alpha, __pyx_v_lightfm->rho, __pyx_v_lightfm->eps)); } - /* "lightfm/_lightfm_fast_openmp.pyx":646 + /* "lightfm/_lightfm_fast_openmp.pyx":655 * lightfm.eps) * * avg_learning_rate /= ((lightfm.no_components + 1) * (user_stop_index - user_start_index) # <<<<<<<<<<<<<< @@ -5776,7 +5950,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_avg_learning_rate = (__pyx_v_avg_learning_rate / ((((__pyx_v_lightfm->no_components + 1) * (__pyx_v_user_stop_index - __pyx_v_user_start_index)) + ((__pyx_v_lightfm->no_components + 1) * (__pyx_v_positive_item_stop_index - __pyx_v_positive_item_start_index))) + ((__pyx_v_lightfm->no_components + 1) * (__pyx_v_negative_item_stop_index - __pyx_v_negative_item_start_index)))); - /* "lightfm/_lightfm_fast_openmp.pyx":654 + /* "lightfm/_lightfm_fast_openmp.pyx":663 * # Update the scaling factors for lazy regularization, using the average learning rate * # of features updated for this example. * lightfm.item_scale *= (1.0 + item_alpha * avg_learning_rate) # <<<<<<<<<<<<<< @@ -5785,16 +5959,34 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l */ __pyx_v_lightfm->item_scale = (__pyx_v_lightfm->item_scale * (1.0 + (__pyx_v_item_alpha * __pyx_v_avg_learning_rate))); - /* "lightfm/_lightfm_fast_openmp.pyx":655 + /* "lightfm/_lightfm_fast_openmp.pyx":664 * # of features updated for this example. * lightfm.item_scale *= (1.0 + item_alpha * avg_learning_rate) * lightfm.user_scale *= (1.0 + user_alpha * avg_learning_rate) # <<<<<<<<<<<<<< * - * + * lightfm.avg_loss_ctr += 1 */ __pyx_v_lightfm->user_scale = (__pyx_v_lightfm->user_scale * (1.0 + (__pyx_v_user_alpha * __pyx_v_avg_learning_rate))); - /* "lightfm/_lightfm_fast_openmp.pyx":543 + /* "lightfm/_lightfm_fast_openmp.pyx":666 + * lightfm.user_scale *= (1.0 + user_alpha * avg_learning_rate) + * + * lightfm.avg_loss_ctr += 1 # <<<<<<<<<<<<<< + * lightfm.avg_loss = (lightfm.avg_loss * (lightfm.avg_loss_ctr - 1) + loss) / lightfm.avg_loss_ctr + * + */ + __pyx_v_lightfm->avg_loss_ctr = (__pyx_v_lightfm->avg_loss_ctr + 1); + + /* "lightfm/_lightfm_fast_openmp.pyx":667 + * + * lightfm.avg_loss_ctr += 1 + * lightfm.avg_loss = (lightfm.avg_loss * (lightfm.avg_loss_ctr - 1) + loss) / lightfm.avg_loss_ctr # <<<<<<<<<<<<<< + * + * + */ + __pyx_v_lightfm->avg_loss = (((__pyx_v_lightfm->avg_loss * (__pyx_v_lightfm->avg_loss_ctr - 1)) + __pyx_v_loss) / __pyx_v_lightfm->avg_loss_ctr); + + /* "lightfm/_lightfm_fast_openmp.pyx":552 * * * cdef void warp_update(double loss, # <<<<<<<<<<<<<< @@ -5805,7 +5997,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(double __pyx_v_l /* function exit code */ } -/* "lightfm/_lightfm_fast_openmp.pyx":658 +/* "lightfm/_lightfm_fast_openmp.pyx":670 * * * cdef void regularize(FastLightFM lightfm, # <<<<<<<<<<<<<< @@ -5826,12 +6018,8 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(struct __pyx_obj_ int __pyx_t_6; Py_ssize_t __pyx_t_7; Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - Py_ssize_t __pyx_t_10; - Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - /* "lightfm/_lightfm_fast_openmp.pyx":666 + /* "lightfm/_lightfm_fast_openmp.pyx":678 * * cdef int i, j * cdef int no_features = lightfm.item_features.shape[0] # <<<<<<<<<<<<<< @@ -5840,7 +6028,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(struct __pyx_obj_ */ __pyx_v_no_features = (__pyx_v_lightfm->item_features.shape[0]); - /* "lightfm/_lightfm_fast_openmp.pyx":667 + /* "lightfm/_lightfm_fast_openmp.pyx":679 * cdef int i, j * cdef int no_features = lightfm.item_features.shape[0] * cdef int no_users = lightfm.user_features.shape[0] # <<<<<<<<<<<<<< @@ -5849,7 +6037,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(struct __pyx_obj_ */ __pyx_v_no_users = (__pyx_v_lightfm->user_features.shape[0]); - /* "lightfm/_lightfm_fast_openmp.pyx":669 + /* "lightfm/_lightfm_fast_openmp.pyx":681 * cdef int no_users = lightfm.user_features.shape[0] * * for i in range(no_features): # <<<<<<<<<<<<<< @@ -5861,7 +6049,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(struct __pyx_obj_ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "lightfm/_lightfm_fast_openmp.pyx":670 + /* "lightfm/_lightfm_fast_openmp.pyx":682 * * for i in range(no_features): * for j in range(lightfm.no_components): # <<<<<<<<<<<<<< @@ -5873,7 +6061,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(struct __pyx_obj_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6; - /* "lightfm/_lightfm_fast_openmp.pyx":671 + /* "lightfm/_lightfm_fast_openmp.pyx":683 * for i in range(no_features): * for j in range(lightfm.no_components): * lightfm.item_features[i, j] /= lightfm.item_scale # <<<<<<<<<<<<<< @@ -5885,18 +6073,18 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(struct __pyx_obj_ *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_lightfm->item_features.data + __pyx_t_7 * __pyx_v_lightfm->item_features.strides[0]) )) + __pyx_t_8)) )) /= __pyx_v_lightfm->item_scale; } - /* "lightfm/_lightfm_fast_openmp.pyx":673 + /* "lightfm/_lightfm_fast_openmp.pyx":685 * lightfm.item_features[i, j] /= lightfm.item_scale * * lightfm.item_biases[i] /= lightfm.item_scale # <<<<<<<<<<<<<< * * for i in range(no_users): */ - __pyx_t_9 = __pyx_v_i; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_lightfm->item_biases.data) + __pyx_t_9)) )) /= __pyx_v_lightfm->item_scale; + __pyx_t_8 = __pyx_v_i; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_lightfm->item_biases.data) + __pyx_t_8)) )) /= __pyx_v_lightfm->item_scale; } - /* "lightfm/_lightfm_fast_openmp.pyx":675 + /* "lightfm/_lightfm_fast_openmp.pyx":687 * lightfm.item_biases[i] /= lightfm.item_scale * * for i in range(no_users): # <<<<<<<<<<<<<< @@ -5908,7 +6096,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(struct __pyx_obj_ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "lightfm/_lightfm_fast_openmp.pyx":676 + /* "lightfm/_lightfm_fast_openmp.pyx":688 * * for i in range(no_users): * for j in range(lightfm.no_components): # <<<<<<<<<<<<<< @@ -5920,30 +6108,30 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(struct __pyx_obj_ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_j = __pyx_t_6; - /* "lightfm/_lightfm_fast_openmp.pyx":677 + /* "lightfm/_lightfm_fast_openmp.pyx":689 * for i in range(no_users): * for j in range(lightfm.no_components): * lightfm.user_features[i, j] /= lightfm.user_scale # <<<<<<<<<<<<<< * lightfm.user_biases[i] /= lightfm.user_scale * */ - __pyx_t_10 = __pyx_v_i; - __pyx_t_11 = __pyx_v_j; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_lightfm->user_features.data + __pyx_t_10 * __pyx_v_lightfm->user_features.strides[0]) )) + __pyx_t_11)) )) /= __pyx_v_lightfm->user_scale; + __pyx_t_8 = __pyx_v_i; + __pyx_t_7 = __pyx_v_j; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=1 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ (__pyx_v_lightfm->user_features.data + __pyx_t_8 * __pyx_v_lightfm->user_features.strides[0]) )) + __pyx_t_7)) )) /= __pyx_v_lightfm->user_scale; } - /* "lightfm/_lightfm_fast_openmp.pyx":678 + /* "lightfm/_lightfm_fast_openmp.pyx":690 * for j in range(lightfm.no_components): * lightfm.user_features[i, j] /= lightfm.user_scale * lightfm.user_biases[i] /= lightfm.user_scale # <<<<<<<<<<<<<< * * lightfm.item_scale = 1.0 */ - __pyx_t_12 = __pyx_v_i; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_lightfm->user_biases.data) + __pyx_t_12)) )) /= __pyx_v_lightfm->user_scale; + __pyx_t_7 = __pyx_v_i; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_lightfm->user_biases.data) + __pyx_t_7)) )) /= __pyx_v_lightfm->user_scale; } - /* "lightfm/_lightfm_fast_openmp.pyx":680 + /* "lightfm/_lightfm_fast_openmp.pyx":692 * lightfm.user_biases[i] /= lightfm.user_scale * * lightfm.item_scale = 1.0 # <<<<<<<<<<<<<< @@ -5952,7 +6140,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(struct __pyx_obj_ */ __pyx_v_lightfm->item_scale = 1.0; - /* "lightfm/_lightfm_fast_openmp.pyx":681 + /* "lightfm/_lightfm_fast_openmp.pyx":693 * * lightfm.item_scale = 1.0 * lightfm.user_scale = 1.0 # <<<<<<<<<<<<<< @@ -5961,7 +6149,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(struct __pyx_obj_ */ __pyx_v_lightfm->user_scale = 1.0; - /* "lightfm/_lightfm_fast_openmp.pyx":658 + /* "lightfm/_lightfm_fast_openmp.pyx":670 * * * cdef void regularize(FastLightFM lightfm, # <<<<<<<<<<<<<< @@ -5972,7 +6160,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(struct __pyx_obj_ /* function exit code */ } -/* "lightfm/_lightfm_fast_openmp.pyx":684 +/* "lightfm/_lightfm_fast_openmp.pyx":696 * * * cdef void locked_regularize(FastLightFM lightfm, # <<<<<<<<<<<<<< @@ -5984,7 +6172,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_locked_regularize(struct __p int __pyx_t_1; int __pyx_t_2; - /* "lightfm/_lightfm_fast_openmp.pyx":692 + /* "lightfm/_lightfm_fast_openmp.pyx":704 * """ * * openmp.omp_set_lock(&THREAD_LOCK) # <<<<<<<<<<<<<< @@ -5993,7 +6181,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_locked_regularize(struct __p */ omp_set_lock((&__pyx_v_7lightfm_20_lightfm_fast_openmp_THREAD_LOCK)); - /* "lightfm/_lightfm_fast_openmp.pyx":693 + /* "lightfm/_lightfm_fast_openmp.pyx":705 * * openmp.omp_set_lock(&THREAD_LOCK) * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< @@ -6011,7 +6199,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_locked_regularize(struct __p __pyx_L4_bool_binop_done:; if (__pyx_t_1) { - /* "lightfm/_lightfm_fast_openmp.pyx":694 + /* "lightfm/_lightfm_fast_openmp.pyx":706 * openmp.omp_set_lock(&THREAD_LOCK) * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: * regularize(lightfm, # <<<<<<<<<<<<<< @@ -6020,7 +6208,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_locked_regularize(struct __p */ __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_openmp.pyx":693 + /* "lightfm/_lightfm_fast_openmp.pyx":705 * * openmp.omp_set_lock(&THREAD_LOCK) * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< @@ -6029,7 +6217,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_locked_regularize(struct __p */ } - /* "lightfm/_lightfm_fast_openmp.pyx":697 + /* "lightfm/_lightfm_fast_openmp.pyx":709 * item_alpha, * user_alpha) * openmp.omp_unset_lock(&THREAD_LOCK) # <<<<<<<<<<<<<< @@ -6038,7 +6226,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_locked_regularize(struct __p */ omp_unset_lock((&__pyx_v_7lightfm_20_lightfm_fast_openmp_THREAD_LOCK)); - /* "lightfm/_lightfm_fast_openmp.pyx":684 + /* "lightfm/_lightfm_fast_openmp.pyx":696 * * * cdef void locked_regularize(FastLightFM lightfm, # <<<<<<<<<<<<<< @@ -6049,7 +6237,7 @@ static void __pyx_f_7lightfm_20_lightfm_fast_openmp_locked_regularize(struct __p /* function exit code */ } -/* "lightfm/_lightfm_fast_openmp.pyx":700 +/* "lightfm/_lightfm_fast_openmp.pyx":712 * * * def fit_logistic(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -6074,6 +6262,9 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_1fit_logistic(PyObject double __pyx_v_item_alpha; double __pyx_v_user_alpha; int __pyx_v_num_threads; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fit_logistic (wrapper)", 0); @@ -6120,71 +6311,71 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_1fit_logistic(PyObject case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 1); __PYX_ERR(0, 700, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 1); __PYX_ERR(0, 712, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 2); __PYX_ERR(0, 700, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 2); __PYX_ERR(0, 712, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 3); __PYX_ERR(0, 700, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 3); __PYX_ERR(0, 712, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 4); __PYX_ERR(0, 700, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 4); __PYX_ERR(0, 712, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sample_weight)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 5); __PYX_ERR(0, 700, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 5); __PYX_ERR(0, 712, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shuffle_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 6); __PYX_ERR(0, 700, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 6); __PYX_ERR(0, 712, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lightfm)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 7); __PYX_ERR(0, 700, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 7); __PYX_ERR(0, 712, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_learning_rate)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 8); __PYX_ERR(0, 700, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 8); __PYX_ERR(0, 712, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 9); __PYX_ERR(0, 700, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 9); __PYX_ERR(0, 712, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 10); __PYX_ERR(0, 700, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 10); __PYX_ERR(0, 712, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 11); __PYX_ERR(0, 700, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, 11); __PYX_ERR(0, 712, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_logistic") < 0)) __PYX_ERR(0, 700, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_logistic") < 0)) __PYX_ERR(0, 712, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 12) { goto __pyx_L5_argtuple_error; @@ -6204,28 +6395,28 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_1fit_logistic(PyObject } __pyx_v_item_features = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[0]); __pyx_v_user_features = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[1]); - __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 702, __pyx_L3_error) - __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 703, __pyx_L3_error) - __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_Y.memview)) __PYX_ERR(0, 704, __pyx_L3_error) - __pyx_v_sample_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_sample_weight.memview)) __PYX_ERR(0, 705, __pyx_L3_error) - __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 706, __pyx_L3_error) + __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 714, __pyx_L3_error) + __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 715, __pyx_L3_error) + __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_Y.memview)) __PYX_ERR(0, 716, __pyx_L3_error) + __pyx_v_sample_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_sample_weight.memview)) __PYX_ERR(0, 717, __pyx_L3_error) + __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 718, __pyx_L3_error) __pyx_v_lightfm = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *)values[7]); - __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 708, __pyx_L3_error) - __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 709, __pyx_L3_error) - __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 710, __pyx_L3_error) - __pyx_v_num_threads = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 711, __pyx_L3_error) + __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 720, __pyx_L3_error) + __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 721, __pyx_L3_error) + __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 722, __pyx_L3_error) + __pyx_v_num_threads = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 723, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 700, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_logistic", 1, 12, 12, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 712, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_openmp.fit_logistic", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 700, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 701, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 707, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 712, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 713, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 719, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(__pyx_self, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_user_ids, __pyx_v_item_ids, __pyx_v_Y, __pyx_v_sample_weight, __pyx_v_shuffle_indices, __pyx_v_lightfm, __pyx_v_learning_rate, __pyx_v_item_alpha, __pyx_v_user_alpha, __pyx_v_num_threads); /* function exit code */ @@ -6256,15 +6447,11 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN int __pyx_t_2; int __pyx_t_3; Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; - int __pyx_t_9; - int __pyx_t_10; + int __pyx_t_5; + int __pyx_t_6; __Pyx_RefNannySetupContext("fit_logistic", 0); - /* "lightfm/_lightfm_fast_openmp.pyx":723 + /* "lightfm/_lightfm_fast_openmp.pyx":735 * cdef flt *it_repr * * no_examples = Y.shape[0] # <<<<<<<<<<<<<< @@ -6273,7 +6460,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN */ __pyx_v_no_examples = (__pyx_v_Y.shape[0]); - /* "lightfm/_lightfm_fast_openmp.pyx":725 + /* "lightfm/_lightfm_fast_openmp.pyx":737 * no_examples = Y.shape[0] * * with nogil, parallel(num_threads=num_threads): # <<<<<<<<<<<<<< @@ -6295,14 +6482,14 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN #define unlikely(x) (x) #endif #ifdef _OPENMP - #pragma omp parallel private(__pyx_v_it_repr, __pyx_v_user_repr) private(__pyx_t_1, __pyx_t_10, __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) num_threads(__pyx_v_num_threads) + #pragma omp parallel private(__pyx_v_it_repr, __pyx_v_user_repr) private(__pyx_t_1, __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6) num_threads(__pyx_v_num_threads) #endif /* _OPENMP */ { /* Initialize private variables to invalid values */ __pyx_v_it_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)1); __pyx_v_user_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)1); - /* "lightfm/_lightfm_fast_openmp.pyx":727 + /* "lightfm/_lightfm_fast_openmp.pyx":739 * with nogil, parallel(num_threads=num_threads): * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -6311,7 +6498,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN */ __pyx_v_user_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":728 + /* "lightfm/_lightfm_fast_openmp.pyx":740 * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -6320,7 +6507,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN */ __pyx_v_it_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":730 + /* "lightfm/_lightfm_fast_openmp.pyx":742 * it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * * for i in prange(no_examples): # <<<<<<<<<<<<<< @@ -6328,7 +6515,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN * row = shuffle_indices[i] */ __pyx_t_1 = __pyx_v_no_examples; - if (1 == 0) abort(); + if ((1 == 0)) abort(); { __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; if (__pyx_t_3 > 0) @@ -6349,7 +6536,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN __pyx_v_y = ((int)0xbad0bad0); __pyx_v_y_row = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)__PYX_NAN()); - /* "lightfm/_lightfm_fast_openmp.pyx":732 + /* "lightfm/_lightfm_fast_openmp.pyx":744 * for i in prange(no_examples): * * row = shuffle_indices[i] # <<<<<<<<<<<<<< @@ -6359,37 +6546,37 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN __pyx_t_4 = __pyx_v_i; __pyx_v_row = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_shuffle_indices.data) + __pyx_t_4)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":734 + /* "lightfm/_lightfm_fast_openmp.pyx":746 * row = shuffle_indices[i] * * user_id = user_ids[row] # <<<<<<<<<<<<<< * item_id = item_ids[row] * weight = sample_weight[row] */ - __pyx_t_5 = __pyx_v_row; - __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_5)) ))); + __pyx_t_4 = __pyx_v_row; + __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_4)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":735 + /* "lightfm/_lightfm_fast_openmp.pyx":747 * * user_id = user_ids[row] * item_id = item_ids[row] # <<<<<<<<<<<<<< * weight = sample_weight[row] * */ - __pyx_t_6 = __pyx_v_row; - __pyx_v_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_6)) ))); + __pyx_t_4 = __pyx_v_row; + __pyx_v_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_4)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":736 + /* "lightfm/_lightfm_fast_openmp.pyx":748 * user_id = user_ids[row] * item_id = item_ids[row] * weight = sample_weight[row] # <<<<<<<<<<<<<< * * compute_representation(user_features, */ - __pyx_t_7 = __pyx_v_row; - __pyx_v_weight = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_sample_weight.data) + __pyx_t_7)) ))); + __pyx_t_4 = __pyx_v_row; + __pyx_v_weight = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_sample_weight.data) + __pyx_t_4)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":738 + /* "lightfm/_lightfm_fast_openmp.pyx":750 * weight = sample_weight[row] * * compute_representation(user_features, # <<<<<<<<<<<<<< @@ -6398,7 +6585,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_biases, __pyx_v_lightfm, __pyx_v_user_id, __pyx_v_lightfm->user_scale, __pyx_v_user_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":745 + /* "lightfm/_lightfm_fast_openmp.pyx":757 * lightfm.user_scale, * user_repr) * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -6407,7 +6594,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_item_id, __pyx_v_lightfm->item_scale, __pyx_v_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":753 + /* "lightfm/_lightfm_fast_openmp.pyx":765 * it_repr) * * prediction = sigmoid(compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -6416,27 +6603,27 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN */ __pyx_v_prediction = __pyx_f_7lightfm_20_lightfm_fast_openmp_sigmoid(__pyx_f_7lightfm_20_lightfm_fast_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_it_repr, __pyx_v_lightfm->no_components)); - /* "lightfm/_lightfm_fast_openmp.pyx":759 + /* "lightfm/_lightfm_fast_openmp.pyx":771 * # Any value less or equal to zero * # is a negative interaction. * y_row = Y[row] # <<<<<<<<<<<<<< * if y_row <= 0: * y = 0 */ - __pyx_t_8 = __pyx_v_row; - __pyx_v_y_row = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_Y.data) + __pyx_t_8)) ))); + __pyx_t_4 = __pyx_v_row; + __pyx_v_y_row = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_Y.data) + __pyx_t_4)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":760 + /* "lightfm/_lightfm_fast_openmp.pyx":772 * # is a negative interaction. * y_row = Y[row] * if y_row <= 0: # <<<<<<<<<<<<<< * y = 0 * else: */ - __pyx_t_9 = ((__pyx_v_y_row <= 0.0) != 0); - if (__pyx_t_9) { + __pyx_t_5 = ((__pyx_v_y_row <= 0.0) != 0); + if (__pyx_t_5) { - /* "lightfm/_lightfm_fast_openmp.pyx":761 + /* "lightfm/_lightfm_fast_openmp.pyx":773 * y_row = Y[row] * if y_row <= 0: * y = 0 # <<<<<<<<<<<<<< @@ -6445,7 +6632,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN */ __pyx_v_y = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":760 + /* "lightfm/_lightfm_fast_openmp.pyx":772 * # is a negative interaction. * y_row = Y[row] * if y_row <= 0: # <<<<<<<<<<<<<< @@ -6455,7 +6642,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN goto __pyx_L14; } - /* "lightfm/_lightfm_fast_openmp.pyx":763 + /* "lightfm/_lightfm_fast_openmp.pyx":775 * y = 0 * else: * y = 1 # <<<<<<<<<<<<<< @@ -6467,7 +6654,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN } __pyx_L14:; - /* "lightfm/_lightfm_fast_openmp.pyx":765 + /* "lightfm/_lightfm_fast_openmp.pyx":777 * y = 1 * * loss = weight * (prediction - y) # <<<<<<<<<<<<<< @@ -6476,7 +6663,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN */ __pyx_v_loss = (__pyx_v_weight * (__pyx_v_prediction - __pyx_v_y)); - /* "lightfm/_lightfm_fast_openmp.pyx":766 + /* "lightfm/_lightfm_fast_openmp.pyx":778 * * loss = weight * (prediction - y) * update(loss, # <<<<<<<<<<<<<< @@ -6485,25 +6672,25 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN */ __pyx_f_7lightfm_20_lightfm_fast_openmp_update(__pyx_v_loss, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_user_id, __pyx_v_item_id, __pyx_v_user_repr, __pyx_v_it_repr, __pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_openmp.pyx":777 + /* "lightfm/_lightfm_fast_openmp.pyx":789 * user_alpha) * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< * locked_regularize(lightfm, * item_alpha, */ - __pyx_t_10 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); - if (!__pyx_t_10) { + __pyx_t_6 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); + if (!__pyx_t_6) { } else { - __pyx_t_9 = __pyx_t_10; + __pyx_t_5 = __pyx_t_6; goto __pyx_L16_bool_binop_done; } - __pyx_t_10 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); - __pyx_t_9 = __pyx_t_10; + __pyx_t_6 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); + __pyx_t_5 = __pyx_t_6; __pyx_L16_bool_binop_done:; - if (__pyx_t_9) { + if (__pyx_t_5) { - /* "lightfm/_lightfm_fast_openmp.pyx":778 + /* "lightfm/_lightfm_fast_openmp.pyx":790 * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: * locked_regularize(lightfm, # <<<<<<<<<<<<<< @@ -6512,7 +6699,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN */ __pyx_f_7lightfm_20_lightfm_fast_openmp_locked_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_openmp.pyx":777 + /* "lightfm/_lightfm_fast_openmp.pyx":789 * user_alpha) * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< @@ -6525,7 +6712,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN } } - /* "lightfm/_lightfm_fast_openmp.pyx":782 + /* "lightfm/_lightfm_fast_openmp.pyx":794 * user_alpha) * * free(user_repr) # <<<<<<<<<<<<<< @@ -6534,7 +6721,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN */ free(__pyx_v_user_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":783 + /* "lightfm/_lightfm_fast_openmp.pyx":795 * * free(user_repr) * free(it_repr) # <<<<<<<<<<<<<< @@ -6552,7 +6739,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN #endif } - /* "lightfm/_lightfm_fast_openmp.pyx":725 + /* "lightfm/_lightfm_fast_openmp.pyx":737 * no_examples = Y.shape[0] * * with nogil, parallel(num_threads=num_threads): # <<<<<<<<<<<<<< @@ -6571,7 +6758,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN } } - /* "lightfm/_lightfm_fast_openmp.pyx":785 + /* "lightfm/_lightfm_fast_openmp.pyx":797 * free(it_repr) * * regularize(lightfm, # <<<<<<<<<<<<<< @@ -6580,7 +6767,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN */ __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_openmp.pyx":700 + /* "lightfm/_lightfm_fast_openmp.pyx":712 * * * def fit_logistic(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -6600,7 +6787,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_fit_logistic(CYTHON_UN return __pyx_r; } -/* "lightfm/_lightfm_fast_openmp.pyx":790 +/* "lightfm/_lightfm_fast_openmp.pyx":802 * * * def fit_warp(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -6627,6 +6814,9 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_3fit_warp(PyObject *__ double __pyx_v_user_alpha; int __pyx_v_num_threads; PyObject *__pyx_v_random_state = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fit_warp (wrapper)", 0); @@ -6677,83 +6867,83 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_3fit_warp(PyObject *__ case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 1); __PYX_ERR(0, 790, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 1); __PYX_ERR(0, 802, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interactions)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 2); __PYX_ERR(0, 790, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 2); __PYX_ERR(0, 802, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 3); __PYX_ERR(0, 790, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 3); __PYX_ERR(0, 802, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 4); __PYX_ERR(0, 790, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 4); __PYX_ERR(0, 802, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 5); __PYX_ERR(0, 790, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 5); __PYX_ERR(0, 802, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sample_weight)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 6); __PYX_ERR(0, 790, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 6); __PYX_ERR(0, 802, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shuffle_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 7); __PYX_ERR(0, 790, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 7); __PYX_ERR(0, 802, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lightfm)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 8); __PYX_ERR(0, 790, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 8); __PYX_ERR(0, 802, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_learning_rate)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 9); __PYX_ERR(0, 790, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 9); __PYX_ERR(0, 802, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 10); __PYX_ERR(0, 790, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 10); __PYX_ERR(0, 802, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 11); __PYX_ERR(0, 790, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 11); __PYX_ERR(0, 802, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 12); __PYX_ERR(0, 790, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 12); __PYX_ERR(0, 802, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 13: if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_random_state)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 13); __PYX_ERR(0, 790, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, 13); __PYX_ERR(0, 802, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_warp") < 0)) __PYX_ERR(0, 790, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_warp") < 0)) __PYX_ERR(0, 802, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 14) { goto __pyx_L5_argtuple_error; @@ -6776,30 +6966,30 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_3fit_warp(PyObject *__ __pyx_v_item_features = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[0]); __pyx_v_user_features = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[1]); __pyx_v_interactions = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[2]); - __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 793, __pyx_L3_error) - __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 794, __pyx_L3_error) - __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_Y.memview)) __PYX_ERR(0, 795, __pyx_L3_error) - __pyx_v_sample_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_sample_weight.memview)) __PYX_ERR(0, 796, __pyx_L3_error) - __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 797, __pyx_L3_error) + __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 805, __pyx_L3_error) + __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 806, __pyx_L3_error) + __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_Y.memview)) __PYX_ERR(0, 807, __pyx_L3_error) + __pyx_v_sample_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_sample_weight.memview)) __PYX_ERR(0, 808, __pyx_L3_error) + __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 809, __pyx_L3_error) __pyx_v_lightfm = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *)values[8]); - __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 799, __pyx_L3_error) - __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 800, __pyx_L3_error) - __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 801, __pyx_L3_error) - __pyx_v_num_threads = __Pyx_PyInt_As_int(values[12]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 802, __pyx_L3_error) + __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 811, __pyx_L3_error) + __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 812, __pyx_L3_error) + __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 813, __pyx_L3_error) + __pyx_v_num_threads = __Pyx_PyInt_As_int(values[12]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 814, __pyx_L3_error) __pyx_v_random_state = values[13]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 790, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp", 1, 14, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 802, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_openmp.fit_warp", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 790, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 791, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interactions), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "interactions", 0))) __PYX_ERR(0, 792, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 798, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 802, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 803, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interactions), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "interactions", 0))) __PYX_ERR(0, 804, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 810, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(__pyx_self, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_interactions, __pyx_v_user_ids, __pyx_v_item_ids, __pyx_v_Y, __pyx_v_sample_weight, __pyx_v_shuffle_indices, __pyx_v_lightfm, __pyx_v_learning_rate, __pyx_v_item_alpha, __pyx_v_user_alpha, __pyx_v_num_threads, __pyx_v_random_state); /* function exit code */ @@ -6841,43 +7031,41 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE int __pyx_t_9; int __pyx_t_10; Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; - int __pyx_t_15; - Py_ssize_t __pyx_t_16; - Py_ssize_t __pyx_t_17; - double __pyx_t_18; - double __pyx_t_19; - double __pyx_t_20; - int __pyx_t_21; + int __pyx_t_12; + double __pyx_t_13; + double __pyx_t_14; + double __pyx_t_15; + int __pyx_t_16; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fit_warp", 0); - /* "lightfm/_lightfm_fast_openmp.pyx":818 + /* "lightfm/_lightfm_fast_openmp.pyx":830 * cdef unsigned int[::1] random_states * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_randint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 818, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_randint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 830, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "lightfm/_lightfm_fast_openmp.pyx":819 + /* "lightfm/_lightfm_fast_openmp.pyx":831 * * random_states = random_state.randint(0, * np.iinfo(np.int32).max, # <<<<<<<<<<<<<< * size=num_threads).astype(np.uint32) * */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 819, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_iinfo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 819, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_iinfo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 819, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 819, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -6893,21 +7081,21 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 819, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 819, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 831, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":818 + /* "lightfm/_lightfm_fast_openmp.pyx":830 * cdef unsigned int[::1] random_states * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 818, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 830, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -6916,46 +7104,46 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); __pyx_t_5 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":820 + /* "lightfm/_lightfm_fast_openmp.pyx":832 * random_states = random_state.randint(0, * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) # <<<<<<<<<<<<<< * * no_examples = Y.shape[0] */ - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 820, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_num_threads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 820, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_num_threads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_size, __pyx_t_6) < 0) __PYX_ERR(0, 820, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_size, __pyx_t_6) < 0) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":818 + /* "lightfm/_lightfm_fast_openmp.pyx":830 * cdef unsigned int[::1] random_states * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 818, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 830, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":820 + /* "lightfm/_lightfm_fast_openmp.pyx":832 * random_states = random_state.randint(0, * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) # <<<<<<<<<<<<<< * * no_examples = Y.shape[0] */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 820, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 820, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 820, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -6971,16 +7159,16 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 820, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 820, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 832, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_random_states = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "lightfm/_lightfm_fast_openmp.pyx":822 + /* "lightfm/_lightfm_fast_openmp.pyx":834 * size=num_threads).astype(np.uint32) * * no_examples = Y.shape[0] # <<<<<<<<<<<<<< @@ -6989,7 +7177,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_v_no_examples = (__pyx_v_Y.shape[0]); - /* "lightfm/_lightfm_fast_openmp.pyx":823 + /* "lightfm/_lightfm_fast_openmp.pyx":835 * * no_examples = Y.shape[0] * MAX_LOSS = 10.0 # <<<<<<<<<<<<<< @@ -6998,7 +7186,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_v_MAX_LOSS = 10.0; - /* "lightfm/_lightfm_fast_openmp.pyx":825 + /* "lightfm/_lightfm_fast_openmp.pyx":837 * MAX_LOSS = 10.0 * * with nogil, parallel(num_threads=num_threads): # <<<<<<<<<<<<<< @@ -7020,7 +7208,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE #define unlikely(x) (x) #endif #ifdef _OPENMP - #pragma omp parallel private(__pyx_v_neg_it_repr, __pyx_v_pos_it_repr, __pyx_v_user_repr) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_8, __pyx_t_9) num_threads(__pyx_v_num_threads) + #pragma omp parallel private(__pyx_v_neg_it_repr, __pyx_v_pos_it_repr, __pyx_v_user_repr) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_8, __pyx_t_9) num_threads(__pyx_v_num_threads) #endif /* _OPENMP */ { /* Initialize private variables to invalid values */ @@ -7028,7 +7216,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE __pyx_v_pos_it_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)1); __pyx_v_user_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)1); - /* "lightfm/_lightfm_fast_openmp.pyx":827 + /* "lightfm/_lightfm_fast_openmp.pyx":839 * with nogil, parallel(num_threads=num_threads): * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -7037,7 +7225,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_v_user_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":828 + /* "lightfm/_lightfm_fast_openmp.pyx":840 * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * pos_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -7046,7 +7234,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_v_pos_it_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":829 + /* "lightfm/_lightfm_fast_openmp.pyx":841 * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * pos_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * neg_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -7055,7 +7243,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_v_neg_it_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":831 + /* "lightfm/_lightfm_fast_openmp.pyx":843 * neg_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * * for i in prange(no_examples): # <<<<<<<<<<<<<< @@ -7063,7 +7251,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE * */ __pyx_t_8 = __pyx_v_no_examples; - if (1 == 0) abort(); + if ((1 == 0)) abort(); { __pyx_t_10 = (__pyx_t_8 - 0 + 1 - 1/abs(1)) / 1; if (__pyx_t_10 > 0) @@ -7085,7 +7273,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE __pyx_v_user_id = ((int)0xbad0bad0); __pyx_v_weight = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)__PYX_NAN()); - /* "lightfm/_lightfm_fast_openmp.pyx":832 + /* "lightfm/_lightfm_fast_openmp.pyx":844 * * for i in prange(no_examples): * row = shuffle_indices[i] # <<<<<<<<<<<<<< @@ -7095,38 +7283,38 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE __pyx_t_11 = __pyx_v_i; __pyx_v_row = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_shuffle_indices.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":834 + /* "lightfm/_lightfm_fast_openmp.pyx":846 * row = shuffle_indices[i] * * user_id = user_ids[row] # <<<<<<<<<<<<<< * positive_item_id = item_ids[row] * */ - __pyx_t_12 = __pyx_v_row; - __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_12)) ))); + __pyx_t_11 = __pyx_v_row; + __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":835 + /* "lightfm/_lightfm_fast_openmp.pyx":847 * * user_id = user_ids[row] * positive_item_id = item_ids[row] # <<<<<<<<<<<<<< * * if not Y[row] > 0: */ - __pyx_t_13 = __pyx_v_row; - __pyx_v_positive_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_13)) ))); + __pyx_t_11 = __pyx_v_row; + __pyx_v_positive_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":837 + /* "lightfm/_lightfm_fast_openmp.pyx":849 * positive_item_id = item_ids[row] * * if not Y[row] > 0: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_14 = __pyx_v_row; - __pyx_t_15 = ((!(((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_Y.data) + __pyx_t_14)) ))) > 0.0) != 0)) != 0); - if (__pyx_t_15) { + __pyx_t_11 = __pyx_v_row; + __pyx_t_12 = ((!(((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_Y.data) + __pyx_t_11)) ))) > 0.0) != 0)) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_openmp.pyx":838 + /* "lightfm/_lightfm_fast_openmp.pyx":850 * * if not Y[row] > 0: * continue # <<<<<<<<<<<<<< @@ -7135,7 +7323,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ goto __pyx_L10_continue; - /* "lightfm/_lightfm_fast_openmp.pyx":837 + /* "lightfm/_lightfm_fast_openmp.pyx":849 * positive_item_id = item_ids[row] * * if not Y[row] > 0: # <<<<<<<<<<<<<< @@ -7144,17 +7332,17 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ } - /* "lightfm/_lightfm_fast_openmp.pyx":840 + /* "lightfm/_lightfm_fast_openmp.pyx":852 * continue * * weight = sample_weight[row] # <<<<<<<<<<<<<< * * compute_representation(user_features, */ - __pyx_t_16 = __pyx_v_row; - __pyx_v_weight = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_sample_weight.data) + __pyx_t_16)) ))); + __pyx_t_11 = __pyx_v_row; + __pyx_v_weight = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_sample_weight.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":842 + /* "lightfm/_lightfm_fast_openmp.pyx":854 * weight = sample_weight[row] * * compute_representation(user_features, # <<<<<<<<<<<<<< @@ -7163,7 +7351,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_biases, __pyx_v_lightfm, __pyx_v_user_id, __pyx_v_lightfm->user_scale, __pyx_v_user_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":849 + /* "lightfm/_lightfm_fast_openmp.pyx":861 * lightfm.user_scale, * user_repr) * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -7172,7 +7360,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_positive_item_id, __pyx_v_lightfm->item_scale, __pyx_v_pos_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":857 + /* "lightfm/_lightfm_fast_openmp.pyx":869 * pos_it_repr) * * positive_prediction = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -7181,7 +7369,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_v_positive_prediction = __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_pos_it_repr, __pyx_v_lightfm->no_components); - /* "lightfm/_lightfm_fast_openmp.pyx":861 + /* "lightfm/_lightfm_fast_openmp.pyx":873 * lightfm.no_components) * * sampled = 0 # <<<<<<<<<<<<<< @@ -7190,7 +7378,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_v_sampled = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":863 + /* "lightfm/_lightfm_fast_openmp.pyx":875 * sampled = 0 * * while sampled < lightfm.max_sampled: # <<<<<<<<<<<<<< @@ -7198,10 +7386,10 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE * sampled = sampled + 1 */ while (1) { - __pyx_t_15 = ((__pyx_v_sampled < __pyx_v_lightfm->max_sampled) != 0); - if (!__pyx_t_15) break; + __pyx_t_12 = ((__pyx_v_sampled < __pyx_v_lightfm->max_sampled) != 0); + if (!__pyx_t_12) break; - /* "lightfm/_lightfm_fast_openmp.pyx":865 + /* "lightfm/_lightfm_fast_openmp.pyx":877 * while sampled < lightfm.max_sampled: * * sampled = sampled + 1 # <<<<<<<<<<<<<< @@ -7210,25 +7398,25 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_v_sampled = (__pyx_v_sampled + 1); - /* "lightfm/_lightfm_fast_openmp.pyx":866 + /* "lightfm/_lightfm_fast_openmp.pyx":878 * * sampled = sampled + 1 * negative_item_id = (rand_r(&random_states[openmp.omp_get_thread_num()]) # <<<<<<<<<<<<<< * % item_features.rows) * */ - __pyx_t_17 = omp_get_thread_num(); + __pyx_t_11 = omp_get_thread_num(); - /* "lightfm/_lightfm_fast_openmp.pyx":867 + /* "lightfm/_lightfm_fast_openmp.pyx":879 * sampled = sampled + 1 * negative_item_id = (rand_r(&random_states[openmp.omp_get_thread_num()]) * % item_features.rows) # <<<<<<<<<<<<<< * * compute_representation(item_features, */ - __pyx_v_negative_item_id = (__pyx_f_7lightfm_20_lightfm_fast_openmp_rand_r((&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_17)) ))))) % __pyx_v_item_features->rows); + __pyx_v_negative_item_id = (__pyx_f_7lightfm_20_lightfm_fast_openmp_rand_r((&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_11)) ))))) % __pyx_v_item_features->rows); - /* "lightfm/_lightfm_fast_openmp.pyx":869 + /* "lightfm/_lightfm_fast_openmp.pyx":881 * % item_features.rows) * * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -7237,7 +7425,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_negative_item_id, __pyx_v_lightfm->item_scale, __pyx_v_neg_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":877 + /* "lightfm/_lightfm_fast_openmp.pyx":889 * neg_it_repr) * * negative_prediction = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -7246,27 +7434,27 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_v_negative_prediction = __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_neg_it_repr, __pyx_v_lightfm->no_components); - /* "lightfm/_lightfm_fast_openmp.pyx":881 + /* "lightfm/_lightfm_fast_openmp.pyx":893 * lightfm.no_components) * * if negative_prediction > positive_prediction - 1: # <<<<<<<<<<<<<< * * # Sample again if the sample negative is actually a positive */ - __pyx_t_15 = ((__pyx_v_negative_prediction > (__pyx_v_positive_prediction - 1.0)) != 0); - if (__pyx_t_15) { + __pyx_t_12 = ((__pyx_v_negative_prediction > (__pyx_v_positive_prediction - 1.0)) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_openmp.pyx":884 + /* "lightfm/_lightfm_fast_openmp.pyx":896 * * # Sample again if the sample negative is actually a positive * if in_positives(negative_item_id, user_id, interactions): # <<<<<<<<<<<<<< * continue * */ - __pyx_t_15 = (__pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(__pyx_v_negative_item_id, __pyx_v_user_id, __pyx_v_interactions) != 0); - if (__pyx_t_15) { + __pyx_t_12 = (__pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(__pyx_v_negative_item_id, __pyx_v_user_id, __pyx_v_interactions) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_openmp.pyx":885 + /* "lightfm/_lightfm_fast_openmp.pyx":897 * # Sample again if the sample negative is actually a positive * if in_positives(negative_item_id, user_id, interactions): * continue # <<<<<<<<<<<<<< @@ -7275,7 +7463,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ goto __pyx_L15_continue; - /* "lightfm/_lightfm_fast_openmp.pyx":884 + /* "lightfm/_lightfm_fast_openmp.pyx":896 * * # Sample again if the sample negative is actually a positive * if in_positives(negative_item_id, user_id, interactions): # <<<<<<<<<<<<<< @@ -7284,33 +7472,33 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ } - /* "lightfm/_lightfm_fast_openmp.pyx":887 + /* "lightfm/_lightfm_fast_openmp.pyx":899 * continue * * loss = weight * log(max(1.0, floor((item_features.rows - 1) / sampled))) # <<<<<<<<<<<<<< * * # Clip gradients for numerical stability. */ - __pyx_t_18 = floor(((__pyx_v_item_features->rows - 1) / __pyx_v_sampled)); - __pyx_t_19 = 1.0; - if (((__pyx_t_18 > __pyx_t_19) != 0)) { - __pyx_t_20 = __pyx_t_18; + __pyx_t_13 = floor(((__pyx_v_item_features->rows - 1) / __pyx_v_sampled)); + __pyx_t_14 = 1.0; + if (((__pyx_t_13 > __pyx_t_14) != 0)) { + __pyx_t_15 = __pyx_t_13; } else { - __pyx_t_20 = __pyx_t_19; + __pyx_t_15 = __pyx_t_14; } - __pyx_v_loss = (__pyx_v_weight * log(__pyx_t_20)); + __pyx_v_loss = (__pyx_v_weight * log(__pyx_t_15)); - /* "lightfm/_lightfm_fast_openmp.pyx":890 + /* "lightfm/_lightfm_fast_openmp.pyx":902 * * # Clip gradients for numerical stability. * if loss > MAX_LOSS: # <<<<<<<<<<<<<< * loss = MAX_LOSS * */ - __pyx_t_15 = ((__pyx_v_loss > __pyx_v_MAX_LOSS) != 0); - if (__pyx_t_15) { + __pyx_t_12 = ((__pyx_v_loss > __pyx_v_MAX_LOSS) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_openmp.pyx":891 + /* "lightfm/_lightfm_fast_openmp.pyx":903 * # Clip gradients for numerical stability. * if loss > MAX_LOSS: * loss = MAX_LOSS # <<<<<<<<<<<<<< @@ -7319,7 +7507,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_v_loss = __pyx_v_MAX_LOSS; - /* "lightfm/_lightfm_fast_openmp.pyx":890 + /* "lightfm/_lightfm_fast_openmp.pyx":902 * * # Clip gradients for numerical stability. * if loss > MAX_LOSS: # <<<<<<<<<<<<<< @@ -7328,7 +7516,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ } - /* "lightfm/_lightfm_fast_openmp.pyx":893 + /* "lightfm/_lightfm_fast_openmp.pyx":905 * loss = MAX_LOSS * * warp_update(loss, # <<<<<<<<<<<<<< @@ -7337,7 +7525,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(__pyx_v_loss, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_user_id, __pyx_v_positive_item_id, __pyx_v_negative_item_id, __pyx_v_user_repr, __pyx_v_pos_it_repr, __pyx_v_neg_it_repr, __pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_openmp.pyx":905 + /* "lightfm/_lightfm_fast_openmp.pyx":917 * item_alpha, * user_alpha) * break # <<<<<<<<<<<<<< @@ -7346,7 +7534,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ goto __pyx_L16_break; - /* "lightfm/_lightfm_fast_openmp.pyx":881 + /* "lightfm/_lightfm_fast_openmp.pyx":893 * lightfm.no_components) * * if negative_prediction > positive_prediction - 1: # <<<<<<<<<<<<<< @@ -7358,25 +7546,25 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE } __pyx_L16_break:; - /* "lightfm/_lightfm_fast_openmp.pyx":907 + /* "lightfm/_lightfm_fast_openmp.pyx":919 * break * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< * locked_regularize(lightfm, * item_alpha, */ - __pyx_t_21 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); - if (!__pyx_t_21) { + __pyx_t_16 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); + if (!__pyx_t_16) { } else { - __pyx_t_15 = __pyx_t_21; + __pyx_t_12 = __pyx_t_16; goto __pyx_L21_bool_binop_done; } - __pyx_t_21 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); - __pyx_t_15 = __pyx_t_21; + __pyx_t_16 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); + __pyx_t_12 = __pyx_t_16; __pyx_L21_bool_binop_done:; - if (__pyx_t_15) { + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_openmp.pyx":908 + /* "lightfm/_lightfm_fast_openmp.pyx":920 * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: * locked_regularize(lightfm, # <<<<<<<<<<<<<< @@ -7385,7 +7573,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_f_7lightfm_20_lightfm_fast_openmp_locked_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_openmp.pyx":907 + /* "lightfm/_lightfm_fast_openmp.pyx":919 * break * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< @@ -7402,7 +7590,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE } } - /* "lightfm/_lightfm_fast_openmp.pyx":912 + /* "lightfm/_lightfm_fast_openmp.pyx":924 * user_alpha) * * free(user_repr) # <<<<<<<<<<<<<< @@ -7411,7 +7599,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ free(__pyx_v_user_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":913 + /* "lightfm/_lightfm_fast_openmp.pyx":925 * * free(user_repr) * free(pos_it_repr) # <<<<<<<<<<<<<< @@ -7420,7 +7608,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ free(__pyx_v_pos_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":914 + /* "lightfm/_lightfm_fast_openmp.pyx":926 * free(user_repr) * free(pos_it_repr) * free(neg_it_repr) # <<<<<<<<<<<<<< @@ -7438,7 +7626,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE #endif } - /* "lightfm/_lightfm_fast_openmp.pyx":825 + /* "lightfm/_lightfm_fast_openmp.pyx":837 * MAX_LOSS = 10.0 * * with nogil, parallel(num_threads=num_threads): # <<<<<<<<<<<<<< @@ -7457,7 +7645,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE } } - /* "lightfm/_lightfm_fast_openmp.pyx":916 + /* "lightfm/_lightfm_fast_openmp.pyx":928 * free(neg_it_repr) * * regularize(lightfm, # <<<<<<<<<<<<<< @@ -7466,7 +7654,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE */ __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_openmp.pyx":790 + /* "lightfm/_lightfm_fast_openmp.pyx":802 * * * def fit_warp(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -7499,7 +7687,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_2fit_warp(CYTHON_UNUSE return __pyx_r; } -/* "lightfm/_lightfm_fast_openmp.pyx":921 +/* "lightfm/_lightfm_fast_openmp.pyx":933 * * * def fit_warp_kos(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -7525,6 +7713,9 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_5fit_warp_kos(PyObject int __pyx_v_n; int __pyx_v_num_threads; PyObject *__pyx_v_random_state = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fit_warp_kos (wrapper)", 0); @@ -7573,77 +7764,77 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_5fit_warp_kos(PyObject case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 1); __PYX_ERR(0, 921, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 1); __PYX_ERR(0, 933, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_data)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 2); __PYX_ERR(0, 921, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 2); __PYX_ERR(0, 933, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 3); __PYX_ERR(0, 921, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 3); __PYX_ERR(0, 933, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shuffle_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 4); __PYX_ERR(0, 921, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 4); __PYX_ERR(0, 933, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lightfm)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 5); __PYX_ERR(0, 921, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 5); __PYX_ERR(0, 933, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_learning_rate)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 6); __PYX_ERR(0, 921, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 6); __PYX_ERR(0, 933, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 7); __PYX_ERR(0, 921, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 7); __PYX_ERR(0, 933, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 8); __PYX_ERR(0, 921, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 8); __PYX_ERR(0, 933, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_k)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 9); __PYX_ERR(0, 921, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 9); __PYX_ERR(0, 933, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_n)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 10); __PYX_ERR(0, 921, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 10); __PYX_ERR(0, 933, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 11); __PYX_ERR(0, 921, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 11); __PYX_ERR(0, 933, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_random_state)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 12); __PYX_ERR(0, 921, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, 12); __PYX_ERR(0, 933, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_warp_kos") < 0)) __PYX_ERR(0, 921, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_warp_kos") < 0)) __PYX_ERR(0, 933, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 13) { goto __pyx_L5_argtuple_error; @@ -7665,29 +7856,29 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_5fit_warp_kos(PyObject __pyx_v_item_features = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[0]); __pyx_v_user_features = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[1]); __pyx_v_data = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[2]); - __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 924, __pyx_L3_error) - __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 925, __pyx_L3_error) + __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 936, __pyx_L3_error) + __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 937, __pyx_L3_error) __pyx_v_lightfm = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *)values[5]); - __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 927, __pyx_L3_error) - __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 928, __pyx_L3_error) - __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 929, __pyx_L3_error) - __pyx_v_k = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 930, __pyx_L3_error) - __pyx_v_n = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 931, __pyx_L3_error) - __pyx_v_num_threads = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 932, __pyx_L3_error) + __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 939, __pyx_L3_error) + __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 940, __pyx_L3_error) + __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[8]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 941, __pyx_L3_error) + __pyx_v_k = __Pyx_PyInt_As_int(values[9]); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 942, __pyx_L3_error) + __pyx_v_n = __Pyx_PyInt_As_int(values[10]); if (unlikely((__pyx_v_n == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 943, __pyx_L3_error) + __pyx_v_num_threads = __Pyx_PyInt_As_int(values[11]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 944, __pyx_L3_error) __pyx_v_random_state = values[12]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 921, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_warp_kos", 1, 13, 13, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 933, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_openmp.fit_warp_kos", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 921, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 922, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "data", 0))) __PYX_ERR(0, 923, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 926, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 933, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 934, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_data), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "data", 0))) __PYX_ERR(0, 935, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 938, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(__pyx_self, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_data, __pyx_v_user_ids, __pyx_v_shuffle_indices, __pyx_v_lightfm, __pyx_v_learning_rate, __pyx_v_item_alpha, __pyx_v_user_alpha, __pyx_v_k, __pyx_v_n, __pyx_v_num_threads, __pyx_v_random_state); /* function exit code */ @@ -7735,43 +7926,43 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U int __pyx_t_9; int __pyx_t_10; Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; + int __pyx_t_12; int __pyx_t_13; int __pyx_t_14; int __pyx_t_15; - int __pyx_t_16; - Py_ssize_t __pyx_t_17; - Py_ssize_t __pyx_t_18; - __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_t_19; - Py_ssize_t __pyx_t_20; - int __pyx_t_21; + Py_ssize_t __pyx_t_16; + __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_t_17; + int __pyx_t_18; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fit_warp_kos", 0); - /* "lightfm/_lightfm_fast_openmp.pyx":949 + /* "lightfm/_lightfm_fast_openmp.pyx":961 * cdef unsigned int[::1] random_states * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_randint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 949, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_randint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 961, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "lightfm/_lightfm_fast_openmp.pyx":950 + /* "lightfm/_lightfm_fast_openmp.pyx":962 * * random_states = random_state.randint(0, * np.iinfo(np.int32).max, # <<<<<<<<<<<<<< * size=num_threads).astype(np.uint32) * */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 950, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 962, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_iinfo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 950, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_iinfo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 962, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 950, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 962, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 950, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 962, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -7787,21 +7978,21 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 950, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 962, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 950, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 962, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":949 + /* "lightfm/_lightfm_fast_openmp.pyx":961 * cdef unsigned int[::1] random_states * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 949, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 961, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -7810,46 +8001,46 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); __pyx_t_5 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":951 + /* "lightfm/_lightfm_fast_openmp.pyx":963 * random_states = random_state.randint(0, * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) # <<<<<<<<<<<<<< * * no_examples = user_ids.shape[0] */ - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 951, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 963, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_num_threads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 951, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_num_threads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 963, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_size, __pyx_t_6) < 0) __PYX_ERR(0, 951, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_size, __pyx_t_6) < 0) __PYX_ERR(0, 963, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":949 + /* "lightfm/_lightfm_fast_openmp.pyx":961 * cdef unsigned int[::1] random_states * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 949, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 961, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":951 + /* "lightfm/_lightfm_fast_openmp.pyx":963 * random_states = random_state.randint(0, * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) # <<<<<<<<<<<<<< * * no_examples = user_ids.shape[0] */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 951, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 963, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 951, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 963, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 951, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 963, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -7865,16 +8056,16 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 951, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 963, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 951, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 963, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_random_states = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "lightfm/_lightfm_fast_openmp.pyx":953 + /* "lightfm/_lightfm_fast_openmp.pyx":965 * size=num_threads).astype(np.uint32) * * no_examples = user_ids.shape[0] # <<<<<<<<<<<<<< @@ -7883,7 +8074,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_no_examples = (__pyx_v_user_ids.shape[0]); - /* "lightfm/_lightfm_fast_openmp.pyx":954 + /* "lightfm/_lightfm_fast_openmp.pyx":966 * * no_examples = user_ids.shape[0] * MAX_LOSS = 10.0 # <<<<<<<<<<<<<< @@ -7892,7 +8083,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_MAX_LOSS = 10.0; - /* "lightfm/_lightfm_fast_openmp.pyx":956 + /* "lightfm/_lightfm_fast_openmp.pyx":968 * MAX_LOSS = 10.0 * * with nogil, parallel(num_threads=num_threads): # <<<<<<<<<<<<<< @@ -7914,7 +8105,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U #define unlikely(x) (x) #endif #ifdef _OPENMP - #pragma omp parallel private(__pyx_v_neg_it_repr, __pyx_v_pos_it_repr, __pyx_v_pos_pairs, __pyx_v_user_repr) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_8, __pyx_t_9) num_threads(__pyx_v_num_threads) + #pragma omp parallel private(__pyx_v_neg_it_repr, __pyx_v_pos_it_repr, __pyx_v_pos_pairs, __pyx_v_user_repr) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_8, __pyx_t_9) num_threads(__pyx_v_num_threads) #endif /* _OPENMP */ { /* Initialize private variables to invalid values */ @@ -7923,7 +8114,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U __pyx_v_pos_pairs = ((struct __pyx_t_7lightfm_20_lightfm_fast_openmp_Pair *)1); __pyx_v_user_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)1); - /* "lightfm/_lightfm_fast_openmp.pyx":958 + /* "lightfm/_lightfm_fast_openmp.pyx":970 * with nogil, parallel(num_threads=num_threads): * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -7932,7 +8123,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_user_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":959 + /* "lightfm/_lightfm_fast_openmp.pyx":971 * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * pos_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -7941,7 +8132,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_pos_it_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":960 + /* "lightfm/_lightfm_fast_openmp.pyx":972 * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * pos_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * neg_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -7950,7 +8141,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_neg_it_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":961 + /* "lightfm/_lightfm_fast_openmp.pyx":973 * pos_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * neg_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * pos_pairs = malloc(sizeof(Pair) * n) # <<<<<<<<<<<<<< @@ -7959,7 +8150,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_pos_pairs = ((struct __pyx_t_7lightfm_20_lightfm_fast_openmp_Pair *)malloc(((sizeof(struct __pyx_t_7lightfm_20_lightfm_fast_openmp_Pair)) * __pyx_v_n))); - /* "lightfm/_lightfm_fast_openmp.pyx":963 + /* "lightfm/_lightfm_fast_openmp.pyx":975 * pos_pairs = malloc(sizeof(Pair) * n) * * for i in prange(no_examples): # <<<<<<<<<<<<<< @@ -7967,7 +8158,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U * user_id = user_ids[row] */ __pyx_t_8 = __pyx_v_no_examples; - if (1 == 0) abort(); + if ((1 == 0)) abort(); { __pyx_t_10 = (__pyx_t_8 - 0 + 1 - 1/abs(1)) / 1; if (__pyx_t_10 > 0) @@ -7994,7 +8185,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U __pyx_v_user_pids_start = ((int)0xbad0bad0); __pyx_v_user_pids_stop = ((int)0xbad0bad0); - /* "lightfm/_lightfm_fast_openmp.pyx":964 + /* "lightfm/_lightfm_fast_openmp.pyx":976 * * for i in prange(no_examples): * row = shuffle_indices[i] # <<<<<<<<<<<<<< @@ -8004,17 +8195,17 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U __pyx_t_11 = __pyx_v_i; __pyx_v_row = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_shuffle_indices.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":965 + /* "lightfm/_lightfm_fast_openmp.pyx":977 * for i in prange(no_examples): * row = shuffle_indices[i] * user_id = user_ids[row] # <<<<<<<<<<<<<< * * compute_representation(user_features, */ - __pyx_t_12 = __pyx_v_row; - __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_12)) ))); + __pyx_t_11 = __pyx_v_row; + __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":967 + /* "lightfm/_lightfm_fast_openmp.pyx":979 * user_id = user_ids[row] * * compute_representation(user_features, # <<<<<<<<<<<<<< @@ -8023,7 +8214,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_biases, __pyx_v_lightfm, __pyx_v_user_id, __pyx_v_lightfm->user_scale, __pyx_v_user_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":975 + /* "lightfm/_lightfm_fast_openmp.pyx":987 * user_repr) * * user_pids_start = data.get_row_start(user_id) # <<<<<<<<<<<<<< @@ -8032,7 +8223,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_user_pids_start = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_data->__pyx_vtab)->get_row_start(__pyx_v_data, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_openmp.pyx":976 + /* "lightfm/_lightfm_fast_openmp.pyx":988 * * user_pids_start = data.get_row_start(user_id) * user_pids_stop = data.get_row_end(user_id) # <<<<<<<<<<<<<< @@ -8041,17 +8232,17 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_user_pids_stop = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_data->__pyx_vtab)->get_row_end(__pyx_v_data, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_openmp.pyx":978 + /* "lightfm/_lightfm_fast_openmp.pyx":990 * user_pids_stop = data.get_row_end(user_id) * * if user_pids_stop == user_pids_start: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_13 = ((__pyx_v_user_pids_stop == __pyx_v_user_pids_start) != 0); - if (__pyx_t_13) { + __pyx_t_12 = ((__pyx_v_user_pids_stop == __pyx_v_user_pids_start) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_openmp.pyx":979 + /* "lightfm/_lightfm_fast_openmp.pyx":991 * * if user_pids_stop == user_pids_start: * continue # <<<<<<<<<<<<<< @@ -8060,7 +8251,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ goto __pyx_L10_continue; - /* "lightfm/_lightfm_fast_openmp.pyx":978 + /* "lightfm/_lightfm_fast_openmp.pyx":990 * user_pids_stop = data.get_row_end(user_id) * * if user_pids_stop == user_pids_start: # <<<<<<<<<<<<<< @@ -8069,7 +8260,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ } - /* "lightfm/_lightfm_fast_openmp.pyx":982 + /* "lightfm/_lightfm_fast_openmp.pyx":994 * * # Sample k-th positive item * no_positives = int_min(n, user_pids_stop - user_pids_start) # <<<<<<<<<<<<<< @@ -8078,38 +8269,38 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_no_positives = __pyx_f_7lightfm_20_lightfm_fast_openmp_int_min(__pyx_v_n, (__pyx_v_user_pids_stop - __pyx_v_user_pids_start)); - /* "lightfm/_lightfm_fast_openmp.pyx":983 + /* "lightfm/_lightfm_fast_openmp.pyx":995 * # Sample k-th positive item * no_positives = int_min(n, user_pids_stop - user_pids_start) * for j in range(no_positives): # <<<<<<<<<<<<<< * sampled_positive_item_id = data.indices[sample_range(user_pids_start, * user_pids_stop, */ - __pyx_t_14 = __pyx_v_no_positives; - __pyx_t_15 = __pyx_t_14; - for (__pyx_t_16 = 0; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { - __pyx_v_j = __pyx_t_16; + __pyx_t_13 = __pyx_v_no_positives; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_j = __pyx_t_15; - /* "lightfm/_lightfm_fast_openmp.pyx":986 + /* "lightfm/_lightfm_fast_openmp.pyx":998 * sampled_positive_item_id = data.indices[sample_range(user_pids_start, * user_pids_stop, * &random_states[openmp.omp_get_thread_num()])] # <<<<<<<<<<<<<< * * compute_representation(item_features, */ - __pyx_t_17 = omp_get_thread_num(); + __pyx_t_11 = omp_get_thread_num(); - /* "lightfm/_lightfm_fast_openmp.pyx":984 + /* "lightfm/_lightfm_fast_openmp.pyx":996 * no_positives = int_min(n, user_pids_stop - user_pids_start) * for j in range(no_positives): * sampled_positive_item_id = data.indices[sample_range(user_pids_start, # <<<<<<<<<<<<<< * user_pids_stop, * &random_states[openmp.omp_get_thread_num()])] */ - __pyx_t_18 = __pyx_f_7lightfm_20_lightfm_fast_openmp_sample_range(__pyx_v_user_pids_start, __pyx_v_user_pids_stop, (&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_17)) ))))); - __pyx_v_sampled_positive_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_data->indices.data) + __pyx_t_18)) ))); + __pyx_t_16 = __pyx_f_7lightfm_20_lightfm_fast_openmp_sample_range(__pyx_v_user_pids_start, __pyx_v_user_pids_stop, (&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_11)) ))))); + __pyx_v_sampled_positive_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_data->indices.data) + __pyx_t_16)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":988 + /* "lightfm/_lightfm_fast_openmp.pyx":1000 * &random_states[openmp.omp_get_thread_num()])] * * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -8118,7 +8309,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_sampled_positive_item_id, __pyx_v_lightfm->item_scale, __pyx_v_pos_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":996 + /* "lightfm/_lightfm_fast_openmp.pyx":1008 * pos_it_repr) * * sampled_positive_prediction = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -8127,7 +8318,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_sampled_positive_prediction = __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_pos_it_repr, __pyx_v_lightfm->no_components); - /* "lightfm/_lightfm_fast_openmp.pyx":1000 + /* "lightfm/_lightfm_fast_openmp.pyx":1012 * lightfm.no_components) * * pos_pairs[j].idx = sampled_positive_item_id # <<<<<<<<<<<<<< @@ -8136,7 +8327,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ (__pyx_v_pos_pairs[__pyx_v_j]).idx = __pyx_v_sampled_positive_item_id; - /* "lightfm/_lightfm_fast_openmp.pyx":1001 + /* "lightfm/_lightfm_fast_openmp.pyx":1013 * * pos_pairs[j].idx = sampled_positive_item_id * pos_pairs[j].val = sampled_positive_prediction # <<<<<<<<<<<<<< @@ -8146,7 +8337,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U (__pyx_v_pos_pairs[__pyx_v_j]).val = __pyx_v_sampled_positive_prediction; } - /* "lightfm/_lightfm_fast_openmp.pyx":1003 + /* "lightfm/_lightfm_fast_openmp.pyx":1015 * pos_pairs[j].val = sampled_positive_prediction * * qsort(pos_pairs, # <<<<<<<<<<<<<< @@ -8155,27 +8346,27 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ qsort(__pyx_v_pos_pairs, __pyx_v_no_positives, (sizeof(struct __pyx_t_7lightfm_20_lightfm_fast_openmp_Pair)), __pyx_f_7lightfm_20_lightfm_fast_openmp_reverse_pair_compare); - /* "lightfm/_lightfm_fast_openmp.pyx":1008 + /* "lightfm/_lightfm_fast_openmp.pyx":1020 * reverse_pair_compare) * * positive_item_id = pos_pairs[int_min(k, no_positives) - 1].idx # <<<<<<<<<<<<<< * positive_prediction = pos_pairs[int_min(k, no_positives) - 1].val * */ - __pyx_t_14 = (__pyx_v_pos_pairs[(__pyx_f_7lightfm_20_lightfm_fast_openmp_int_min(__pyx_v_k, __pyx_v_no_positives) - 1)]).idx; - __pyx_v_positive_item_id = __pyx_t_14; + __pyx_t_13 = (__pyx_v_pos_pairs[(__pyx_f_7lightfm_20_lightfm_fast_openmp_int_min(__pyx_v_k, __pyx_v_no_positives) - 1)]).idx; + __pyx_v_positive_item_id = __pyx_t_13; - /* "lightfm/_lightfm_fast_openmp.pyx":1009 + /* "lightfm/_lightfm_fast_openmp.pyx":1021 * * positive_item_id = pos_pairs[int_min(k, no_positives) - 1].idx * positive_prediction = pos_pairs[int_min(k, no_positives) - 1].val # <<<<<<<<<<<<<< * * compute_representation(item_features, */ - __pyx_t_19 = (__pyx_v_pos_pairs[(__pyx_f_7lightfm_20_lightfm_fast_openmp_int_min(__pyx_v_k, __pyx_v_no_positives) - 1)]).val; - __pyx_v_positive_prediction = __pyx_t_19; + __pyx_t_17 = (__pyx_v_pos_pairs[(__pyx_f_7lightfm_20_lightfm_fast_openmp_int_min(__pyx_v_k, __pyx_v_no_positives) - 1)]).val; + __pyx_v_positive_prediction = __pyx_t_17; - /* "lightfm/_lightfm_fast_openmp.pyx":1011 + /* "lightfm/_lightfm_fast_openmp.pyx":1023 * positive_prediction = pos_pairs[int_min(k, no_positives) - 1].val * * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -8184,7 +8375,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_positive_item_id, __pyx_v_lightfm->item_scale, __pyx_v_pos_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1020 + /* "lightfm/_lightfm_fast_openmp.pyx":1032 * * # Move on to the WARP step * sampled = 0 # <<<<<<<<<<<<<< @@ -8193,7 +8384,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_sampled = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":1022 + /* "lightfm/_lightfm_fast_openmp.pyx":1034 * sampled = 0 * * while sampled < lightfm.max_sampled: # <<<<<<<<<<<<<< @@ -8201,10 +8392,10 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U * sampled = sampled + 1 */ while (1) { - __pyx_t_13 = ((__pyx_v_sampled < __pyx_v_lightfm->max_sampled) != 0); - if (!__pyx_t_13) break; + __pyx_t_12 = ((__pyx_v_sampled < __pyx_v_lightfm->max_sampled) != 0); + if (!__pyx_t_12) break; - /* "lightfm/_lightfm_fast_openmp.pyx":1024 + /* "lightfm/_lightfm_fast_openmp.pyx":1036 * while sampled < lightfm.max_sampled: * * sampled = sampled + 1 # <<<<<<<<<<<<<< @@ -8213,25 +8404,25 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_sampled = (__pyx_v_sampled + 1); - /* "lightfm/_lightfm_fast_openmp.pyx":1025 + /* "lightfm/_lightfm_fast_openmp.pyx":1037 * * sampled = sampled + 1 * negative_item_id = (rand_r(&random_states[openmp.omp_get_thread_num()]) # <<<<<<<<<<<<<< * % item_features.rows) * */ - __pyx_t_20 = omp_get_thread_num(); + __pyx_t_11 = omp_get_thread_num(); - /* "lightfm/_lightfm_fast_openmp.pyx":1026 + /* "lightfm/_lightfm_fast_openmp.pyx":1038 * sampled = sampled + 1 * negative_item_id = (rand_r(&random_states[openmp.omp_get_thread_num()]) * % item_features.rows) # <<<<<<<<<<<<<< * * compute_representation(item_features, */ - __pyx_v_negative_item_id = (__pyx_f_7lightfm_20_lightfm_fast_openmp_rand_r((&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_20)) ))))) % __pyx_v_item_features->rows); + __pyx_v_negative_item_id = (__pyx_f_7lightfm_20_lightfm_fast_openmp_rand_r((&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_11)) ))))) % __pyx_v_item_features->rows); - /* "lightfm/_lightfm_fast_openmp.pyx":1028 + /* "lightfm/_lightfm_fast_openmp.pyx":1040 * % item_features.rows) * * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -8240,7 +8431,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_negative_item_id, __pyx_v_lightfm->item_scale, __pyx_v_neg_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1036 + /* "lightfm/_lightfm_fast_openmp.pyx":1048 * neg_it_repr) * * negative_prediction = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -8249,27 +8440,27 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_negative_prediction = __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_neg_it_repr, __pyx_v_lightfm->no_components); - /* "lightfm/_lightfm_fast_openmp.pyx":1040 + /* "lightfm/_lightfm_fast_openmp.pyx":1052 * lightfm.no_components) * * if negative_prediction > positive_prediction - 1: # <<<<<<<<<<<<<< * * if in_positives(negative_item_id, user_id, data): */ - __pyx_t_13 = ((__pyx_v_negative_prediction > (__pyx_v_positive_prediction - 1.0)) != 0); - if (__pyx_t_13) { + __pyx_t_12 = ((__pyx_v_negative_prediction > (__pyx_v_positive_prediction - 1.0)) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_openmp.pyx":1042 + /* "lightfm/_lightfm_fast_openmp.pyx":1054 * if negative_prediction > positive_prediction - 1: * * if in_positives(negative_item_id, user_id, data): # <<<<<<<<<<<<<< * continue * */ - __pyx_t_13 = (__pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(__pyx_v_negative_item_id, __pyx_v_user_id, __pyx_v_data) != 0); - if (__pyx_t_13) { + __pyx_t_12 = (__pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(__pyx_v_negative_item_id, __pyx_v_user_id, __pyx_v_data) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_openmp.pyx":1043 + /* "lightfm/_lightfm_fast_openmp.pyx":1055 * * if in_positives(negative_item_id, user_id, data): * continue # <<<<<<<<<<<<<< @@ -8278,7 +8469,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ goto __pyx_L17_continue; - /* "lightfm/_lightfm_fast_openmp.pyx":1042 + /* "lightfm/_lightfm_fast_openmp.pyx":1054 * if negative_prediction > positive_prediction - 1: * * if in_positives(negative_item_id, user_id, data): # <<<<<<<<<<<<<< @@ -8287,7 +8478,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ } - /* "lightfm/_lightfm_fast_openmp.pyx":1045 + /* "lightfm/_lightfm_fast_openmp.pyx":1057 * continue * * loss = log(floor((item_features.rows - 1) / sampled)) # <<<<<<<<<<<<<< @@ -8296,17 +8487,17 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_loss = log(floor(((__pyx_v_item_features->rows - 1) / __pyx_v_sampled))); - /* "lightfm/_lightfm_fast_openmp.pyx":1048 + /* "lightfm/_lightfm_fast_openmp.pyx":1060 * * # Clip gradients for numerical stability. * if loss > MAX_LOSS: # <<<<<<<<<<<<<< * loss = MAX_LOSS * */ - __pyx_t_13 = ((__pyx_v_loss > __pyx_v_MAX_LOSS) != 0); - if (__pyx_t_13) { + __pyx_t_12 = ((__pyx_v_loss > __pyx_v_MAX_LOSS) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_openmp.pyx":1049 + /* "lightfm/_lightfm_fast_openmp.pyx":1061 * # Clip gradients for numerical stability. * if loss > MAX_LOSS: * loss = MAX_LOSS # <<<<<<<<<<<<<< @@ -8315,7 +8506,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_v_loss = __pyx_v_MAX_LOSS; - /* "lightfm/_lightfm_fast_openmp.pyx":1048 + /* "lightfm/_lightfm_fast_openmp.pyx":1060 * * # Clip gradients for numerical stability. * if loss > MAX_LOSS: # <<<<<<<<<<<<<< @@ -8324,7 +8515,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ } - /* "lightfm/_lightfm_fast_openmp.pyx":1051 + /* "lightfm/_lightfm_fast_openmp.pyx":1063 * loss = MAX_LOSS * * warp_update(loss, # <<<<<<<<<<<<<< @@ -8333,7 +8524,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update(__pyx_v_loss, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_user_id, __pyx_v_positive_item_id, __pyx_v_negative_item_id, __pyx_v_user_repr, __pyx_v_pos_it_repr, __pyx_v_neg_it_repr, __pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_openmp.pyx":1063 + /* "lightfm/_lightfm_fast_openmp.pyx":1075 * item_alpha, * user_alpha) * break # <<<<<<<<<<<<<< @@ -8342,7 +8533,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ goto __pyx_L18_break; - /* "lightfm/_lightfm_fast_openmp.pyx":1040 + /* "lightfm/_lightfm_fast_openmp.pyx":1052 * lightfm.no_components) * * if negative_prediction > positive_prediction - 1: # <<<<<<<<<<<<<< @@ -8354,25 +8545,25 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U } __pyx_L18_break:; - /* "lightfm/_lightfm_fast_openmp.pyx":1065 + /* "lightfm/_lightfm_fast_openmp.pyx":1077 * break * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< * locked_regularize(lightfm, * item_alpha, */ - __pyx_t_21 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); - if (!__pyx_t_21) { + __pyx_t_18 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); + if (!__pyx_t_18) { } else { - __pyx_t_13 = __pyx_t_21; + __pyx_t_12 = __pyx_t_18; goto __pyx_L23_bool_binop_done; } - __pyx_t_21 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); - __pyx_t_13 = __pyx_t_21; + __pyx_t_18 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); + __pyx_t_12 = __pyx_t_18; __pyx_L23_bool_binop_done:; - if (__pyx_t_13) { + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_openmp.pyx":1066 + /* "lightfm/_lightfm_fast_openmp.pyx":1078 * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: * locked_regularize(lightfm, # <<<<<<<<<<<<<< @@ -8381,7 +8572,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_f_7lightfm_20_lightfm_fast_openmp_locked_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_openmp.pyx":1065 + /* "lightfm/_lightfm_fast_openmp.pyx":1077 * break * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< @@ -8398,7 +8589,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U } } - /* "lightfm/_lightfm_fast_openmp.pyx":1070 + /* "lightfm/_lightfm_fast_openmp.pyx":1082 * user_alpha) * * free(user_repr) # <<<<<<<<<<<<<< @@ -8407,7 +8598,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ free(__pyx_v_user_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1071 + /* "lightfm/_lightfm_fast_openmp.pyx":1083 * * free(user_repr) * free(pos_it_repr) # <<<<<<<<<<<<<< @@ -8416,7 +8607,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ free(__pyx_v_pos_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1072 + /* "lightfm/_lightfm_fast_openmp.pyx":1084 * free(user_repr) * free(pos_it_repr) * free(neg_it_repr) # <<<<<<<<<<<<<< @@ -8425,7 +8616,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ free(__pyx_v_neg_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1073 + /* "lightfm/_lightfm_fast_openmp.pyx":1085 * free(pos_it_repr) * free(neg_it_repr) * free(pos_pairs) # <<<<<<<<<<<<<< @@ -8443,7 +8634,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U #endif } - /* "lightfm/_lightfm_fast_openmp.pyx":956 + /* "lightfm/_lightfm_fast_openmp.pyx":968 * MAX_LOSS = 10.0 * * with nogil, parallel(num_threads=num_threads): # <<<<<<<<<<<<<< @@ -8462,7 +8653,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U } } - /* "lightfm/_lightfm_fast_openmp.pyx":1075 + /* "lightfm/_lightfm_fast_openmp.pyx":1087 * free(pos_pairs) * * regularize(lightfm, # <<<<<<<<<<<<<< @@ -8471,7 +8662,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U */ __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_openmp.pyx":921 + /* "lightfm/_lightfm_fast_openmp.pyx":933 * * * def fit_warp_kos(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -8501,7 +8692,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_4fit_warp_kos(CYTHON_U return __pyx_r; } -/* "lightfm/_lightfm_fast_openmp.pyx":1080 +/* "lightfm/_lightfm_fast_openmp.pyx":1092 * * * def fit_bpr(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -8528,6 +8719,9 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_7fit_bpr(PyObject *__p double __pyx_v_user_alpha; int __pyx_v_num_threads; PyObject *__pyx_v_random_state = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("fit_bpr (wrapper)", 0); @@ -8578,83 +8772,83 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_7fit_bpr(PyObject *__p case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 1); __PYX_ERR(0, 1080, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 1); __PYX_ERR(0, 1092, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_interactions)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 2); __PYX_ERR(0, 1080, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 2); __PYX_ERR(0, 1092, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 3); __PYX_ERR(0, 1080, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 3); __PYX_ERR(0, 1092, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 4); __PYX_ERR(0, 1080, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 4); __PYX_ERR(0, 1092, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_Y)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 5); __PYX_ERR(0, 1080, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 5); __PYX_ERR(0, 1092, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_sample_weight)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 6); __PYX_ERR(0, 1080, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 6); __PYX_ERR(0, 1092, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 7: if (likely((values[7] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_shuffle_indices)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 7); __PYX_ERR(0, 1080, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 7); __PYX_ERR(0, 1092, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 8: if (likely((values[8] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lightfm)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 8); __PYX_ERR(0, 1080, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 8); __PYX_ERR(0, 1092, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 9: if (likely((values[9] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_learning_rate)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 9); __PYX_ERR(0, 1080, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 9); __PYX_ERR(0, 1092, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 10: if (likely((values[10] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 10); __PYX_ERR(0, 1080, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 10); __PYX_ERR(0, 1092, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 11: if (likely((values[11] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_alpha)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 11); __PYX_ERR(0, 1080, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 11); __PYX_ERR(0, 1092, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 12: if (likely((values[12] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 12); __PYX_ERR(0, 1080, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 12); __PYX_ERR(0, 1092, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 13: if (likely((values[13] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_random_state)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 13); __PYX_ERR(0, 1080, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, 13); __PYX_ERR(0, 1092, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_bpr") < 0)) __PYX_ERR(0, 1080, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "fit_bpr") < 0)) __PYX_ERR(0, 1092, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 14) { goto __pyx_L5_argtuple_error; @@ -8677,30 +8871,30 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_7fit_bpr(PyObject *__p __pyx_v_item_features = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[0]); __pyx_v_user_features = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[1]); __pyx_v_interactions = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[2]); - __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 1083, __pyx_L3_error) - __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 1084, __pyx_L3_error) - __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_Y.memview)) __PYX_ERR(0, 1085, __pyx_L3_error) - __pyx_v_sample_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_sample_weight.memview)) __PYX_ERR(0, 1086, __pyx_L3_error) - __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 1087, __pyx_L3_error) + __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 1095, __pyx_L3_error) + __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 1096, __pyx_L3_error) + __pyx_v_Y = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[5], PyBUF_WRITABLE); if (unlikely(!__pyx_v_Y.memview)) __PYX_ERR(0, 1097, __pyx_L3_error) + __pyx_v_sample_weight = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[6], PyBUF_WRITABLE); if (unlikely(!__pyx_v_sample_weight.memview)) __PYX_ERR(0, 1098, __pyx_L3_error) + __pyx_v_shuffle_indices = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[7], PyBUF_WRITABLE); if (unlikely(!__pyx_v_shuffle_indices.memview)) __PYX_ERR(0, 1099, __pyx_L3_error) __pyx_v_lightfm = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *)values[8]); - __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1089, __pyx_L3_error) - __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1090, __pyx_L3_error) - __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1091, __pyx_L3_error) - __pyx_v_num_threads = __Pyx_PyInt_As_int(values[12]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1092, __pyx_L3_error) + __pyx_v_learning_rate = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_learning_rate == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1101, __pyx_L3_error) + __pyx_v_item_alpha = __pyx_PyFloat_AsDouble(values[10]); if (unlikely((__pyx_v_item_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1102, __pyx_L3_error) + __pyx_v_user_alpha = __pyx_PyFloat_AsDouble(values[11]); if (unlikely((__pyx_v_user_alpha == (double)-1) && PyErr_Occurred())) __PYX_ERR(0, 1103, __pyx_L3_error) + __pyx_v_num_threads = __Pyx_PyInt_As_int(values[12]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1104, __pyx_L3_error) __pyx_v_random_state = values[13]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1080, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("fit_bpr", 1, 14, 14, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1092, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_openmp.fit_bpr", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 1080, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 1081, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interactions), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "interactions", 0))) __PYX_ERR(0, 1082, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 1088, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 1092, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 1093, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_interactions), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "interactions", 0))) __PYX_ERR(0, 1094, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 1100, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(__pyx_self, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_interactions, __pyx_v_user_ids, __pyx_v_item_ids, __pyx_v_Y, __pyx_v_sample_weight, __pyx_v_shuffle_indices, __pyx_v_lightfm, __pyx_v_learning_rate, __pyx_v_item_alpha, __pyx_v_user_alpha, __pyx_v_num_threads, __pyx_v_random_state); /* function exit code */ @@ -8740,44 +8934,42 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED int __pyx_t_9; int __pyx_t_10; Py_ssize_t __pyx_t_11; - Py_ssize_t __pyx_t_12; + int __pyx_t_12; int __pyx_t_13; - Py_ssize_t __pyx_t_14; - Py_ssize_t __pyx_t_15; + int __pyx_t_14; + int __pyx_t_15; Py_ssize_t __pyx_t_16; int __pyx_t_17; - int __pyx_t_18; - int __pyx_t_19; - Py_ssize_t __pyx_t_20; - Py_ssize_t __pyx_t_21; - int __pyx_t_22; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("fit_bpr", 0); - /* "lightfm/_lightfm_fast_openmp.pyx":1107 + /* "lightfm/_lightfm_fast_openmp.pyx":1119 * cdef flt *neg_it_repr * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_randint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1107, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_random_state, __pyx_n_s_randint); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - /* "lightfm/_lightfm_fast_openmp.pyx":1108 + /* "lightfm/_lightfm_fast_openmp.pyx":1120 * * random_states = random_state.randint(0, * np.iinfo(np.int32).max, # <<<<<<<<<<<<<< * size=num_threads).astype(np.uint32) * */ - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1108, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_iinfo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1108, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_iinfo); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1108, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_4, __pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 1120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1108, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_int32); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = NULL; @@ -8793,21 +8985,21 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED __pyx_t_3 = (__pyx_t_4) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_4, __pyx_t_6) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_6); __Pyx_XDECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1108, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1108, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_max); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1120, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":1107 + /* "lightfm/_lightfm_fast_openmp.pyx":1119 * cdef flt *neg_it_repr * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1107, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); @@ -8816,46 +9008,46 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); __pyx_t_5 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":1109 + /* "lightfm/_lightfm_fast_openmp.pyx":1121 * random_states = random_state.randint(0, * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) # <<<<<<<<<<<<<< * * no_examples = Y.shape[0] */ - __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1109, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_num_threads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1109, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyInt_From_int(__pyx_v_num_threads); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_size, __pyx_t_6) < 0) __PYX_ERR(0, 1109, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_5, __pyx_n_s_size, __pyx_t_6) < 0) __PYX_ERR(0, 1121, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":1107 + /* "lightfm/_lightfm_fast_openmp.pyx":1119 * cdef flt *neg_it_repr * * random_states = random_state.randint(0, # <<<<<<<<<<<<<< * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) */ - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1107, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1119, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":1109 + /* "lightfm/_lightfm_fast_openmp.pyx":1121 * random_states = random_state.randint(0, * np.iinfo(np.int32).max, * size=num_threads).astype(np.uint32) # <<<<<<<<<<<<<< * * no_examples = Y.shape[0] */ - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1109, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_astype); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 1121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1109, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 1121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1109, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_uint32); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_6 = NULL; @@ -8871,16 +9063,16 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED __pyx_t_1 = (__pyx_t_6) ? __Pyx_PyObject_Call2Args(__pyx_t_5, __pyx_t_6, __pyx_t_3) : __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_3); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1109, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1121, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1109, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(__pyx_t_1, PyBUF_WRITABLE); if (unlikely(!__pyx_t_7.memview)) __PYX_ERR(0, 1121, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_random_states = __pyx_t_7; __pyx_t_7.memview = NULL; __pyx_t_7.data = NULL; - /* "lightfm/_lightfm_fast_openmp.pyx":1111 + /* "lightfm/_lightfm_fast_openmp.pyx":1123 * size=num_threads).astype(np.uint32) * * no_examples = Y.shape[0] # <<<<<<<<<<<<<< @@ -8889,7 +9081,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ __pyx_v_no_examples = (__pyx_v_Y.shape[0]); - /* "lightfm/_lightfm_fast_openmp.pyx":1113 + /* "lightfm/_lightfm_fast_openmp.pyx":1125 * no_examples = Y.shape[0] * * with nogil, parallel(num_threads=num_threads): # <<<<<<<<<<<<<< @@ -8911,7 +9103,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED #define unlikely(x) (x) #endif #ifdef _OPENMP - #pragma omp parallel private(__pyx_v_neg_it_repr, __pyx_v_pos_it_repr, __pyx_v_user_repr) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_18, __pyx_t_19, __pyx_t_20, __pyx_t_21, __pyx_t_22, __pyx_t_8, __pyx_t_9) num_threads(__pyx_v_num_threads) + #pragma omp parallel private(__pyx_v_neg_it_repr, __pyx_v_pos_it_repr, __pyx_v_user_repr) private(__pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_15, __pyx_t_16, __pyx_t_17, __pyx_t_8, __pyx_t_9) num_threads(__pyx_v_num_threads) #endif /* _OPENMP */ { /* Initialize private variables to invalid values */ @@ -8919,7 +9111,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED __pyx_v_pos_it_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)1); __pyx_v_user_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)1); - /* "lightfm/_lightfm_fast_openmp.pyx":1115 + /* "lightfm/_lightfm_fast_openmp.pyx":1127 * with nogil, parallel(num_threads=num_threads): * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -8928,7 +9120,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ __pyx_v_user_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":1116 + /* "lightfm/_lightfm_fast_openmp.pyx":1128 * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * pos_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -8937,7 +9129,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ __pyx_v_pos_it_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":1117 + /* "lightfm/_lightfm_fast_openmp.pyx":1129 * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * pos_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * neg_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -8946,7 +9138,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ __pyx_v_neg_it_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":1119 + /* "lightfm/_lightfm_fast_openmp.pyx":1131 * neg_it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * * for i in prange(no_examples): # <<<<<<<<<<<<<< @@ -8954,7 +9146,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED * */ __pyx_t_8 = __pyx_v_no_examples; - if (1 == 0) abort(); + if ((1 == 0)) abort(); { __pyx_t_10 = (__pyx_t_8 - 0 + 1 - 1/abs(1)) / 1; if (__pyx_t_10 > 0) @@ -8975,7 +9167,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED __pyx_v_user_id = ((int)0xbad0bad0); __pyx_v_weight = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)__PYX_NAN()); - /* "lightfm/_lightfm_fast_openmp.pyx":1120 + /* "lightfm/_lightfm_fast_openmp.pyx":1132 * * for i in prange(no_examples): * row = shuffle_indices[i] # <<<<<<<<<<<<<< @@ -8985,18 +9177,18 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED __pyx_t_11 = __pyx_v_i; __pyx_v_row = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_shuffle_indices.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":1122 + /* "lightfm/_lightfm_fast_openmp.pyx":1134 * row = shuffle_indices[i] * * if not Y[row] > 0: # <<<<<<<<<<<<<< * continue * */ - __pyx_t_12 = __pyx_v_row; - __pyx_t_13 = ((!(((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_Y.data) + __pyx_t_12)) ))) > 0.0) != 0)) != 0); - if (__pyx_t_13) { + __pyx_t_11 = __pyx_v_row; + __pyx_t_12 = ((!(((*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_Y.data) + __pyx_t_11)) ))) > 0.0) != 0)) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_openmp.pyx":1123 + /* "lightfm/_lightfm_fast_openmp.pyx":1135 * * if not Y[row] > 0: * continue # <<<<<<<<<<<<<< @@ -9005,7 +9197,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ goto __pyx_L10_continue; - /* "lightfm/_lightfm_fast_openmp.pyx":1122 + /* "lightfm/_lightfm_fast_openmp.pyx":1134 * row = shuffle_indices[i] * * if not Y[row] > 0: # <<<<<<<<<<<<<< @@ -9014,78 +9206,78 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ } - /* "lightfm/_lightfm_fast_openmp.pyx":1125 + /* "lightfm/_lightfm_fast_openmp.pyx":1137 * continue * * weight = sample_weight[row] # <<<<<<<<<<<<<< * user_id = user_ids[row] * positive_item_id = item_ids[row] */ - __pyx_t_14 = __pyx_v_row; - __pyx_v_weight = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_sample_weight.data) + __pyx_t_14)) ))); + __pyx_t_11 = __pyx_v_row; + __pyx_v_weight = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_sample_weight.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":1126 + /* "lightfm/_lightfm_fast_openmp.pyx":1138 * * weight = sample_weight[row] * user_id = user_ids[row] # <<<<<<<<<<<<<< * positive_item_id = item_ids[row] * */ - __pyx_t_15 = __pyx_v_row; - __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_15)) ))); + __pyx_t_11 = __pyx_v_row; + __pyx_v_user_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":1127 + /* "lightfm/_lightfm_fast_openmp.pyx":1139 * weight = sample_weight[row] * user_id = user_ids[row] * positive_item_id = item_ids[row] # <<<<<<<<<<<<<< * * for j in range(no_examples): */ - __pyx_t_16 = __pyx_v_row; - __pyx_v_positive_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_16)) ))); + __pyx_t_11 = __pyx_v_row; + __pyx_v_positive_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_11)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":1129 + /* "lightfm/_lightfm_fast_openmp.pyx":1141 * positive_item_id = item_ids[row] * * for j in range(no_examples): # <<<<<<<<<<<<<< * negative_item_id = item_ids[(rand_r(&random_states[openmp.omp_get_thread_num()]) * % no_examples)] */ - __pyx_t_17 = __pyx_v_no_examples; - __pyx_t_18 = __pyx_t_17; - for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { - __pyx_v_j = __pyx_t_19; + __pyx_t_13 = __pyx_v_no_examples; + __pyx_t_14 = __pyx_t_13; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_j = __pyx_t_15; - /* "lightfm/_lightfm_fast_openmp.pyx":1130 + /* "lightfm/_lightfm_fast_openmp.pyx":1142 * * for j in range(no_examples): * negative_item_id = item_ids[(rand_r(&random_states[openmp.omp_get_thread_num()]) # <<<<<<<<<<<<<< * % no_examples)] * if not in_positives(negative_item_id, user_id, interactions): */ - __pyx_t_20 = omp_get_thread_num(); + __pyx_t_11 = omp_get_thread_num(); - /* "lightfm/_lightfm_fast_openmp.pyx":1131 + /* "lightfm/_lightfm_fast_openmp.pyx":1143 * for j in range(no_examples): * negative_item_id = item_ids[(rand_r(&random_states[openmp.omp_get_thread_num()]) * % no_examples)] # <<<<<<<<<<<<<< * if not in_positives(negative_item_id, user_id, interactions): * break */ - __pyx_t_21 = (__pyx_f_7lightfm_20_lightfm_fast_openmp_rand_r((&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_20)) ))))) % __pyx_v_no_examples); - __pyx_v_negative_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_21)) ))); + __pyx_t_16 = (__pyx_f_7lightfm_20_lightfm_fast_openmp_rand_r((&(*((unsigned int *) ( /* dim=0 */ ((char *) (((unsigned int *) __pyx_v_random_states.data) + __pyx_t_11)) ))))) % __pyx_v_no_examples); + __pyx_v_negative_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_16)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":1132 + /* "lightfm/_lightfm_fast_openmp.pyx":1144 * negative_item_id = item_ids[(rand_r(&random_states[openmp.omp_get_thread_num()]) * % no_examples)] * if not in_positives(negative_item_id, user_id, interactions): # <<<<<<<<<<<<<< * break * */ - __pyx_t_13 = ((!(__pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(__pyx_v_negative_item_id, __pyx_v_user_id, __pyx_v_interactions) != 0)) != 0); - if (__pyx_t_13) { + __pyx_t_12 = ((!(__pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(__pyx_v_negative_item_id, __pyx_v_user_id, __pyx_v_interactions) != 0)) != 0); + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_openmp.pyx":1133 + /* "lightfm/_lightfm_fast_openmp.pyx":1145 * % no_examples)] * if not in_positives(negative_item_id, user_id, interactions): * break # <<<<<<<<<<<<<< @@ -9094,7 +9286,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ goto __pyx_L16_break; - /* "lightfm/_lightfm_fast_openmp.pyx":1132 + /* "lightfm/_lightfm_fast_openmp.pyx":1144 * negative_item_id = item_ids[(rand_r(&random_states[openmp.omp_get_thread_num()]) * % no_examples)] * if not in_positives(negative_item_id, user_id, interactions): # <<<<<<<<<<<<<< @@ -9105,7 +9297,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED } __pyx_L16_break:; - /* "lightfm/_lightfm_fast_openmp.pyx":1135 + /* "lightfm/_lightfm_fast_openmp.pyx":1147 * break * * compute_representation(user_features, # <<<<<<<<<<<<<< @@ -9114,7 +9306,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_biases, __pyx_v_lightfm, __pyx_v_user_id, __pyx_v_lightfm->user_scale, __pyx_v_user_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1142 + /* "lightfm/_lightfm_fast_openmp.pyx":1154 * lightfm.user_scale, * user_repr) * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -9123,7 +9315,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_positive_item_id, __pyx_v_lightfm->item_scale, __pyx_v_pos_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1149 + /* "lightfm/_lightfm_fast_openmp.pyx":1161 * lightfm.item_scale, * pos_it_repr) * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -9132,7 +9324,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_negative_item_id, __pyx_v_lightfm->item_scale, __pyx_v_neg_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1157 + /* "lightfm/_lightfm_fast_openmp.pyx":1169 * neg_it_repr) * * positive_prediction = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -9141,7 +9333,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ __pyx_v_positive_prediction = __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_pos_it_repr, __pyx_v_lightfm->no_components); - /* "lightfm/_lightfm_fast_openmp.pyx":1160 + /* "lightfm/_lightfm_fast_openmp.pyx":1172 * pos_it_repr, * lightfm.no_components) * negative_prediction = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -9150,7 +9342,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ __pyx_v_negative_prediction = __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_neg_it_repr, __pyx_v_lightfm->no_components); - /* "lightfm/_lightfm_fast_openmp.pyx":1164 + /* "lightfm/_lightfm_fast_openmp.pyx":1176 * lightfm.no_components) * * warp_update(weight * (1.0 - sigmoid(positive_prediction - negative_prediction)), # <<<<<<<<<<<<<< @@ -9159,25 +9351,25 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ __pyx_f_7lightfm_20_lightfm_fast_openmp_warp_update((__pyx_v_weight * (1.0 - __pyx_f_7lightfm_20_lightfm_fast_openmp_sigmoid((__pyx_v_positive_prediction - __pyx_v_negative_prediction)))), __pyx_v_item_features, __pyx_v_user_features, __pyx_v_user_id, __pyx_v_positive_item_id, __pyx_v_negative_item_id, __pyx_v_user_repr, __pyx_v_pos_it_repr, __pyx_v_neg_it_repr, __pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_openmp.pyx":1177 + /* "lightfm/_lightfm_fast_openmp.pyx":1189 * user_alpha) * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< * locked_regularize(lightfm, * item_alpha, */ - __pyx_t_22 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); - if (!__pyx_t_22) { + __pyx_t_17 = ((__pyx_v_lightfm->item_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); + if (!__pyx_t_17) { } else { - __pyx_t_13 = __pyx_t_22; + __pyx_t_12 = __pyx_t_17; goto __pyx_L19_bool_binop_done; } - __pyx_t_22 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); - __pyx_t_13 = __pyx_t_22; + __pyx_t_17 = ((__pyx_v_lightfm->user_scale > __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE) != 0); + __pyx_t_12 = __pyx_t_17; __pyx_L19_bool_binop_done:; - if (__pyx_t_13) { + if (__pyx_t_12) { - /* "lightfm/_lightfm_fast_openmp.pyx":1178 + /* "lightfm/_lightfm_fast_openmp.pyx":1190 * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: * locked_regularize(lightfm, # <<<<<<<<<<<<<< @@ -9186,7 +9378,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ __pyx_f_7lightfm_20_lightfm_fast_openmp_locked_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_openmp.pyx":1177 + /* "lightfm/_lightfm_fast_openmp.pyx":1189 * user_alpha) * * if lightfm.item_scale > MAX_REG_SCALE or lightfm.user_scale > MAX_REG_SCALE: # <<<<<<<<<<<<<< @@ -9203,7 +9395,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED } } - /* "lightfm/_lightfm_fast_openmp.pyx":1182 + /* "lightfm/_lightfm_fast_openmp.pyx":1194 * user_alpha) * * free(user_repr) # <<<<<<<<<<<<<< @@ -9212,7 +9404,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ free(__pyx_v_user_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1183 + /* "lightfm/_lightfm_fast_openmp.pyx":1195 * * free(user_repr) * free(pos_it_repr) # <<<<<<<<<<<<<< @@ -9221,7 +9413,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ free(__pyx_v_pos_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1184 + /* "lightfm/_lightfm_fast_openmp.pyx":1196 * free(user_repr) * free(pos_it_repr) * free(neg_it_repr) # <<<<<<<<<<<<<< @@ -9239,7 +9431,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED #endif } - /* "lightfm/_lightfm_fast_openmp.pyx":1113 + /* "lightfm/_lightfm_fast_openmp.pyx":1125 * no_examples = Y.shape[0] * * with nogil, parallel(num_threads=num_threads): # <<<<<<<<<<<<<< @@ -9258,7 +9450,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED } } - /* "lightfm/_lightfm_fast_openmp.pyx":1186 + /* "lightfm/_lightfm_fast_openmp.pyx":1198 * free(neg_it_repr) * * regularize(lightfm, # <<<<<<<<<<<<<< @@ -9267,7 +9459,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED */ __pyx_f_7lightfm_20_lightfm_fast_openmp_regularize(__pyx_v_lightfm, __pyx_v_item_alpha, __pyx_v_user_alpha); - /* "lightfm/_lightfm_fast_openmp.pyx":1080 + /* "lightfm/_lightfm_fast_openmp.pyx":1092 * * * def fit_bpr(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -9300,7 +9492,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_6fit_bpr(CYTHON_UNUSED return __pyx_r; } -/* "lightfm/_lightfm_fast_openmp.pyx":1191 +/* "lightfm/_lightfm_fast_openmp.pyx":1203 * * * def predict_lightfm(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -9320,6 +9512,9 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_9predict_lightfm(PyObj __Pyx_memviewslice __pyx_v_predictions = { 0, 0, { 0 }, { 0 }, { 0 } }; struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *__pyx_v_lightfm = 0; int __pyx_v_num_threads; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("predict_lightfm (wrapper)", 0); @@ -9356,41 +9551,41 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_9predict_lightfm(PyObj case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 1); __PYX_ERR(0, 1191, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 1); __PYX_ERR(0, 1203, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 2); __PYX_ERR(0, 1191, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 2); __PYX_ERR(0, 1203, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_item_ids)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 3); __PYX_ERR(0, 1191, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 3); __PYX_ERR(0, 1203, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_predictions)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 4); __PYX_ERR(0, 1191, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 4); __PYX_ERR(0, 1203, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lightfm)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 5); __PYX_ERR(0, 1191, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 5); __PYX_ERR(0, 1203, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 6); __PYX_ERR(0, 1191, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, 6); __PYX_ERR(0, 1203, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict_lightfm") < 0)) __PYX_ERR(0, 1191, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict_lightfm") < 0)) __PYX_ERR(0, 1203, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; @@ -9405,23 +9600,23 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_9predict_lightfm(PyObj } __pyx_v_item_features = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[0]); __pyx_v_user_features = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[1]); - __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 1193, __pyx_L3_error) - __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 1194, __pyx_L3_error) - __pyx_v_predictions = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_predictions.memview)) __PYX_ERR(0, 1195, __pyx_L3_error) + __pyx_v_user_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_user_ids.memview)) __PYX_ERR(0, 1205, __pyx_L3_error) + __pyx_v_item_ids = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_item_ids.memview)) __PYX_ERR(0, 1206, __pyx_L3_error) + __pyx_v_predictions = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_predictions.memview)) __PYX_ERR(0, 1207, __pyx_L3_error) __pyx_v_lightfm = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *)values[5]); - __pyx_v_num_threads = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1197, __pyx_L3_error) + __pyx_v_num_threads = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1209, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1191, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_lightfm", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1203, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_openmp.predict_lightfm", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 1191, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 1192, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 1196, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 1203, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 1204, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 1208, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_20_lightfm_fast_openmp_8predict_lightfm(__pyx_self, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_user_ids, __pyx_v_item_ids, __pyx_v_predictions, __pyx_v_lightfm, __pyx_v_num_threads); /* function exit code */ @@ -9444,11 +9639,9 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_8predict_lightfm(CYTHO int __pyx_t_2; int __pyx_t_3; Py_ssize_t __pyx_t_4; - Py_ssize_t __pyx_t_5; - Py_ssize_t __pyx_t_6; __Pyx_RefNannySetupContext("predict_lightfm", 0); - /* "lightfm/_lightfm_fast_openmp.pyx":1206 + /* "lightfm/_lightfm_fast_openmp.pyx":1218 * cdef flt *it_repr * * no_examples = predictions.shape[0] # <<<<<<<<<<<<<< @@ -9457,7 +9650,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_8predict_lightfm(CYTHO */ __pyx_v_no_examples = (__pyx_v_predictions.shape[0]); - /* "lightfm/_lightfm_fast_openmp.pyx":1208 + /* "lightfm/_lightfm_fast_openmp.pyx":1220 * no_examples = predictions.shape[0] * * with nogil, parallel(num_threads=num_threads): # <<<<<<<<<<<<<< @@ -9479,14 +9672,14 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_8predict_lightfm(CYTHO #define unlikely(x) (x) #endif #ifdef _OPENMP - #pragma omp parallel private(__pyx_v_it_repr, __pyx_v_user_repr) private(__pyx_t_1, __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6) num_threads(__pyx_v_num_threads) + #pragma omp parallel private(__pyx_v_it_repr, __pyx_v_user_repr) private(__pyx_t_1, __pyx_t_2, __pyx_t_3, __pyx_t_4) num_threads(__pyx_v_num_threads) #endif /* _OPENMP */ { /* Initialize private variables to invalid values */ __pyx_v_it_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)1); __pyx_v_user_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)1); - /* "lightfm/_lightfm_fast_openmp.pyx":1210 + /* "lightfm/_lightfm_fast_openmp.pyx":1222 * with nogil, parallel(num_threads=num_threads): * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -9495,7 +9688,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_8predict_lightfm(CYTHO */ __pyx_v_user_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":1211 + /* "lightfm/_lightfm_fast_openmp.pyx":1223 * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -9504,7 +9697,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_8predict_lightfm(CYTHO */ __pyx_v_it_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":1213 + /* "lightfm/_lightfm_fast_openmp.pyx":1225 * it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * * for i in prange(no_examples): # <<<<<<<<<<<<<< @@ -9512,7 +9705,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_8predict_lightfm(CYTHO * compute_representation(user_features, */ __pyx_t_1 = __pyx_v_no_examples; - if (1 == 0) abort(); + if ((1 == 0)) abort(); { __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; if (__pyx_t_3 > 0) @@ -9524,7 +9717,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_8predict_lightfm(CYTHO { __pyx_v_i = (int)(0 + 1 * __pyx_t_2); - /* "lightfm/_lightfm_fast_openmp.pyx":1219 + /* "lightfm/_lightfm_fast_openmp.pyx":1231 * lightfm.user_biases, * lightfm, * user_ids[i], # <<<<<<<<<<<<<< @@ -9533,7 +9726,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_8predict_lightfm(CYTHO */ __pyx_t_4 = __pyx_v_i; - /* "lightfm/_lightfm_fast_openmp.pyx":1215 + /* "lightfm/_lightfm_fast_openmp.pyx":1227 * for i in prange(no_examples): * * compute_representation(user_features, # <<<<<<<<<<<<<< @@ -9542,39 +9735,39 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_8predict_lightfm(CYTHO */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_biases, __pyx_v_lightfm, (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_user_ids.data) + __pyx_t_4)) ))), __pyx_v_lightfm->user_scale, __pyx_v_user_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1226 + /* "lightfm/_lightfm_fast_openmp.pyx":1238 * lightfm.item_biases, * lightfm, * item_ids[i], # <<<<<<<<<<<<<< * lightfm.item_scale, * it_repr) */ - __pyx_t_5 = __pyx_v_i; + __pyx_t_4 = __pyx_v_i; - /* "lightfm/_lightfm_fast_openmp.pyx":1222 + /* "lightfm/_lightfm_fast_openmp.pyx":1234 * lightfm.user_scale, * user_repr) * compute_representation(item_features, # <<<<<<<<<<<<<< * lightfm.item_features, * lightfm.item_biases, */ - __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_5)) ))), __pyx_v_lightfm->item_scale, __pyx_v_it_repr); + __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_item_ids.data) + __pyx_t_4)) ))), __pyx_v_lightfm->item_scale, __pyx_v_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1230 + /* "lightfm/_lightfm_fast_openmp.pyx":1242 * it_repr) * * predictions[i] = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< * it_repr, * lightfm.no_components) */ - __pyx_t_6 = __pyx_v_i; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_predictions.data) + __pyx_t_6)) )) = __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_it_repr, __pyx_v_lightfm->no_components); + __pyx_t_4 = __pyx_v_i; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_predictions.data) + __pyx_t_4)) )) = __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_it_repr, __pyx_v_lightfm->no_components); } } } } - /* "lightfm/_lightfm_fast_openmp.pyx":1234 + /* "lightfm/_lightfm_fast_openmp.pyx":1246 * lightfm.no_components) * * free(user_repr) # <<<<<<<<<<<<<< @@ -9583,7 +9776,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_8predict_lightfm(CYTHO */ free(__pyx_v_user_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1235 + /* "lightfm/_lightfm_fast_openmp.pyx":1247 * * free(user_repr) * free(it_repr) # <<<<<<<<<<<<<< @@ -9601,7 +9794,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_8predict_lightfm(CYTHO #endif } - /* "lightfm/_lightfm_fast_openmp.pyx":1208 + /* "lightfm/_lightfm_fast_openmp.pyx":1220 * no_examples = predictions.shape[0] * * with nogil, parallel(num_threads=num_threads): # <<<<<<<<<<<<<< @@ -9620,7 +9813,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_8predict_lightfm(CYTHO } } - /* "lightfm/_lightfm_fast_openmp.pyx":1191 + /* "lightfm/_lightfm_fast_openmp.pyx":1203 * * * def predict_lightfm(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -9638,7 +9831,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_8predict_lightfm(CYTHO return __pyx_r; } -/* "lightfm/_lightfm_fast_openmp.pyx":1238 +/* "lightfm/_lightfm_fast_openmp.pyx":1250 * * * def predict_ranks(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -9658,6 +9851,9 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_11predict_ranks(PyObje __Pyx_memviewslice __pyx_v_ranks = { 0, 0, { 0 }, { 0 }, { 0 } }; struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *__pyx_v_lightfm = 0; int __pyx_v_num_threads; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("predict_ranks (wrapper)", 0); @@ -9694,41 +9890,41 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_11predict_ranks(PyObje case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_user_features)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 1); __PYX_ERR(0, 1238, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 1); __PYX_ERR(0, 1250, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_test_interactions)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 2); __PYX_ERR(0, 1238, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 2); __PYX_ERR(0, 1250, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_train_interactions)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 3); __PYX_ERR(0, 1238, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 3); __PYX_ERR(0, 1250, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_ranks)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 4); __PYX_ERR(0, 1238, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 4); __PYX_ERR(0, 1250, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 5: if (likely((values[5] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_lightfm)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 5); __PYX_ERR(0, 1238, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 5); __PYX_ERR(0, 1250, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 6: if (likely((values[6] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 6); __PYX_ERR(0, 1238, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, 6); __PYX_ERR(0, 1250, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict_ranks") < 0)) __PYX_ERR(0, 1238, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "predict_ranks") < 0)) __PYX_ERR(0, 1250, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 7) { goto __pyx_L5_argtuple_error; @@ -9745,23 +9941,23 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_11predict_ranks(PyObje __pyx_v_user_features = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[1]); __pyx_v_test_interactions = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[2]); __pyx_v_train_interactions = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[3]); - __pyx_v_ranks = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ranks.memview)) __PYX_ERR(0, 1242, __pyx_L3_error) + __pyx_v_ranks = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[4], PyBUF_WRITABLE); if (unlikely(!__pyx_v_ranks.memview)) __PYX_ERR(0, 1254, __pyx_L3_error) __pyx_v_lightfm = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *)values[5]); - __pyx_v_num_threads = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1244, __pyx_L3_error) + __pyx_v_num_threads = __Pyx_PyInt_As_int(values[6]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1256, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1238, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("predict_ranks", 1, 7, 7, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1250, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_openmp.predict_ranks", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 1238, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 1239, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_test_interactions), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "test_interactions", 0))) __PYX_ERR(0, 1240, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_train_interactions), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "train_interactions", 0))) __PYX_ERR(0, 1241, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 1243, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_item_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "item_features", 0))) __PYX_ERR(0, 1250, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_user_features), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "user_features", 0))) __PYX_ERR(0, 1251, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_test_interactions), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "test_interactions", 0))) __PYX_ERR(0, 1252, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_train_interactions), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "train_interactions", 0))) __PYX_ERR(0, 1253, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_lightfm), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_FastLightFM, 1, "lightfm", 0))) __PYX_ERR(0, 1255, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(__pyx_self, __pyx_v_item_features, __pyx_v_user_features, __pyx_v_test_interactions, __pyx_v_train_interactions, __pyx_v_ranks, __pyx_v_lightfm, __pyx_v_num_threads); /* function exit code */ @@ -9799,10 +9995,9 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON int __pyx_t_10; int __pyx_t_11; int __pyx_t_12; - Py_ssize_t __pyx_t_13; __Pyx_RefNannySetupContext("predict_ranks", 0); - /* "lightfm/_lightfm_fast_openmp.pyx":1254 + /* "lightfm/_lightfm_fast_openmp.pyx":1266 * cdef flt prediction, rank * * predictions_size = 0 # <<<<<<<<<<<<<< @@ -9811,7 +10006,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ __pyx_v_predictions_size = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":1258 + /* "lightfm/_lightfm_fast_openmp.pyx":1270 * # Figure out the max size of the predictions * # buffer. * for user_id in range(test_interactions.rows): # <<<<<<<<<<<<<< @@ -9823,7 +10018,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_user_id = __pyx_t_3; - /* "lightfm/_lightfm_fast_openmp.pyx":1259 + /* "lightfm/_lightfm_fast_openmp.pyx":1271 * # buffer. * for user_id in range(test_interactions.rows): * predictions_size = int_max(predictions_size, # <<<<<<<<<<<<<< @@ -9833,7 +10028,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON __pyx_v_predictions_size = __pyx_f_7lightfm_20_lightfm_fast_openmp_int_max(__pyx_v_predictions_size, (((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_test_interactions->__pyx_vtab)->get_row_end(__pyx_v_test_interactions, __pyx_v_user_id) - ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_test_interactions->__pyx_vtab)->get_row_start(__pyx_v_test_interactions, __pyx_v_user_id))); } - /* "lightfm/_lightfm_fast_openmp.pyx":1263 + /* "lightfm/_lightfm_fast_openmp.pyx":1275 * - test_interactions.get_row_start(user_id)) * * with nogil, parallel(num_threads=num_threads): # <<<<<<<<<<<<<< @@ -9855,7 +10050,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON #define unlikely(x) (x) #endif #ifdef _OPENMP - #pragma omp parallel private(__pyx_v_it_repr, __pyx_v_item_ids, __pyx_v_predictions, __pyx_v_user_repr) private(__pyx_t_1, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) num_threads(__pyx_v_num_threads) + #pragma omp parallel private(__pyx_v_it_repr, __pyx_v_item_ids, __pyx_v_predictions, __pyx_v_user_repr) private(__pyx_t_1, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) num_threads(__pyx_v_num_threads) #endif /* _OPENMP */ { /* Initialize private variables to invalid values */ @@ -9864,7 +10059,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON __pyx_v_predictions = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)1); __pyx_v_user_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)1); - /* "lightfm/_lightfm_fast_openmp.pyx":1265 + /* "lightfm/_lightfm_fast_openmp.pyx":1277 * with nogil, parallel(num_threads=num_threads): * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -9873,7 +10068,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ __pyx_v_user_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":1266 + /* "lightfm/_lightfm_fast_openmp.pyx":1278 * * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) # <<<<<<<<<<<<<< @@ -9882,7 +10077,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ __pyx_v_it_repr = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * (__pyx_v_lightfm->no_components + 1)))); - /* "lightfm/_lightfm_fast_openmp.pyx":1267 + /* "lightfm/_lightfm_fast_openmp.pyx":1279 * user_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * item_ids = malloc(sizeof(int) * predictions_size) # <<<<<<<<<<<<<< @@ -9891,7 +10086,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ __pyx_v_item_ids = ((int *)malloc(((sizeof(int)) * __pyx_v_predictions_size))); - /* "lightfm/_lightfm_fast_openmp.pyx":1268 + /* "lightfm/_lightfm_fast_openmp.pyx":1280 * it_repr = malloc(sizeof(flt) * (lightfm.no_components + 1)) * item_ids = malloc(sizeof(int) * predictions_size) * predictions = malloc(sizeof(flt) * predictions_size) # <<<<<<<<<<<<<< @@ -9900,7 +10095,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ __pyx_v_predictions = ((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *)malloc(((sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)) * __pyx_v_predictions_size))); - /* "lightfm/_lightfm_fast_openmp.pyx":1270 + /* "lightfm/_lightfm_fast_openmp.pyx":1282 * predictions = malloc(sizeof(flt) * predictions_size) * * for user_id in prange(test_interactions.rows): # <<<<<<<<<<<<<< @@ -9908,7 +10103,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON * row_start = test_interactions.get_row_start(user_id) */ __pyx_t_1 = __pyx_v_test_interactions->rows; - if (1 == 0) abort(); + if ((1 == 0)) abort(); { __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; if (__pyx_t_3 > 0) @@ -9926,7 +10121,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON __pyx_v_row_start = ((int)0xbad0bad0); __pyx_v_row_stop = ((int)0xbad0bad0); - /* "lightfm/_lightfm_fast_openmp.pyx":1272 + /* "lightfm/_lightfm_fast_openmp.pyx":1284 * for user_id in prange(test_interactions.rows): * * row_start = test_interactions.get_row_start(user_id) # <<<<<<<<<<<<<< @@ -9935,7 +10130,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ __pyx_v_row_start = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_test_interactions->__pyx_vtab)->get_row_start(__pyx_v_test_interactions, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_openmp.pyx":1273 + /* "lightfm/_lightfm_fast_openmp.pyx":1285 * * row_start = test_interactions.get_row_start(user_id) * row_stop = test_interactions.get_row_end(user_id) # <<<<<<<<<<<<<< @@ -9944,7 +10139,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ __pyx_v_row_stop = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_test_interactions->__pyx_vtab)->get_row_end(__pyx_v_test_interactions, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_openmp.pyx":1275 + /* "lightfm/_lightfm_fast_openmp.pyx":1287 * row_stop = test_interactions.get_row_end(user_id) * * if row_stop == row_start: # <<<<<<<<<<<<<< @@ -9954,7 +10149,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON __pyx_t_4 = ((__pyx_v_row_stop == __pyx_v_row_start) != 0); if (__pyx_t_4) { - /* "lightfm/_lightfm_fast_openmp.pyx":1277 + /* "lightfm/_lightfm_fast_openmp.pyx":1289 * if row_stop == row_start: * # No test interactions for this user * continue # <<<<<<<<<<<<<< @@ -9963,7 +10158,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ goto __pyx_L12_continue; - /* "lightfm/_lightfm_fast_openmp.pyx":1275 + /* "lightfm/_lightfm_fast_openmp.pyx":1287 * row_stop = test_interactions.get_row_end(user_id) * * if row_stop == row_start: # <<<<<<<<<<<<<< @@ -9972,7 +10167,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ } - /* "lightfm/_lightfm_fast_openmp.pyx":1279 + /* "lightfm/_lightfm_fast_openmp.pyx":1291 * continue * * compute_representation(user_features, # <<<<<<<<<<<<<< @@ -9981,7 +10176,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_user_features, __pyx_v_lightfm->user_features, __pyx_v_lightfm->user_biases, __pyx_v_lightfm, __pyx_v_user_id, __pyx_v_lightfm->user_scale, __pyx_v_user_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1289 + /* "lightfm/_lightfm_fast_openmp.pyx":1301 * # Compute predictions for the items whose * # ranks we want to know * for i in range(row_stop - row_start): # <<<<<<<<<<<<<< @@ -9993,7 +10188,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "lightfm/_lightfm_fast_openmp.pyx":1291 + /* "lightfm/_lightfm_fast_openmp.pyx":1303 * for i in range(row_stop - row_start): * * item_id = test_interactions.indices[row_start + i] # <<<<<<<<<<<<<< @@ -10003,7 +10198,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON __pyx_t_8 = (__pyx_v_row_start + __pyx_v_i); __pyx_v_item_id = (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_test_interactions->indices.data) + __pyx_t_8)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":1293 + /* "lightfm/_lightfm_fast_openmp.pyx":1305 * item_id = test_interactions.indices[row_start + i] * * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -10012,7 +10207,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_item_id, __pyx_v_lightfm->item_scale, __pyx_v_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1301 + /* "lightfm/_lightfm_fast_openmp.pyx":1313 * it_repr) * * item_ids[i] = item_id # <<<<<<<<<<<<<< @@ -10021,7 +10216,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ (__pyx_v_item_ids[__pyx_v_i]) = __pyx_v_item_id; - /* "lightfm/_lightfm_fast_openmp.pyx":1302 + /* "lightfm/_lightfm_fast_openmp.pyx":1314 * * item_ids[i] = item_id * predictions[i] = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -10031,7 +10226,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON (__pyx_v_predictions[__pyx_v_i]) = __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_it_repr, __pyx_v_lightfm->no_components); } - /* "lightfm/_lightfm_fast_openmp.pyx":1307 + /* "lightfm/_lightfm_fast_openmp.pyx":1319 * * # Now we can zip through all the other items and compute ranks * for item_id in range(test_interactions.cols): # <<<<<<<<<<<<<< @@ -10043,7 +10238,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_item_id = __pyx_t_7; - /* "lightfm/_lightfm_fast_openmp.pyx":1309 + /* "lightfm/_lightfm_fast_openmp.pyx":1321 * for item_id in range(test_interactions.cols): * * if in_positives(item_id, user_id, train_interactions): # <<<<<<<<<<<<<< @@ -10053,7 +10248,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON __pyx_t_4 = (__pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(__pyx_v_item_id, __pyx_v_user_id, __pyx_v_train_interactions) != 0); if (__pyx_t_4) { - /* "lightfm/_lightfm_fast_openmp.pyx":1310 + /* "lightfm/_lightfm_fast_openmp.pyx":1322 * * if in_positives(item_id, user_id, train_interactions): * continue # <<<<<<<<<<<<<< @@ -10062,7 +10257,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ goto __pyx_L19_continue; - /* "lightfm/_lightfm_fast_openmp.pyx":1309 + /* "lightfm/_lightfm_fast_openmp.pyx":1321 * for item_id in range(test_interactions.cols): * * if in_positives(item_id, user_id, train_interactions): # <<<<<<<<<<<<<< @@ -10071,7 +10266,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ } - /* "lightfm/_lightfm_fast_openmp.pyx":1312 + /* "lightfm/_lightfm_fast_openmp.pyx":1324 * continue * * compute_representation(item_features, # <<<<<<<<<<<<<< @@ -10080,7 +10275,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_representation(__pyx_v_item_features, __pyx_v_lightfm->item_features, __pyx_v_lightfm->item_biases, __pyx_v_lightfm, __pyx_v_item_id, __pyx_v_lightfm->item_scale, __pyx_v_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1319 + /* "lightfm/_lightfm_fast_openmp.pyx":1331 * lightfm.item_scale, * it_repr) * prediction = compute_prediction_from_repr(user_repr, # <<<<<<<<<<<<<< @@ -10089,7 +10284,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ __pyx_v_prediction = __pyx_f_7lightfm_20_lightfm_fast_openmp_compute_prediction_from_repr(__pyx_v_user_repr, __pyx_v_it_repr, __pyx_v_lightfm->no_components); - /* "lightfm/_lightfm_fast_openmp.pyx":1323 + /* "lightfm/_lightfm_fast_openmp.pyx":1335 * lightfm.no_components) * * for i in range(row_stop - row_start): # <<<<<<<<<<<<<< @@ -10101,7 +10296,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; - /* "lightfm/_lightfm_fast_openmp.pyx":1324 + /* "lightfm/_lightfm_fast_openmp.pyx":1336 * * for i in range(row_stop - row_start): * if item_id != item_ids[i] and prediction >= predictions[i]: # <<<<<<<<<<<<<< @@ -10119,17 +10314,17 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON __pyx_L25_bool_binop_done:; if (__pyx_t_4) { - /* "lightfm/_lightfm_fast_openmp.pyx":1325 + /* "lightfm/_lightfm_fast_openmp.pyx":1337 * for i in range(row_stop - row_start): * if item_id != item_ids[i] and prediction >= predictions[i]: * ranks[row_start + i] += 1.0 # <<<<<<<<<<<<<< * * free(user_repr) */ - __pyx_t_13 = (__pyx_v_row_start + __pyx_v_i); - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_ranks.data) + __pyx_t_13)) )) += 1.0; + __pyx_t_8 = (__pyx_v_row_start + __pyx_v_i); + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_ranks.data) + __pyx_t_8)) )) += 1.0; - /* "lightfm/_lightfm_fast_openmp.pyx":1324 + /* "lightfm/_lightfm_fast_openmp.pyx":1336 * * for i in range(row_stop - row_start): * if item_id != item_ids[i] and prediction >= predictions[i]: # <<<<<<<<<<<<<< @@ -10149,7 +10344,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON } } - /* "lightfm/_lightfm_fast_openmp.pyx":1327 + /* "lightfm/_lightfm_fast_openmp.pyx":1339 * ranks[row_start + i] += 1.0 * * free(user_repr) # <<<<<<<<<<<<<< @@ -10158,7 +10353,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ free(__pyx_v_user_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1328 + /* "lightfm/_lightfm_fast_openmp.pyx":1340 * * free(user_repr) * free(it_repr) # <<<<<<<<<<<<<< @@ -10167,7 +10362,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON */ free(__pyx_v_it_repr); - /* "lightfm/_lightfm_fast_openmp.pyx":1329 + /* "lightfm/_lightfm_fast_openmp.pyx":1341 * free(user_repr) * free(it_repr) * free(predictions) # <<<<<<<<<<<<<< @@ -10185,7 +10380,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON #endif } - /* "lightfm/_lightfm_fast_openmp.pyx":1263 + /* "lightfm/_lightfm_fast_openmp.pyx":1275 * - test_interactions.get_row_start(user_id)) * * with nogil, parallel(num_threads=num_threads): # <<<<<<<<<<<<<< @@ -10204,7 +10399,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON } } - /* "lightfm/_lightfm_fast_openmp.pyx":1238 + /* "lightfm/_lightfm_fast_openmp.pyx":1250 * * * def predict_ranks(CSRMatrix item_features, # <<<<<<<<<<<<<< @@ -10220,7 +10415,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_10predict_ranks(CYTHON return __pyx_r; } -/* "lightfm/_lightfm_fast_openmp.pyx":1332 +/* "lightfm/_lightfm_fast_openmp.pyx":1344 * * * def calculate_auc_from_rank(CSRMatrix ranks, # <<<<<<<<<<<<<< @@ -10237,6 +10432,9 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_13calculate_auc_from_r __Pyx_memviewslice __pyx_v_rank_data = { 0, 0, { 0 }, { 0 }, { 0 } }; __Pyx_memviewslice __pyx_v_auc = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_v_num_threads; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("calculate_auc_from_rank (wrapper)", 0); @@ -10269,29 +10467,29 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_13calculate_auc_from_r case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_train_positives)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 1); __PYX_ERR(0, 1332, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 1); __PYX_ERR(0, 1344, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_rank_data)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 2); __PYX_ERR(0, 1332, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 2); __PYX_ERR(0, 1344, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: if (likely((values[3] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_auc)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 3); __PYX_ERR(0, 1332, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 3); __PYX_ERR(0, 1344, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 4: if (likely((values[4] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_num_threads)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 4); __PYX_ERR(0, 1332, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, 4); __PYX_ERR(0, 1344, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculate_auc_from_rank") < 0)) __PYX_ERR(0, 1332, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "calculate_auc_from_rank") < 0)) __PYX_ERR(0, 1344, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -10303,20 +10501,20 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_13calculate_auc_from_r values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_ranks = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[0]); - __pyx_v_num_train_positives = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_num_train_positives.memview)) __PYX_ERR(0, 1333, __pyx_L3_error) - __pyx_v_rank_data = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rank_data.memview)) __PYX_ERR(0, 1334, __pyx_L3_error) - __pyx_v_auc = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_auc.memview)) __PYX_ERR(0, 1335, __pyx_L3_error) - __pyx_v_num_threads = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1336, __pyx_L3_error) + __pyx_v_num_train_positives = __Pyx_PyObject_to_MemoryviewSlice_dc_int(values[1], PyBUF_WRITABLE); if (unlikely(!__pyx_v_num_train_positives.memview)) __PYX_ERR(0, 1345, __pyx_L3_error) + __pyx_v_rank_data = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[2], PyBUF_WRITABLE); if (unlikely(!__pyx_v_rank_data.memview)) __PYX_ERR(0, 1346, __pyx_L3_error) + __pyx_v_auc = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(values[3], PyBUF_WRITABLE); if (unlikely(!__pyx_v_auc.memview)) __PYX_ERR(0, 1347, __pyx_L3_error) + __pyx_v_num_threads = __Pyx_PyInt_As_int(values[4]); if (unlikely((__pyx_v_num_threads == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1348, __pyx_L3_error) } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1332, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("calculate_auc_from_rank", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1344, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_openmp.calculate_auc_from_rank", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ranks), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "ranks", 0))) __PYX_ERR(0, 1332, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_ranks), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "ranks", 0))) __PYX_ERR(0, 1344, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_rank(__pyx_self, __pyx_v_ranks, __pyx_v_num_train_positives, __pyx_v_rank_data, __pyx_v_auc, __pyx_v_num_threads); /* function exit code */ @@ -10344,17 +10542,12 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r Py_ssize_t __pyx_t_4; int __pyx_t_5; int __pyx_t_6; - Py_ssize_t __pyx_t_7; - Py_ssize_t __pyx_t_8; + int __pyx_t_7; + int __pyx_t_8; int __pyx_t_9; - int __pyx_t_10; - int __pyx_t_11; - Py_ssize_t __pyx_t_12; - Py_ssize_t __pyx_t_13; - Py_ssize_t __pyx_t_14; __Pyx_RefNannySetupContext("calculate_auc_from_rank", 0); - /* "lightfm/_lightfm_fast_openmp.pyx":1341 + /* "lightfm/_lightfm_fast_openmp.pyx":1353 * cdef flt rank * * with nogil, parallel(num_threads=num_threads): # <<<<<<<<<<<<<< @@ -10376,11 +10569,11 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r #define unlikely(x) (x) #endif #ifdef _OPENMP - #pragma omp parallel private(__pyx_t_1, __pyx_t_10, __pyx_t_11, __pyx_t_12, __pyx_t_13, __pyx_t_14, __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) num_threads(__pyx_v_num_threads) + #pragma omp parallel private(__pyx_t_1, __pyx_t_2, __pyx_t_3, __pyx_t_4, __pyx_t_5, __pyx_t_6, __pyx_t_7, __pyx_t_8, __pyx_t_9) num_threads(__pyx_v_num_threads) #endif /* _OPENMP */ { - /* "lightfm/_lightfm_fast_openmp.pyx":1342 + /* "lightfm/_lightfm_fast_openmp.pyx":1354 * * with nogil, parallel(num_threads=num_threads): * for user_id in prange(ranks.rows): # <<<<<<<<<<<<<< @@ -10388,7 +10581,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r * row_start = ranks.get_row_start(user_id) */ __pyx_t_1 = __pyx_v_ranks->rows; - if (1 == 0) abort(); + if ((1 == 0)) abort(); { __pyx_t_3 = (__pyx_t_1 - 0 + 1 - 1/abs(1)) / 1; if (__pyx_t_3 > 0) @@ -10407,7 +10600,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r __pyx_v_row_start = ((int)0xbad0bad0); __pyx_v_row_stop = ((int)0xbad0bad0); - /* "lightfm/_lightfm_fast_openmp.pyx":1344 + /* "lightfm/_lightfm_fast_openmp.pyx":1356 * for user_id in prange(ranks.rows): * * row_start = ranks.get_row_start(user_id) # <<<<<<<<<<<<<< @@ -10416,7 +10609,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r */ __pyx_v_row_start = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_ranks->__pyx_vtab)->get_row_start(__pyx_v_ranks, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_openmp.pyx":1345 + /* "lightfm/_lightfm_fast_openmp.pyx":1357 * * row_start = ranks.get_row_start(user_id) * row_stop = ranks.get_row_end(user_id) # <<<<<<<<<<<<<< @@ -10425,7 +10618,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r */ __pyx_v_row_stop = ((struct __pyx_vtabstruct_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)__pyx_v_ranks->__pyx_vtab)->get_row_end(__pyx_v_ranks, __pyx_v_user_id); - /* "lightfm/_lightfm_fast_openmp.pyx":1347 + /* "lightfm/_lightfm_fast_openmp.pyx":1359 * row_stop = ranks.get_row_end(user_id) * * num_positives = row_stop - row_start # <<<<<<<<<<<<<< @@ -10434,7 +10627,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r */ __pyx_v_num_positives = (__pyx_v_row_stop - __pyx_v_row_start); - /* "lightfm/_lightfm_fast_openmp.pyx":1348 + /* "lightfm/_lightfm_fast_openmp.pyx":1360 * * num_positives = row_stop - row_start * num_negatives = ranks.cols - ((row_stop - row_start) + num_train_positives[user_id]) # <<<<<<<<<<<<<< @@ -10444,7 +10637,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r __pyx_t_4 = __pyx_v_user_id; __pyx_v_num_negatives = (__pyx_v_ranks->cols - ((__pyx_v_row_stop - __pyx_v_row_start) + (*((int *) ( /* dim=0 */ ((char *) (((int *) __pyx_v_num_train_positives.data) + __pyx_t_4)) ))))); - /* "lightfm/_lightfm_fast_openmp.pyx":1352 + /* "lightfm/_lightfm_fast_openmp.pyx":1364 * # If there is only one class present, * # return 0.5. * if num_positives == 0 or num_negatives == ranks.cols: # <<<<<<<<<<<<<< @@ -10462,17 +10655,17 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r __pyx_L15_bool_binop_done:; if (__pyx_t_5) { - /* "lightfm/_lightfm_fast_openmp.pyx":1353 + /* "lightfm/_lightfm_fast_openmp.pyx":1365 * # return 0.5. * if num_positives == 0 or num_negatives == ranks.cols: * auc[user_id] = 0.5 # <<<<<<<<<<<<<< * continue * */ - __pyx_t_7 = __pyx_v_user_id; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_auc.data) + __pyx_t_7)) )) = 0.5; + __pyx_t_4 = __pyx_v_user_id; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_auc.data) + __pyx_t_4)) )) = 0.5; - /* "lightfm/_lightfm_fast_openmp.pyx":1354 + /* "lightfm/_lightfm_fast_openmp.pyx":1366 * if num_positives == 0 or num_negatives == ranks.cols: * auc[user_id] = 0.5 * continue # <<<<<<<<<<<<<< @@ -10481,7 +10674,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r */ goto __pyx_L10_continue; - /* "lightfm/_lightfm_fast_openmp.pyx":1352 + /* "lightfm/_lightfm_fast_openmp.pyx":1364 * # If there is only one class present, * # return 0.5. * if num_positives == 0 or num_negatives == ranks.cols: # <<<<<<<<<<<<<< @@ -10490,47 +10683,47 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r */ } - /* "lightfm/_lightfm_fast_openmp.pyx":1358 + /* "lightfm/_lightfm_fast_openmp.pyx":1370 * # Sort the positives according to * # increasing rank. * qsort(&rank_data[row_start], # <<<<<<<<<<<<<< * num_positives, * sizeof(flt), */ - __pyx_t_8 = __pyx_v_row_start; + __pyx_t_4 = __pyx_v_row_start; - /* "lightfm/_lightfm_fast_openmp.pyx":1361 + /* "lightfm/_lightfm_fast_openmp.pyx":1373 * num_positives, * sizeof(flt), * flt_compare) # <<<<<<<<<<<<<< * * for i in range(num_positives): */ - qsort((&(*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_rank_data.data) + __pyx_t_8)) )))), __pyx_v_num_positives, (sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)), __pyx_f_7lightfm_20_lightfm_fast_openmp_flt_compare); + qsort((&(*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_rank_data.data) + __pyx_t_4)) )))), __pyx_v_num_positives, (sizeof(__pyx_t_7lightfm_20_lightfm_fast_openmp_flt)), __pyx_f_7lightfm_20_lightfm_fast_openmp_flt_compare); - /* "lightfm/_lightfm_fast_openmp.pyx":1363 + /* "lightfm/_lightfm_fast_openmp.pyx":1375 * flt_compare) * * for i in range(num_positives): # <<<<<<<<<<<<<< * * rank = ranks.data[row_start + i] */ - __pyx_t_9 = __pyx_v_num_positives; - __pyx_t_10 = __pyx_t_9; - for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { - __pyx_v_i = __pyx_t_11; + __pyx_t_7 = __pyx_v_num_positives; + __pyx_t_8 = __pyx_t_7; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "lightfm/_lightfm_fast_openmp.pyx":1365 + /* "lightfm/_lightfm_fast_openmp.pyx":1377 * for i in range(num_positives): * * rank = ranks.data[row_start + i] # <<<<<<<<<<<<<< * * # There are i other positives that */ - __pyx_t_12 = (__pyx_v_row_start + __pyx_v_i); - __pyx_v_rank = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_ranks->data.data) + __pyx_t_12)) ))); + __pyx_t_4 = (__pyx_v_row_start + __pyx_v_i); + __pyx_v_rank = (*((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_ranks->data.data) + __pyx_t_4)) ))); - /* "lightfm/_lightfm_fast_openmp.pyx":1371 + /* "lightfm/_lightfm_fast_openmp.pyx":1383 * # by i. Ignore ties but ensure that * # the resulting rank is nonnegative. * rank = rank - i # <<<<<<<<<<<<<< @@ -10539,7 +10732,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r */ __pyx_v_rank = (__pyx_v_rank - __pyx_v_i); - /* "lightfm/_lightfm_fast_openmp.pyx":1373 + /* "lightfm/_lightfm_fast_openmp.pyx":1385 * rank = rank - i * * if rank < 0: # <<<<<<<<<<<<<< @@ -10549,7 +10742,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r __pyx_t_5 = ((__pyx_v_rank < 0.0) != 0); if (__pyx_t_5) { - /* "lightfm/_lightfm_fast_openmp.pyx":1374 + /* "lightfm/_lightfm_fast_openmp.pyx":1386 * * if rank < 0: * rank = 0 # <<<<<<<<<<<<<< @@ -10558,7 +10751,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r */ __pyx_v_rank = 0.0; - /* "lightfm/_lightfm_fast_openmp.pyx":1373 + /* "lightfm/_lightfm_fast_openmp.pyx":1385 * rank = rank - i * * if rank < 0: # <<<<<<<<<<<<<< @@ -10567,18 +10760,18 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r */ } - /* "lightfm/_lightfm_fast_openmp.pyx":1379 + /* "lightfm/_lightfm_fast_openmp.pyx":1391 * # over the total number of negatives: the probability * # of rank inversion. * auc[user_id] += 1.0 - rank / num_negatives # <<<<<<<<<<<<<< * * if num_positives != 0: */ - __pyx_t_13 = __pyx_v_user_id; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_auc.data) + __pyx_t_13)) )) += (1.0 - (__pyx_v_rank / __pyx_v_num_negatives)); + __pyx_t_4 = __pyx_v_user_id; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_auc.data) + __pyx_t_4)) )) += (1.0 - (__pyx_v_rank / __pyx_v_num_negatives)); } - /* "lightfm/_lightfm_fast_openmp.pyx":1381 + /* "lightfm/_lightfm_fast_openmp.pyx":1393 * auc[user_id] += 1.0 - rank / num_negatives * * if num_positives != 0: # <<<<<<<<<<<<<< @@ -10588,17 +10781,17 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r __pyx_t_5 = ((__pyx_v_num_positives != 0) != 0); if (__pyx_t_5) { - /* "lightfm/_lightfm_fast_openmp.pyx":1382 + /* "lightfm/_lightfm_fast_openmp.pyx":1394 * * if num_positives != 0: * auc[user_id] /= num_positives # <<<<<<<<<<<<<< * * */ - __pyx_t_14 = __pyx_v_user_id; - *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_auc.data) + __pyx_t_14)) )) /= __pyx_v_num_positives; + __pyx_t_4 = __pyx_v_user_id; + *((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) ( /* dim=0 */ ((char *) (((__pyx_t_7lightfm_20_lightfm_fast_openmp_flt *) __pyx_v_auc.data) + __pyx_t_4)) )) /= __pyx_v_num_positives; - /* "lightfm/_lightfm_fast_openmp.pyx":1381 + /* "lightfm/_lightfm_fast_openmp.pyx":1393 * auc[user_id] += 1.0 - rank / num_negatives * * if num_positives != 0: # <<<<<<<<<<<<<< @@ -10624,7 +10817,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r #endif } - /* "lightfm/_lightfm_fast_openmp.pyx":1341 + /* "lightfm/_lightfm_fast_openmp.pyx":1353 * cdef flt rank * * with nogil, parallel(num_threads=num_threads): # <<<<<<<<<<<<<< @@ -10643,7 +10836,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r } } - /* "lightfm/_lightfm_fast_openmp.pyx":1332 + /* "lightfm/_lightfm_fast_openmp.pyx":1344 * * * def calculate_auc_from_rank(CSRMatrix ranks, # <<<<<<<<<<<<<< @@ -10661,7 +10854,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_12calculate_auc_from_r return __pyx_r; } -/* "lightfm/_lightfm_fast_openmp.pyx":1386 +/* "lightfm/_lightfm_fast_openmp.pyx":1398 * * # Expose test functions * def __test_in_positives(int row, int col, CSRMatrix mat): # <<<<<<<<<<<<<< @@ -10676,6 +10869,9 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_15__test_in_positives( int __pyx_v_row; int __pyx_v_col; struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *__pyx_v_mat = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__test_in_positives (wrapper)", 0); @@ -10704,17 +10900,17 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_15__test_in_positives( case 1: if (likely((values[1] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_col)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__test_in_positives", 1, 3, 3, 1); __PYX_ERR(0, 1386, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__test_in_positives", 1, 3, 3, 1); __PYX_ERR(0, 1398, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: if (likely((values[2] = __Pyx_PyDict_GetItemStr(__pyx_kwds, __pyx_n_s_mat)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__test_in_positives", 1, 3, 3, 2); __PYX_ERR(0, 1386, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__test_in_positives", 1, 3, 3, 2); __PYX_ERR(0, 1398, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__test_in_positives") < 0)) __PYX_ERR(0, 1386, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__test_in_positives") < 0)) __PYX_ERR(0, 1398, __pyx_L3_error) } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -10723,19 +10919,19 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_15__test_in_positives( values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_row = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_row == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1386, __pyx_L3_error) - __pyx_v_col = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_col == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1386, __pyx_L3_error) + __pyx_v_row = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_row == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1398, __pyx_L3_error) + __pyx_v_col = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_col == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 1398, __pyx_L3_error) __pyx_v_mat = ((struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_CSRMatrix *)values[2]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__test_in_positives", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1386, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("__test_in_positives", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 1398, __pyx_L3_error) __pyx_L3_error:; __Pyx_AddTraceback("lightfm._lightfm_fast_openmp.__test_in_positives", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "mat", 0))) __PYX_ERR(0, 1386, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_mat), __pyx_ptype_7lightfm_20_lightfm_fast_openmp_CSRMatrix, 1, "mat", 0))) __PYX_ERR(0, 1398, __pyx_L1_error) __pyx_r = __pyx_pf_7lightfm_20_lightfm_fast_openmp_14__test_in_positives(__pyx_self, __pyx_v_row, __pyx_v_col, __pyx_v_mat); /* function exit code */ @@ -10753,7 +10949,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_14__test_in_positives( int __pyx_t_1; __Pyx_RefNannySetupContext("__test_in_positives", 0); - /* "lightfm/_lightfm_fast_openmp.pyx":1388 + /* "lightfm/_lightfm_fast_openmp.pyx":1400 * def __test_in_positives(int row, int col, CSRMatrix mat): * * if in_positives(col, row, mat): # <<<<<<<<<<<<<< @@ -10763,7 +10959,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_14__test_in_positives( __pyx_t_1 = (__pyx_f_7lightfm_20_lightfm_fast_openmp_in_positives(__pyx_v_col, __pyx_v_row, __pyx_v_mat) != 0); if (__pyx_t_1) { - /* "lightfm/_lightfm_fast_openmp.pyx":1389 + /* "lightfm/_lightfm_fast_openmp.pyx":1401 * * if in_positives(col, row, mat): * return True # <<<<<<<<<<<<<< @@ -10775,7 +10971,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_14__test_in_positives( __pyx_r = Py_True; goto __pyx_L0; - /* "lightfm/_lightfm_fast_openmp.pyx":1388 + /* "lightfm/_lightfm_fast_openmp.pyx":1400 * def __test_in_positives(int row, int col, CSRMatrix mat): * * if in_positives(col, row, mat): # <<<<<<<<<<<<<< @@ -10784,7 +10980,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_14__test_in_positives( */ } - /* "lightfm/_lightfm_fast_openmp.pyx":1391 + /* "lightfm/_lightfm_fast_openmp.pyx":1403 * return True * else: * return False # <<<<<<<<<<<<<< @@ -10796,7 +10992,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_14__test_in_positives( goto __pyx_L0; } - /* "lightfm/_lightfm_fast_openmp.pyx":1386 + /* "lightfm/_lightfm_fast_openmp.pyx":1398 * * # Expose test functions * def __test_in_positives(int row, int col, CSRMatrix mat): # <<<<<<<<<<<<<< @@ -10824,6 +11020,9 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_17__pyx_unpickle_CSRMa PyObject *__pyx_v___pyx_type = 0; long __pyx_v___pyx_checksum; PyObject *__pyx_v___pyx_state = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_unpickle_CSRMatrix (wrapper)", 0); @@ -10901,6 +11100,9 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_16__pyx_unpickle_CSRMa PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_unpickle_CSRMatrix", 0); /* "(tree fragment)":4 @@ -11091,6 +11293,9 @@ static PyObject *__pyx_f_7lightfm_20_lightfm_fast_openmp___pyx_unpickle_CSRMatri PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; PyObject *__pyx_t_10 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_unpickle_CSRMatrix__set_state", 0); /* "(tree fragment)":12 @@ -11246,6 +11451,9 @@ static PyObject *__pyx_pw_7lightfm_20_lightfm_fast_openmp_19__pyx_unpickle_FastL PyObject *__pyx_v___pyx_type = 0; long __pyx_v___pyx_checksum; PyObject *__pyx_v___pyx_state = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_unpickle_FastLightFM (wrapper)", 0); @@ -11323,23 +11531,26 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_18__pyx_unpickle_FastL PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_unpickle_FastLightFM", 0); /* "(tree fragment)":4 * cdef object __pyx_PickleError * cdef object __pyx_result - * if __pyx_checksum != 0xddf264a: # <<<<<<<<<<<<<< + * if __pyx_checksum != 0x8f3b44c: # <<<<<<<<<<<<<< * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) + * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) */ - __pyx_t_1 = ((__pyx_v___pyx_checksum != 0xddf264a) != 0); + __pyx_t_1 = ((__pyx_v___pyx_checksum != 0x8f3b44c) != 0); if (__pyx_t_1) { /* "(tree fragment)":5 * cdef object __pyx_result - * if __pyx_checksum != 0xddf264a: + * if __pyx_checksum != 0x8f3b44c: * from pickle import PickleError as __pyx_PickleError # <<<<<<<<<<<<<< - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) + * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) * __pyx_result = FastLightFM.__new__(__pyx_type) */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 5, __pyx_L1_error) @@ -11358,15 +11569,15 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_18__pyx_unpickle_FastL __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "(tree fragment)":6 - * if __pyx_checksum != 0xddf264a: + * if __pyx_checksum != 0x8f3b44c: * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) # <<<<<<<<<<<<<< + * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) # <<<<<<<<<<<<<< * __pyx_result = FastLightFM.__new__(__pyx_type) * if __pyx_state is not None: */ __pyx_t_2 = __Pyx_PyInt_From_long(__pyx_v___pyx_checksum); if (unlikely(!__pyx_t_2)) __PYX_ERR(1, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0xdd, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyString_Format(__pyx_kp_s_Incompatible_checksums_s_vs_0x8f, __pyx_t_2); if (unlikely(!__pyx_t_4)) __PYX_ERR(1, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_INCREF(__pyx_v___pyx_PickleError); @@ -11393,15 +11604,15 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_18__pyx_unpickle_FastL /* "(tree fragment)":4 * cdef object __pyx_PickleError * cdef object __pyx_result - * if __pyx_checksum != 0xddf264a: # <<<<<<<<<<<<<< + * if __pyx_checksum != 0x8f3b44c: # <<<<<<<<<<<<<< * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) + * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) */ } /* "(tree fragment)":7 * from pickle import PickleError as __pyx_PickleError - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) + * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) * __pyx_result = FastLightFM.__new__(__pyx_type) # <<<<<<<<<<<<<< * if __pyx_state is not None: * __pyx_unpickle_FastLightFM__set_state( __pyx_result, __pyx_state) @@ -11427,7 +11638,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_18__pyx_unpickle_FastL __pyx_t_3 = 0; /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) + * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) * __pyx_result = FastLightFM.__new__(__pyx_type) * if __pyx_state is not None: # <<<<<<<<<<<<<< * __pyx_unpickle_FastLightFM__set_state( __pyx_result, __pyx_state) @@ -11450,7 +11661,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_18__pyx_unpickle_FastL __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "(tree fragment)":8 - * raise __pyx_PickleError("Incompatible checksums (%s vs 0xddf264a = (adadelta, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) + * raise __pyx_PickleError("Incompatible checksums (%s vs 0x8f3b44c = (adadelta, avg_loss, avg_loss_ctr, eps, item_bias_gradients, item_bias_momentum, item_biases, item_feature_gradients, item_feature_momentum, item_features, item_scale, learning_rate, max_sampled, no_components, rho, user_bias_gradients, user_bias_momentum, user_biases, user_feature_gradients, user_feature_momentum, user_features, user_scale))" % __pyx_checksum) * __pyx_result = FastLightFM.__new__(__pyx_type) * if __pyx_state is not None: # <<<<<<<<<<<<<< * __pyx_unpickle_FastLightFM__set_state( __pyx_result, __pyx_state) @@ -11463,7 +11674,7 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_18__pyx_unpickle_FastL * __pyx_unpickle_FastLightFM__set_state( __pyx_result, __pyx_state) * return __pyx_result # <<<<<<<<<<<<<< * cdef __pyx_unpickle_FastLightFM__set_state(FastLightFM __pyx_result, tuple __pyx_state): - * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.eps = __pyx_state[1]; __pyx_result.item_bias_gradients = __pyx_state[2]; __pyx_result.item_bias_momentum = __pyx_state[3]; __pyx_result.item_biases = __pyx_state[4]; __pyx_result.item_feature_gradients = __pyx_state[5]; __pyx_result.item_feature_momentum = __pyx_state[6]; __pyx_result.item_features = __pyx_state[7]; __pyx_result.item_scale = __pyx_state[8]; __pyx_result.learning_rate = __pyx_state[9]; __pyx_result.max_sampled = __pyx_state[10]; __pyx_result.no_components = __pyx_state[11]; __pyx_result.rho = __pyx_state[12]; __pyx_result.user_bias_gradients = __pyx_state[13]; __pyx_result.user_bias_momentum = __pyx_state[14]; __pyx_result.user_biases = __pyx_state[15]; __pyx_result.user_feature_gradients = __pyx_state[16]; __pyx_result.user_feature_momentum = __pyx_state[17]; __pyx_result.user_features = __pyx_state[18]; __pyx_result.user_scale = __pyx_state[19] + * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.avg_loss = __pyx_state[1]; __pyx_result.avg_loss_ctr = __pyx_state[2]; __pyx_result.eps = __pyx_state[3]; __pyx_result.item_bias_gradients = __pyx_state[4]; __pyx_result.item_bias_momentum = __pyx_state[5]; __pyx_result.item_biases = __pyx_state[6]; __pyx_result.item_feature_gradients = __pyx_state[7]; __pyx_result.item_feature_momentum = __pyx_state[8]; __pyx_result.item_features = __pyx_state[9]; __pyx_result.item_scale = __pyx_state[10]; __pyx_result.learning_rate = __pyx_state[11]; __pyx_result.max_sampled = __pyx_state[12]; __pyx_result.no_components = __pyx_state[13]; __pyx_result.rho = __pyx_state[14]; __pyx_result.user_bias_gradients = __pyx_state[15]; __pyx_result.user_bias_momentum = __pyx_state[16]; __pyx_result.user_biases = __pyx_state[17]; __pyx_result.user_feature_gradients = __pyx_state[18]; __pyx_result.user_feature_momentum = __pyx_state[19]; __pyx_result.user_features = __pyx_state[20]; __pyx_result.user_scale = __pyx_state[21] */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v___pyx_result); @@ -11496,18 +11707,18 @@ static PyObject *__pyx_pf_7lightfm_20_lightfm_fast_openmp_18__pyx_unpickle_FastL * __pyx_unpickle_FastLightFM__set_state( __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_FastLightFM__set_state(FastLightFM __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.eps = __pyx_state[1]; __pyx_result.item_bias_gradients = __pyx_state[2]; __pyx_result.item_bias_momentum = __pyx_state[3]; __pyx_result.item_biases = __pyx_state[4]; __pyx_result.item_feature_gradients = __pyx_state[5]; __pyx_result.item_feature_momentum = __pyx_state[6]; __pyx_result.item_features = __pyx_state[7]; __pyx_result.item_scale = __pyx_state[8]; __pyx_result.learning_rate = __pyx_state[9]; __pyx_result.max_sampled = __pyx_state[10]; __pyx_result.no_components = __pyx_state[11]; __pyx_result.rho = __pyx_state[12]; __pyx_result.user_bias_gradients = __pyx_state[13]; __pyx_result.user_bias_momentum = __pyx_state[14]; __pyx_result.user_biases = __pyx_state[15]; __pyx_result.user_feature_gradients = __pyx_state[16]; __pyx_result.user_feature_momentum = __pyx_state[17]; __pyx_result.user_features = __pyx_state[18]; __pyx_result.user_scale = __pyx_state[19] - * if len(__pyx_state) > 20 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.avg_loss = __pyx_state[1]; __pyx_result.avg_loss_ctr = __pyx_state[2]; __pyx_result.eps = __pyx_state[3]; __pyx_result.item_bias_gradients = __pyx_state[4]; __pyx_result.item_bias_momentum = __pyx_state[5]; __pyx_result.item_biases = __pyx_state[6]; __pyx_result.item_feature_gradients = __pyx_state[7]; __pyx_result.item_feature_momentum = __pyx_state[8]; __pyx_result.item_features = __pyx_state[9]; __pyx_result.item_scale = __pyx_state[10]; __pyx_result.learning_rate = __pyx_state[11]; __pyx_result.max_sampled = __pyx_state[12]; __pyx_result.no_components = __pyx_state[13]; __pyx_result.rho = __pyx_state[14]; __pyx_result.user_bias_gradients = __pyx_state[15]; __pyx_result.user_bias_momentum = __pyx_state[16]; __pyx_result.user_biases = __pyx_state[17]; __pyx_result.user_feature_gradients = __pyx_state[18]; __pyx_result.user_feature_momentum = __pyx_state[19]; __pyx_result.user_features = __pyx_state[20]; __pyx_result.user_scale = __pyx_state[21] + * if len(__pyx_state) > 22 and hasattr(__pyx_result, '__dict__'): */ static PyObject *__pyx_f_7lightfm_20_lightfm_fast_openmp___pyx_unpickle_FastLightFM__set_state(struct __pyx_obj_7lightfm_20_lightfm_fast_openmp_FastLightFM *__pyx_v___pyx_result, PyObject *__pyx_v___pyx_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_t_1; - __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_t_2; - __Pyx_memviewslice __pyx_t_3 = { 0, 0, { 0 }, { 0 }, { 0 } }; + double __pyx_t_2; + __pyx_t_7lightfm_20_lightfm_fast_openmp_flt __pyx_t_3; __Pyx_memviewslice __pyx_t_4 = { 0, 0, { 0 }, { 0 }, { 0 } }; - double __pyx_t_5; + __Pyx_memviewslice __pyx_t_5 = { 0, 0, { 0 }, { 0 }, { 0 } }; int __pyx_t_6; Py_ssize_t __pyx_t_7; int __pyx_t_8; @@ -11515,14 +11726,17 @@ static PyObject *__pyx_f_7lightfm_20_lightfm_fast_openmp___pyx_unpickle_FastLigh PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_unpickle_FastLightFM__set_state", 0); /* "(tree fragment)":12 * return __pyx_result * cdef __pyx_unpickle_FastLightFM__set_state(FastLightFM __pyx_result, tuple __pyx_state): - * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.eps = __pyx_state[1]; __pyx_result.item_bias_gradients = __pyx_state[2]; __pyx_result.item_bias_momentum = __pyx_state[3]; __pyx_result.item_biases = __pyx_state[4]; __pyx_result.item_feature_gradients = __pyx_state[5]; __pyx_result.item_feature_momentum = __pyx_state[6]; __pyx_result.item_features = __pyx_state[7]; __pyx_result.item_scale = __pyx_state[8]; __pyx_result.learning_rate = __pyx_state[9]; __pyx_result.max_sampled = __pyx_state[10]; __pyx_result.no_components = __pyx_state[11]; __pyx_result.rho = __pyx_state[12]; __pyx_result.user_bias_gradients = __pyx_state[13]; __pyx_result.user_bias_momentum = __pyx_state[14]; __pyx_result.user_biases = __pyx_state[15]; __pyx_result.user_feature_gradients = __pyx_state[16]; __pyx_result.user_feature_momentum = __pyx_state[17]; __pyx_result.user_features = __pyx_state[18]; __pyx_result.user_scale = __pyx_state[19] # <<<<<<<<<<<<<< - * if len(__pyx_state) > 20 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[20]) + * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.avg_loss = __pyx_state[1]; __pyx_result.avg_loss_ctr = __pyx_state[2]; __pyx_result.eps = __pyx_state[3]; __pyx_result.item_bias_gradients = __pyx_state[4]; __pyx_result.item_bias_momentum = __pyx_state[5]; __pyx_result.item_biases = __pyx_state[6]; __pyx_result.item_feature_gradients = __pyx_state[7]; __pyx_result.item_feature_momentum = __pyx_state[8]; __pyx_result.item_features = __pyx_state[9]; __pyx_result.item_scale = __pyx_state[10]; __pyx_result.learning_rate = __pyx_state[11]; __pyx_result.max_sampled = __pyx_state[12]; __pyx_result.no_components = __pyx_state[13]; __pyx_result.rho = __pyx_state[14]; __pyx_result.user_bias_gradients = __pyx_state[15]; __pyx_result.user_bias_momentum = __pyx_state[16]; __pyx_result.user_biases = __pyx_state[17]; __pyx_result.user_feature_gradients = __pyx_state[18]; __pyx_result.user_feature_momentum = __pyx_state[19]; __pyx_result.user_features = __pyx_state[20]; __pyx_result.user_scale = __pyx_state[21] # <<<<<<<<<<<<<< + * if len(__pyx_state) > 22 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[22]) */ if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); @@ -11534,165 +11748,177 @@ static PyObject *__pyx_f_7lightfm_20_lightfm_fast_openmp___pyx_unpickle_FastLigh PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_2 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v___pyx_state, 1)); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __pyx_v___pyx_result->eps = __pyx_t_2; + __pyx_t_2 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_v___pyx_state, 1)); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->avg_loss = __pyx_t_2; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_1 = __Pyx_PyInt_As_int(PyTuple_GET_ITEM(__pyx_v___pyx_state, 2)); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->avg_loss_ctr = __pyx_t_1; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 2), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_3 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v___pyx_state, 3)); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->eps = __pyx_t_3; + if (unlikely(__pyx_v___pyx_state == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + __PYX_ERR(1, 12, __pyx_L1_error) + } + __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 4), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->item_bias_gradients, 0); - __pyx_v___pyx_result->item_bias_gradients = __pyx_t_3; - __pyx_t_3.memview = NULL; - __pyx_t_3.data = NULL; + __pyx_v___pyx_result->item_bias_gradients = __pyx_t_4; + __pyx_t_4.memview = NULL; + __pyx_t_4.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 3), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 5), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->item_bias_momentum, 0); - __pyx_v___pyx_result->item_bias_momentum = __pyx_t_3; - __pyx_t_3.memview = NULL; - __pyx_t_3.data = NULL; + __pyx_v___pyx_result->item_bias_momentum = __pyx_t_4; + __pyx_t_4.memview = NULL; + __pyx_t_4.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 4), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 6), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->item_biases, 0); - __pyx_v___pyx_result->item_biases = __pyx_t_3; - __pyx_t_3.memview = NULL; - __pyx_t_3.data = NULL; + __pyx_v___pyx_result->item_biases = __pyx_t_4; + __pyx_t_4.memview = NULL; + __pyx_t_4.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 5), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 7), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->item_feature_gradients, 0); - __pyx_v___pyx_result->item_feature_gradients = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v___pyx_result->item_feature_gradients = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 6), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 8), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->item_feature_momentum, 0); - __pyx_v___pyx_result->item_feature_momentum = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v___pyx_result->item_feature_momentum = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 7), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 9), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->item_features, 0); - __pyx_v___pyx_result->item_features = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v___pyx_result->item_features = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_5 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_v___pyx_state, 8)); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __pyx_v___pyx_result->item_scale = __pyx_t_5; + __pyx_t_2 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_v___pyx_state, 10)); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->item_scale = __pyx_t_2; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_2 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v___pyx_state, 9)); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __pyx_v___pyx_result->learning_rate = __pyx_t_2; + __pyx_t_3 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v___pyx_state, 11)); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->learning_rate = __pyx_t_3; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyInt_As_int(PyTuple_GET_ITEM(__pyx_v___pyx_state, 10)); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_int(PyTuple_GET_ITEM(__pyx_v___pyx_state, 12)); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) __pyx_v___pyx_result->max_sampled = __pyx_t_1; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_1 = __Pyx_PyInt_As_int(PyTuple_GET_ITEM(__pyx_v___pyx_state, 11)); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyInt_As_int(PyTuple_GET_ITEM(__pyx_v___pyx_state, 13)); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) __pyx_v___pyx_result->no_components = __pyx_t_1; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_2 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v___pyx_state, 12)); if (unlikely((__pyx_t_2 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __pyx_v___pyx_result->rho = __pyx_t_2; + __pyx_t_3 = __pyx_PyFloat_AsFloat(PyTuple_GET_ITEM(__pyx_v___pyx_state, 14)); if (unlikely((__pyx_t_3 == (float)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->rho = __pyx_t_3; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 13), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 15), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->user_bias_gradients, 0); - __pyx_v___pyx_result->user_bias_gradients = __pyx_t_3; - __pyx_t_3.memview = NULL; - __pyx_t_3.data = NULL; + __pyx_v___pyx_result->user_bias_gradients = __pyx_t_4; + __pyx_t_4.memview = NULL; + __pyx_t_4.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 14), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 16), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->user_bias_momentum, 0); - __pyx_v___pyx_result->user_bias_momentum = __pyx_t_3; - __pyx_t_3.memview = NULL; - __pyx_t_3.data = NULL; + __pyx_v___pyx_result->user_bias_momentum = __pyx_t_4; + __pyx_t_4.memview = NULL; + __pyx_t_4.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_3 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 15), PyBUF_WRITABLE); if (unlikely(!__pyx_t_3.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 17), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->user_biases, 0); - __pyx_v___pyx_result->user_biases = __pyx_t_3; - __pyx_t_3.memview = NULL; - __pyx_t_3.data = NULL; + __pyx_v___pyx_result->user_biases = __pyx_t_4; + __pyx_t_4.memview = NULL; + __pyx_t_4.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 16), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 18), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->user_feature_gradients, 0); - __pyx_v___pyx_result->user_feature_gradients = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v___pyx_result->user_feature_gradients = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 17), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 19), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->user_feature_momentum, 0); - __pyx_v___pyx_result->user_feature_momentum = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v___pyx_result->user_feature_momentum = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_4 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 18), PyBUF_WRITABLE); if (unlikely(!__pyx_t_4.memview)) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_t_5 = __Pyx_PyObject_to_MemoryviewSlice_d_dc_nn___pyx_t_7lightfm_20_lightfm_fast_openmp_flt(PyTuple_GET_ITEM(__pyx_v___pyx_state, 20), PyBUF_WRITABLE); if (unlikely(!__pyx_t_5.memview)) __PYX_ERR(1, 12, __pyx_L1_error) __PYX_XDEC_MEMVIEW(&__pyx_v___pyx_result->user_features, 0); - __pyx_v___pyx_result->user_features = __pyx_t_4; - __pyx_t_4.memview = NULL; - __pyx_t_4.data = NULL; + __pyx_v___pyx_result->user_features = __pyx_t_5; + __pyx_t_5.memview = NULL; + __pyx_t_5.data = NULL; if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); __PYX_ERR(1, 12, __pyx_L1_error) } - __pyx_t_5 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_v___pyx_state, 19)); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) - __pyx_v___pyx_result->user_scale = __pyx_t_5; + __pyx_t_2 = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_v___pyx_state, 21)); if (unlikely((__pyx_t_2 == (double)-1) && PyErr_Occurred())) __PYX_ERR(1, 12, __pyx_L1_error) + __pyx_v___pyx_result->user_scale = __pyx_t_2; /* "(tree fragment)":13 * cdef __pyx_unpickle_FastLightFM__set_state(FastLightFM __pyx_result, tuple __pyx_state): - * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.eps = __pyx_state[1]; __pyx_result.item_bias_gradients = __pyx_state[2]; __pyx_result.item_bias_momentum = __pyx_state[3]; __pyx_result.item_biases = __pyx_state[4]; __pyx_result.item_feature_gradients = __pyx_state[5]; __pyx_result.item_feature_momentum = __pyx_state[6]; __pyx_result.item_features = __pyx_state[7]; __pyx_result.item_scale = __pyx_state[8]; __pyx_result.learning_rate = __pyx_state[9]; __pyx_result.max_sampled = __pyx_state[10]; __pyx_result.no_components = __pyx_state[11]; __pyx_result.rho = __pyx_state[12]; __pyx_result.user_bias_gradients = __pyx_state[13]; __pyx_result.user_bias_momentum = __pyx_state[14]; __pyx_result.user_biases = __pyx_state[15]; __pyx_result.user_feature_gradients = __pyx_state[16]; __pyx_result.user_feature_momentum = __pyx_state[17]; __pyx_result.user_features = __pyx_state[18]; __pyx_result.user_scale = __pyx_state[19] - * if len(__pyx_state) > 20 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[20]) + * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.avg_loss = __pyx_state[1]; __pyx_result.avg_loss_ctr = __pyx_state[2]; __pyx_result.eps = __pyx_state[3]; __pyx_result.item_bias_gradients = __pyx_state[4]; __pyx_result.item_bias_momentum = __pyx_state[5]; __pyx_result.item_biases = __pyx_state[6]; __pyx_result.item_feature_gradients = __pyx_state[7]; __pyx_result.item_feature_momentum = __pyx_state[8]; __pyx_result.item_features = __pyx_state[9]; __pyx_result.item_scale = __pyx_state[10]; __pyx_result.learning_rate = __pyx_state[11]; __pyx_result.max_sampled = __pyx_state[12]; __pyx_result.no_components = __pyx_state[13]; __pyx_result.rho = __pyx_state[14]; __pyx_result.user_bias_gradients = __pyx_state[15]; __pyx_result.user_bias_momentum = __pyx_state[16]; __pyx_result.user_biases = __pyx_state[17]; __pyx_result.user_feature_gradients = __pyx_state[18]; __pyx_result.user_feature_momentum = __pyx_state[19]; __pyx_result.user_features = __pyx_state[20]; __pyx_result.user_scale = __pyx_state[21] + * if len(__pyx_state) > 22 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[22]) */ if (unlikely(__pyx_v___pyx_state == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); __PYX_ERR(1, 13, __pyx_L1_error) } __pyx_t_7 = PyTuple_GET_SIZE(__pyx_v___pyx_state); if (unlikely(__pyx_t_7 == ((Py_ssize_t)-1))) __PYX_ERR(1, 13, __pyx_L1_error) - __pyx_t_8 = ((__pyx_t_7 > 20) != 0); + __pyx_t_8 = ((__pyx_t_7 > 22) != 0); if (__pyx_t_8) { } else { __pyx_t_6 = __pyx_t_8; @@ -11705,9 +11931,9 @@ static PyObject *__pyx_f_7lightfm_20_lightfm_fast_openmp___pyx_unpickle_FastLigh if (__pyx_t_6) { /* "(tree fragment)":14 - * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.eps = __pyx_state[1]; __pyx_result.item_bias_gradients = __pyx_state[2]; __pyx_result.item_bias_momentum = __pyx_state[3]; __pyx_result.item_biases = __pyx_state[4]; __pyx_result.item_feature_gradients = __pyx_state[5]; __pyx_result.item_feature_momentum = __pyx_state[6]; __pyx_result.item_features = __pyx_state[7]; __pyx_result.item_scale = __pyx_state[8]; __pyx_result.learning_rate = __pyx_state[9]; __pyx_result.max_sampled = __pyx_state[10]; __pyx_result.no_components = __pyx_state[11]; __pyx_result.rho = __pyx_state[12]; __pyx_result.user_bias_gradients = __pyx_state[13]; __pyx_result.user_bias_momentum = __pyx_state[14]; __pyx_result.user_biases = __pyx_state[15]; __pyx_result.user_feature_gradients = __pyx_state[16]; __pyx_result.user_feature_momentum = __pyx_state[17]; __pyx_result.user_features = __pyx_state[18]; __pyx_result.user_scale = __pyx_state[19] - * if len(__pyx_state) > 20 and hasattr(__pyx_result, '__dict__'): - * __pyx_result.__dict__.update(__pyx_state[20]) # <<<<<<<<<<<<<< + * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.avg_loss = __pyx_state[1]; __pyx_result.avg_loss_ctr = __pyx_state[2]; __pyx_result.eps = __pyx_state[3]; __pyx_result.item_bias_gradients = __pyx_state[4]; __pyx_result.item_bias_momentum = __pyx_state[5]; __pyx_result.item_biases = __pyx_state[6]; __pyx_result.item_feature_gradients = __pyx_state[7]; __pyx_result.item_feature_momentum = __pyx_state[8]; __pyx_result.item_features = __pyx_state[9]; __pyx_result.item_scale = __pyx_state[10]; __pyx_result.learning_rate = __pyx_state[11]; __pyx_result.max_sampled = __pyx_state[12]; __pyx_result.no_components = __pyx_state[13]; __pyx_result.rho = __pyx_state[14]; __pyx_result.user_bias_gradients = __pyx_state[15]; __pyx_result.user_bias_momentum = __pyx_state[16]; __pyx_result.user_biases = __pyx_state[17]; __pyx_result.user_feature_gradients = __pyx_state[18]; __pyx_result.user_feature_momentum = __pyx_state[19]; __pyx_result.user_features = __pyx_state[20]; __pyx_result.user_scale = __pyx_state[21] + * if len(__pyx_state) > 22 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.__dict__.update(__pyx_state[22]) # <<<<<<<<<<<<<< */ __pyx_t_11 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v___pyx_result), __pyx_n_s_dict); if (unlikely(!__pyx_t_11)) __PYX_ERR(1, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_11); @@ -11728,7 +11954,7 @@ static PyObject *__pyx_f_7lightfm_20_lightfm_fast_openmp___pyx_unpickle_FastLigh __Pyx_DECREF_SET(__pyx_t_12, function); } } - __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_11, PyTuple_GET_ITEM(__pyx_v___pyx_state, 20)) : __Pyx_PyObject_CallOneArg(__pyx_t_12, PyTuple_GET_ITEM(__pyx_v___pyx_state, 20)); + __pyx_t_10 = (__pyx_t_11) ? __Pyx_PyObject_Call2Args(__pyx_t_12, __pyx_t_11, PyTuple_GET_ITEM(__pyx_v___pyx_state, 22)) : __Pyx_PyObject_CallOneArg(__pyx_t_12, PyTuple_GET_ITEM(__pyx_v___pyx_state, 22)); __Pyx_XDECREF(__pyx_t_11); __pyx_t_11 = 0; if (unlikely(!__pyx_t_10)) __PYX_ERR(1, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); @@ -11737,9 +11963,9 @@ static PyObject *__pyx_f_7lightfm_20_lightfm_fast_openmp___pyx_unpickle_FastLigh /* "(tree fragment)":13 * cdef __pyx_unpickle_FastLightFM__set_state(FastLightFM __pyx_result, tuple __pyx_state): - * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.eps = __pyx_state[1]; __pyx_result.item_bias_gradients = __pyx_state[2]; __pyx_result.item_bias_momentum = __pyx_state[3]; __pyx_result.item_biases = __pyx_state[4]; __pyx_result.item_feature_gradients = __pyx_state[5]; __pyx_result.item_feature_momentum = __pyx_state[6]; __pyx_result.item_features = __pyx_state[7]; __pyx_result.item_scale = __pyx_state[8]; __pyx_result.learning_rate = __pyx_state[9]; __pyx_result.max_sampled = __pyx_state[10]; __pyx_result.no_components = __pyx_state[11]; __pyx_result.rho = __pyx_state[12]; __pyx_result.user_bias_gradients = __pyx_state[13]; __pyx_result.user_bias_momentum = __pyx_state[14]; __pyx_result.user_biases = __pyx_state[15]; __pyx_result.user_feature_gradients = __pyx_state[16]; __pyx_result.user_feature_momentum = __pyx_state[17]; __pyx_result.user_features = __pyx_state[18]; __pyx_result.user_scale = __pyx_state[19] - * if len(__pyx_state) > 20 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< - * __pyx_result.__dict__.update(__pyx_state[20]) + * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.avg_loss = __pyx_state[1]; __pyx_result.avg_loss_ctr = __pyx_state[2]; __pyx_result.eps = __pyx_state[3]; __pyx_result.item_bias_gradients = __pyx_state[4]; __pyx_result.item_bias_momentum = __pyx_state[5]; __pyx_result.item_biases = __pyx_state[6]; __pyx_result.item_feature_gradients = __pyx_state[7]; __pyx_result.item_feature_momentum = __pyx_state[8]; __pyx_result.item_features = __pyx_state[9]; __pyx_result.item_scale = __pyx_state[10]; __pyx_result.learning_rate = __pyx_state[11]; __pyx_result.max_sampled = __pyx_state[12]; __pyx_result.no_components = __pyx_state[13]; __pyx_result.rho = __pyx_state[14]; __pyx_result.user_bias_gradients = __pyx_state[15]; __pyx_result.user_bias_momentum = __pyx_state[16]; __pyx_result.user_biases = __pyx_state[17]; __pyx_result.user_feature_gradients = __pyx_state[18]; __pyx_result.user_feature_momentum = __pyx_state[19]; __pyx_result.user_features = __pyx_state[20]; __pyx_result.user_scale = __pyx_state[21] + * if len(__pyx_state) > 22 and hasattr(__pyx_result, '__dict__'): # <<<<<<<<<<<<<< + * __pyx_result.__dict__.update(__pyx_state[22]) */ } @@ -11747,16 +11973,16 @@ static PyObject *__pyx_f_7lightfm_20_lightfm_fast_openmp___pyx_unpickle_FastLigh * __pyx_unpickle_FastLightFM__set_state( __pyx_result, __pyx_state) * return __pyx_result * cdef __pyx_unpickle_FastLightFM__set_state(FastLightFM __pyx_result, tuple __pyx_state): # <<<<<<<<<<<<<< - * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.eps = __pyx_state[1]; __pyx_result.item_bias_gradients = __pyx_state[2]; __pyx_result.item_bias_momentum = __pyx_state[3]; __pyx_result.item_biases = __pyx_state[4]; __pyx_result.item_feature_gradients = __pyx_state[5]; __pyx_result.item_feature_momentum = __pyx_state[6]; __pyx_result.item_features = __pyx_state[7]; __pyx_result.item_scale = __pyx_state[8]; __pyx_result.learning_rate = __pyx_state[9]; __pyx_result.max_sampled = __pyx_state[10]; __pyx_result.no_components = __pyx_state[11]; __pyx_result.rho = __pyx_state[12]; __pyx_result.user_bias_gradients = __pyx_state[13]; __pyx_result.user_bias_momentum = __pyx_state[14]; __pyx_result.user_biases = __pyx_state[15]; __pyx_result.user_feature_gradients = __pyx_state[16]; __pyx_result.user_feature_momentum = __pyx_state[17]; __pyx_result.user_features = __pyx_state[18]; __pyx_result.user_scale = __pyx_state[19] - * if len(__pyx_state) > 20 and hasattr(__pyx_result, '__dict__'): + * __pyx_result.adadelta = __pyx_state[0]; __pyx_result.avg_loss = __pyx_state[1]; __pyx_result.avg_loss_ctr = __pyx_state[2]; __pyx_result.eps = __pyx_state[3]; __pyx_result.item_bias_gradients = __pyx_state[4]; __pyx_result.item_bias_momentum = __pyx_state[5]; __pyx_result.item_biases = __pyx_state[6]; __pyx_result.item_feature_gradients = __pyx_state[7]; __pyx_result.item_feature_momentum = __pyx_state[8]; __pyx_result.item_features = __pyx_state[9]; __pyx_result.item_scale = __pyx_state[10]; __pyx_result.learning_rate = __pyx_state[11]; __pyx_result.max_sampled = __pyx_state[12]; __pyx_result.no_components = __pyx_state[13]; __pyx_result.rho = __pyx_state[14]; __pyx_result.user_bias_gradients = __pyx_state[15]; __pyx_result.user_bias_momentum = __pyx_state[16]; __pyx_result.user_biases = __pyx_state[17]; __pyx_result.user_feature_gradients = __pyx_state[18]; __pyx_result.user_feature_momentum = __pyx_state[19]; __pyx_result.user_features = __pyx_state[20]; __pyx_result.user_scale = __pyx_state[21] + * if len(__pyx_state) > 22 and hasattr(__pyx_result, '__dict__'): */ /* function exit code */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __PYX_XDEC_MEMVIEW(&__pyx_t_3, 1); __PYX_XDEC_MEMVIEW(&__pyx_t_4, 1); + __PYX_XDEC_MEMVIEW(&__pyx_t_5, 1); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); @@ -11784,6 +12010,9 @@ static int __pyx_array___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, P PyObject *__pyx_v_format = 0; PyObject *__pyx_v_mode = 0; int __pyx_v_allocate_buffer; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); @@ -11922,6 +12151,9 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array___cinit__(struct __ Py_ssize_t __pyx_t_9; PyObject *__pyx_t_10 = NULL; Py_ssize_t __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); __Pyx_INCREF(__pyx_v_format); @@ -12545,6 +12777,9 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_2__getbuffer__(stru Py_ssize_t __pyx_t_5; int __pyx_t_6; Py_ssize_t *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; if (__pyx_v_info == NULL) { PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); return -1; @@ -12973,6 +13208,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_5array_7memview___get__(struct _ PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":223 @@ -13023,6 +13261,9 @@ static PyObject *__pyx_array_get_memview(struct __pyx_array_obj *__pyx_v_self) { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_memview", 0); /* "View.MemoryView":227 @@ -13161,6 +13402,9 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_8__getattr__( __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getattr__", 0); /* "View.MemoryView":234 @@ -13226,6 +13470,9 @@ static PyObject *__pyx_array___pyx_pf_15View_dot_MemoryView_5array_10__getitem__ __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); /* "View.MemoryView":237 @@ -13290,6 +13537,9 @@ static int __pyx_array___pyx_pf_15View_dot_MemoryView_5array_12__setitem__(struc int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); /* "View.MemoryView":240 @@ -13347,6 +13597,9 @@ static PyObject *__pyx_pf___pyx_array___reduce_cython__(CYTHON_UNUSED struct __p PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 @@ -13401,6 +13654,9 @@ static PyObject *__pyx_pf___pyx_array_2__setstate_cython__(CYTHON_UNUSED struct PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 @@ -13448,6 +13704,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("array_cwrapper", 0); /* "View.MemoryView":248 @@ -13615,6 +13874,9 @@ static struct __pyx_array_obj *__pyx_array_new(PyObject *__pyx_v_shape, Py_ssize static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_MemviewEnum___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_name = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); @@ -13776,6 +14038,9 @@ static PyObject *__pyx_pf___pyx_MemviewEnum___reduce_cython__(struct __pyx_Memvi int __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":5 @@ -14001,6 +14266,9 @@ static PyObject *__pyx_pf___pyx_MemviewEnum_2__setstate_cython__(struct __pyx_Me PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":17 @@ -14130,6 +14398,9 @@ static int __pyx_memoryview___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_ar PyObject *__pyx_v_obj = 0; int __pyx_v_flags; int __pyx_v_dtype_is_object; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); @@ -14210,6 +14481,9 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview___cinit_ int __pyx_t_2; int __pyx_t_3; int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); /* "View.MemoryView":346 @@ -14741,6 +15015,9 @@ static char *__pyx_memoryview_get_item_pointer(struct __pyx_memoryview_obj *__py PyObject *__pyx_t_5 = NULL; Py_ssize_t __pyx_t_6; char *__pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_item_pointer", 0); /* "View.MemoryView":395 @@ -14888,6 +15165,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_4_ PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; char *__pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); /* "View.MemoryView":404 @@ -15071,6 +15351,9 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_6__setit PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setitem__", 0); __Pyx_INCREF(__pyx_v_index); @@ -15286,6 +15569,9 @@ static PyObject *__pyx_memoryview_is_slice(struct __pyx_memoryview_obj *__pyx_v_ PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_slice", 0); __Pyx_INCREF(__pyx_v_obj); @@ -15492,6 +15778,9 @@ static PyObject *__pyx_memoryview_setitem_slice_assignment(struct __pyx_memoryvi int __pyx_t_4; int __pyx_t_5; int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("setitem_slice_assignment", 0); /* "View.MemoryView":445 @@ -15588,6 +15877,9 @@ static PyObject *__pyx_memoryview_setitem_slice_assign_scalar(struct __pyx_memor PyObject *__pyx_t_10 = NULL; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("setitem_slice_assign_scalar", 0); /* "View.MemoryView":451 @@ -15861,6 +16153,9 @@ static PyObject *__pyx_memoryview_setitem_indexed(struct __pyx_memoryview_obj *_ __Pyx_RefNannyDeclarations char *__pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("setitem_indexed", 0); /* "View.MemoryView":482 @@ -15930,6 +16225,9 @@ static PyObject *__pyx_memoryview_convert_item_to_object(struct __pyx_memoryview PyObject *__pyx_t_9 = NULL; size_t __pyx_t_10; int __pyx_t_11; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convert_item_to_object", 0); /* "View.MemoryView":488 @@ -16208,6 +16506,9 @@ static PyObject *__pyx_memoryview_assign_item_from_object(struct __pyx_memoryvie char *__pyx_t_12; char *__pyx_t_13; char *__pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("assign_item_from_object", 0); /* "View.MemoryView":504 @@ -16447,6 +16748,9 @@ static int __pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_8__getbu void *__pyx_t_6; int __pyx_t_7; Py_ssize_t __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; if (__pyx_v_info == NULL) { PyErr_SetString(PyExc_BufferError, "PyObject_GetBuffer: view==NULL argument is obsolete"); return -1; @@ -16783,6 +17087,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_1T___get__(struct _ __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":554 @@ -16922,6 +17229,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_5shape___get__(stru Py_ssize_t *__pyx_t_3; Py_ssize_t *__pyx_t_4; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":564 @@ -17001,6 +17311,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_7strides___get__(st Py_ssize_t *__pyx_t_4; Py_ssize_t *__pyx_t_5; PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":568 @@ -17112,6 +17425,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_10suboffsets___get_ Py_ssize_t *__pyx_t_4; Py_ssize_t *__pyx_t_5; Py_ssize_t *__pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":576 @@ -17221,6 +17537,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4ndim___get__(struc PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":583 @@ -17281,6 +17600,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_8itemsize___get__(s PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":587 @@ -17343,6 +17665,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_6nbytes___get__(str PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":591 @@ -17418,6 +17743,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView_10memoryview_4size___get__(struc Py_ssize_t *__pyx_t_4; Py_ssize_t *__pyx_t_5; PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); /* "View.MemoryView":595 @@ -17631,6 +17959,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_12 PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__repr__", 0); /* "View.MemoryView":612 @@ -17729,6 +18060,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_14 __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); /* "View.MemoryView":616 @@ -17807,6 +18141,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_16 __Pyx_RefNannyDeclarations __Pyx_memviewslice *__pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_c_contig", 0); /* "View.MemoryView":622 @@ -17880,6 +18217,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_18 __Pyx_RefNannyDeclarations __Pyx_memviewslice *__pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_f_contig", 0); /* "View.MemoryView":628 @@ -17953,6 +18293,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_20 __Pyx_RefNannyDeclarations __Pyx_memviewslice __pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("copy", 0); /* "View.MemoryView":633 @@ -18045,6 +18388,9 @@ static PyObject *__pyx_memoryview___pyx_pf_15View_dot_MemoryView_10memoryview_22 __Pyx_RefNannyDeclarations __Pyx_memviewslice __pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("copy_fortran", 0); /* "View.MemoryView":645 @@ -18131,6 +18477,9 @@ static PyObject *__pyx_pf___pyx_memoryview___reduce_cython__(CYTHON_UNUSED struc PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 @@ -18185,6 +18534,9 @@ static PyObject *__pyx_pf___pyx_memoryview_2__setstate_cython__(CYTHON_UNUSED st PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 @@ -18230,6 +18582,9 @@ static PyObject *__pyx_memoryview_new(PyObject *__pyx_v_o, int __pyx_v_flags, in PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_cwrapper", 0); /* "View.MemoryView":658 @@ -18371,6 +18726,9 @@ static PyObject *_unellipsify(PyObject *__pyx_v_index, int __pyx_v_ndim) { int __pyx_t_9; int __pyx_t_10; PyObject *__pyx_t_11 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_unellipsify", 0); /* "View.MemoryView":671 @@ -18813,6 +19171,9 @@ static PyObject *assert_direct_dimensions(Py_ssize_t *__pyx_v_suboffsets, int __ Py_ssize_t *__pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("assert_direct_dimensions", 0); /* "View.MemoryView":701 @@ -18920,6 +19281,9 @@ static struct __pyx_memoryview_obj *__pyx_memview_slice(struct __pyx_memoryview_ Py_ssize_t __pyx_t_10; int __pyx_t_11; Py_ssize_t __pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memview_slice", 0); /* "View.MemoryView":711 @@ -19473,6 +19837,9 @@ static int __pyx_memoryview_slice_memviewslice(__Pyx_memviewslice *__pyx_v_dst, int __pyx_t_1; int __pyx_t_2; int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; /* "View.MemoryView":827 * cdef bint negative_step @@ -20259,6 +20626,9 @@ static char *__pyx_pybuffer_index(Py_buffer *__pyx_v_view, char *__pyx_v_bufp, P int __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("pybuffer_index", 0); /* "View.MemoryView":912 @@ -20569,6 +20939,9 @@ static int __pyx_memslice_transpose(__Pyx_memviewslice *__pyx_v_memslice) { int __pyx_t_7; int __pyx_t_8; int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; /* "View.MemoryView":944 * @cname('__pyx_memslice_transpose') @@ -20773,6 +21146,9 @@ static PyObject *__pyx_memoryviewslice_convert_item_to_object(struct __pyx_memor __Pyx_RefNannyDeclarations int __pyx_t_1; PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("convert_item_to_object", 0); /* "View.MemoryView":980 @@ -20857,6 +21233,9 @@ static PyObject *__pyx_memoryviewslice_assign_item_from_object(struct __pyx_memo int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("assign_item_from_object", 0); /* "View.MemoryView":986 @@ -20999,6 +21378,9 @@ static PyObject *__pyx_pf___pyx_memoryviewslice___reduce_cython__(CYTHON_UNUSED PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce_cython__", 0); /* "(tree fragment)":2 @@ -21053,6 +21435,9 @@ static PyObject *__pyx_pf___pyx_memoryviewslice_2__setstate_cython__(CYTHON_UNUS PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate_cython__", 0); /* "(tree fragment)":4 @@ -21106,6 +21491,9 @@ static PyObject *__pyx_memoryview_fromslice(__Pyx_memviewslice __pyx_v_memviewsl Py_ssize_t *__pyx_t_7; Py_ssize_t *__pyx_t_8; Py_ssize_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_fromslice", 0); /* "View.MemoryView":1007 @@ -21481,6 +21869,9 @@ static __Pyx_memviewslice *__pyx_memoryview_get_slice_from_memoryview(struct __p int __pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_slice_from_memview", 0); /* "View.MemoryView":1055 @@ -21705,6 +22096,9 @@ static PyObject *__pyx_memoryview_copy_object(struct __pyx_memoryview_obj *__pyx PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_copy", 0); /* "View.MemoryView":1083 @@ -21767,6 +22161,9 @@ static PyObject *__pyx_memoryview_copy_object_from_slice(struct __pyx_memoryview PyObject *(*__pyx_t_3)(char *); int (*__pyx_t_4)(char *, PyObject *); PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("memoryview_copy_from_slice", 0); /* "View.MemoryView":1094 @@ -22609,6 +23006,9 @@ static void *__pyx_memoryview_copy_data_to_temp(__Pyx_memviewslice *__pyx_v_src, struct __pyx_memoryview_obj *__pyx_t_4; int __pyx_t_5; int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; /* "View.MemoryView":1219 * cdef void *result @@ -22856,6 +23256,9 @@ static int __pyx_memoryview_err_extents(int __pyx_v_i, Py_ssize_t __pyx_v_extent PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif @@ -22941,6 +23344,9 @@ static int __pyx_memoryview_err_dim(PyObject *__pyx_v_error, char *__pyx_v_msg, PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif @@ -23023,6 +23429,9 @@ static int __pyx_memoryview_err(PyObject *__pyx_v_error, char *__pyx_v_msg) { PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; #ifdef WITH_THREAD PyGILState_STATE __pyx_gilstate_save = __Pyx_PyGILState_Ensure(); #endif @@ -23140,6 +23549,9 @@ static int __pyx_memoryview_copy_contents(__Pyx_memviewslice __pyx_v_src, __Pyx_ int __pyx_t_6; void *__pyx_t_7; int __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; /* "View.MemoryView":1276 * Check for overlapping memory and verify the shapes. @@ -24216,6 +24628,9 @@ static PyObject *__pyx_pw_15View_dot_MemoryView_1__pyx_unpickle_Enum(PyObject *_ PyObject *__pyx_v___pyx_type = 0; long __pyx_v___pyx_checksum; PyObject *__pyx_v___pyx_state = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__pyx_unpickle_Enum (wrapper)", 0); @@ -24293,6 +24708,9 @@ static PyObject *__pyx_pf_15View_dot_MemoryView___pyx_unpickle_Enum(CYTHON_UNUSE PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_unpickle_Enum", 0); /* "(tree fragment)":4 @@ -24481,6 +24899,9 @@ static PyObject *__pyx_unpickle_Enum__set_state(struct __pyx_MemviewEnum_obj *__ PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__pyx_unpickle_Enum__set_state", 0); /* "(tree fragment)":12 @@ -24698,6 +25119,9 @@ static PyTypeObject __pyx_type_7lightfm_20_lightfm_fast_openmp_CSRMatrix = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyObject *__pyx_tp_new_7lightfm_20_lightfm_fast_openmp_FastLightFM(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { @@ -24759,12 +25183,21 @@ static void __pyx_tp_dealloc_7lightfm_20_lightfm_fast_openmp_FastLightFM(PyObjec (*Py_TYPE(o)->tp_free)(o); } +static PyObject *__pyx_getprop_7lightfm_20_lightfm_fast_openmp_11FastLightFM_avg_loss(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_7lightfm_20_lightfm_fast_openmp_11FastLightFM_8avg_loss_1__get__(o); +} + static PyMethodDef __pyx_methods_7lightfm_20_lightfm_fast_openmp_FastLightFM[] = { {"__reduce_cython__", (PyCFunction)__pyx_pw_7lightfm_20_lightfm_fast_openmp_11FastLightFM_3__reduce_cython__, METH_NOARGS, 0}, {"__setstate_cython__", (PyCFunction)__pyx_pw_7lightfm_20_lightfm_fast_openmp_11FastLightFM_5__setstate_cython__, METH_O, 0}, {0, 0, 0, 0} }; +static struct PyGetSetDef __pyx_getsets_7lightfm_20_lightfm_fast_openmp_FastLightFM[] = { + {(char *)"avg_loss", __pyx_getprop_7lightfm_20_lightfm_fast_openmp_11FastLightFM_avg_loss, 0, (char *)0, 0}, + {0, 0, 0, 0, 0} +}; + static PyTypeObject __pyx_type_7lightfm_20_lightfm_fast_openmp_FastLightFM = { PyVarObject_HEAD_INIT(0, 0) "lightfm._lightfm_fast_openmp.FastLightFM", /*tp_name*/ @@ -24805,7 +25238,7 @@ static PyTypeObject __pyx_type_7lightfm_20_lightfm_fast_openmp_FastLightFM = { 0, /*tp_iternext*/ __pyx_methods_7lightfm_20_lightfm_fast_openmp_FastLightFM, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_7lightfm_20_lightfm_fast_openmp_FastLightFM, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -24832,6 +25265,9 @@ static PyTypeObject __pyx_type_7lightfm_20_lightfm_fast_openmp_FastLightFM = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static struct __pyx_vtabstruct_array __pyx_vtable_array; @@ -24865,9 +25301,9 @@ static void __pyx_tp_dealloc_array(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); - Py_SET_REFCNT(o, 1 + Py_REFCNT(o)); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); __pyx_array___dealloc__(o); - Py_SET_REFCNT(o, Py_REFCNT(o) - 1); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->mode); @@ -25021,6 +25457,9 @@ static PyTypeObject __pyx_type___pyx_array = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyObject *__pyx_tp_new_Enum(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { @@ -25140,6 +25579,9 @@ static PyTypeObject __pyx_type___pyx_MemviewEnum = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static struct __pyx_vtabstruct_memoryview __pyx_vtable_memoryview; @@ -25176,9 +25618,9 @@ static void __pyx_tp_dealloc_memoryview(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); - Py_SET_REFCNT(o, 1 + Py_REFCNT(o)); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); __pyx_memoryview___dealloc__(o); - Py_SET_REFCNT(o, Py_REFCNT(o) - 1); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->obj); @@ -25401,6 +25843,9 @@ static PyTypeObject __pyx_type___pyx_memoryview = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static struct __pyx_vtabstruct__memoryviewslice __pyx_vtable__memoryviewslice; @@ -25426,9 +25871,9 @@ static void __pyx_tp_dealloc__memoryviewslice(PyObject *o) { { PyObject *etype, *eval, *etb; PyErr_Fetch(&etype, &eval, &etb); - Py_SET_REFCNT(o, 1 + Py_REFCNT(o)); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) + 1); __pyx_memoryviewslice___dealloc__(o); - Py_SET_REFCNT(o, Py_REFCNT(o) - 1); + __Pyx_SET_REFCNT(o, Py_REFCNT(o) - 1); PyErr_Restore(etype, eval, etb); } Py_CLEAR(p->from_object); @@ -25547,6 +25992,9 @@ static PyTypeObject __pyx_type___pyx_memoryviewslice = { #if PY_VERSION_HEX >= 0x030800b4 && PY_VERSION_HEX < 0x03090000 0, /*tp_print*/ #endif + #if CYTHON_COMPILING_IN_PYPY && PYPY_VERSION_NUM+0 >= 0x06000000 + 0, /*tp_pypy_flags*/ + #endif }; static PyMethodDef __pyx_methods[] = { @@ -25606,8 +26054,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_Empty_shape_tuple_for_cython_arr, __pyx_k_Empty_shape_tuple_for_cython_arr, sizeof(__pyx_k_Empty_shape_tuple_for_cython_arr), 0, 0, 1, 0}, {&__pyx_n_s_FastLightFM, __pyx_k_FastLightFM, sizeof(__pyx_k_FastLightFM), 0, 0, 1, 1}, {&__pyx_kp_s_Incompatible_checksums_s_vs_0x5b, __pyx_k_Incompatible_checksums_s_vs_0x5b, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x5b), 0, 0, 1, 0}, + {&__pyx_kp_s_Incompatible_checksums_s_vs_0x8f, __pyx_k_Incompatible_checksums_s_vs_0x8f, sizeof(__pyx_k_Incompatible_checksums_s_vs_0x8f), 0, 0, 1, 0}, {&__pyx_kp_s_Incompatible_checksums_s_vs_0xb0, __pyx_k_Incompatible_checksums_s_vs_0xb0, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xb0), 0, 0, 1, 0}, - {&__pyx_kp_s_Incompatible_checksums_s_vs_0xdd, __pyx_k_Incompatible_checksums_s_vs_0xdd, sizeof(__pyx_k_Incompatible_checksums_s_vs_0xdd), 0, 0, 1, 0}, {&__pyx_n_s_IndexError, __pyx_k_IndexError, sizeof(__pyx_k_IndexError), 0, 0, 1, 1}, {&__pyx_kp_s_Indirect_dimensions_not_supporte, __pyx_k_Indirect_dimensions_not_supporte, sizeof(__pyx_k_Indirect_dimensions_not_supporte), 0, 0, 1, 0}, {&__pyx_kp_s_Invalid_mode_expected_c_or_fortr, __pyx_k_Invalid_mode_expected_c_or_fortr, sizeof(__pyx_k_Invalid_mode_expected_c_or_fortr), 0, 0, 1, 0}, @@ -25788,7 +26236,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 311, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 317, __pyx_L1_error) __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s_ValueError); if (!__pyx_builtin_ValueError) __PYX_ERR(1, 133, __pyx_L1_error) __pyx_builtin_MemoryError = __Pyx_GetBuiltinName(__pyx_n_s_MemoryError); if (!__pyx_builtin_MemoryError) __PYX_ERR(1, 148, __pyx_L1_error) __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s_enumerate); if (!__pyx_builtin_enumerate) __PYX_ERR(1, 151, __pyx_L1_error) @@ -25997,101 +26445,101 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__18); __Pyx_GIVEREF(__pyx_tuple__18); - /* "lightfm/_lightfm_fast_openmp.pyx":700 + /* "lightfm/_lightfm_fast_openmp.pyx":712 * * * def fit_logistic(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * int[::1] user_ids, */ - __pyx_tuple__19 = PyTuple_Pack(24, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_Y, __pyx_n_s_sample_weight, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_item_id, __pyx_n_s_row, __pyx_n_s_prediction, __pyx_n_s_loss, __pyx_n_s_y, __pyx_n_s_y_row, __pyx_n_s_weight, __pyx_n_s_user_repr, __pyx_n_s_it_repr); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 700, __pyx_L1_error) + __pyx_tuple__19 = PyTuple_Pack(24, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_Y, __pyx_n_s_sample_weight, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_item_id, __pyx_n_s_row, __pyx_n_s_prediction, __pyx_n_s_loss, __pyx_n_s_y, __pyx_n_s_y_row, __pyx_n_s_weight, __pyx_n_s_user_repr, __pyx_n_s_it_repr); if (unlikely(!__pyx_tuple__19)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__19); __Pyx_GIVEREF(__pyx_tuple__19); - __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(12, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_fit_logistic, 700, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 700, __pyx_L1_error) + __pyx_codeobj__20 = (PyObject*)__Pyx_PyCode_New(12, 0, 24, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__19, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_fit_logistic, 712, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__20)) __PYX_ERR(0, 712, __pyx_L1_error) - /* "lightfm/_lightfm_fast_openmp.pyx":790 + /* "lightfm/_lightfm_fast_openmp.pyx":802 * * * def fit_warp(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix interactions, */ - __pyx_tuple__21 = PyTuple_Pack(31, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_interactions, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_Y, __pyx_n_s_sample_weight, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_num_threads, __pyx_n_s_random_state, __pyx_n_s_i, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_positive_item_id, __pyx_n_s_gamma, __pyx_n_s_negative_item_id, __pyx_n_s_sampled, __pyx_n_s_row, __pyx_n_s_positive_prediction, __pyx_n_s_negative_prediction, __pyx_n_s_loss, __pyx_n_s_MAX_LOSS, __pyx_n_s_weight, __pyx_n_s_user_repr, __pyx_n_s_pos_it_repr, __pyx_n_s_neg_it_repr, __pyx_n_s_random_states); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 790, __pyx_L1_error) + __pyx_tuple__21 = PyTuple_Pack(31, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_interactions, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_Y, __pyx_n_s_sample_weight, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_num_threads, __pyx_n_s_random_state, __pyx_n_s_i, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_positive_item_id, __pyx_n_s_gamma, __pyx_n_s_negative_item_id, __pyx_n_s_sampled, __pyx_n_s_row, __pyx_n_s_positive_prediction, __pyx_n_s_negative_prediction, __pyx_n_s_loss, __pyx_n_s_MAX_LOSS, __pyx_n_s_weight, __pyx_n_s_user_repr, __pyx_n_s_pos_it_repr, __pyx_n_s_neg_it_repr, __pyx_n_s_random_states); if (unlikely(!__pyx_tuple__21)) __PYX_ERR(0, 802, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__21); __Pyx_GIVEREF(__pyx_tuple__21); - __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(14, 0, 31, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_fit_warp, 790, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 790, __pyx_L1_error) + __pyx_codeobj__22 = (PyObject*)__Pyx_PyCode_New(14, 0, 31, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__21, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_fit_warp, 802, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__22)) __PYX_ERR(0, 802, __pyx_L1_error) - /* "lightfm/_lightfm_fast_openmp.pyx":921 + /* "lightfm/_lightfm_fast_openmp.pyx":933 * * * def fit_warp_kos(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix data, */ - __pyx_tuple__23 = PyTuple_Pack(37, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_data, __pyx_n_s_user_ids, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_k, __pyx_n_s_n, __pyx_n_s_num_threads, __pyx_n_s_random_state, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_positive_item_id, __pyx_n_s_gamma, __pyx_n_s_negative_item_id, __pyx_n_s_sampled, __pyx_n_s_row, __pyx_n_s_sampled_positive_item_id, __pyx_n_s_user_pids_start, __pyx_n_s_user_pids_stop, __pyx_n_s_no_positives, __pyx_n_s_POS_SAMPLES, __pyx_n_s_positive_prediction, __pyx_n_s_negative_prediction, __pyx_n_s_loss, __pyx_n_s_MAX_LOSS, __pyx_n_s_sampled_positive_prediction, __pyx_n_s_user_repr, __pyx_n_s_pos_it_repr, __pyx_n_s_neg_it_repr, __pyx_n_s_pos_pairs, __pyx_n_s_random_states); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 921, __pyx_L1_error) + __pyx_tuple__23 = PyTuple_Pack(37, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_data, __pyx_n_s_user_ids, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_k, __pyx_n_s_n, __pyx_n_s_num_threads, __pyx_n_s_random_state, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_positive_item_id, __pyx_n_s_gamma, __pyx_n_s_negative_item_id, __pyx_n_s_sampled, __pyx_n_s_row, __pyx_n_s_sampled_positive_item_id, __pyx_n_s_user_pids_start, __pyx_n_s_user_pids_stop, __pyx_n_s_no_positives, __pyx_n_s_POS_SAMPLES, __pyx_n_s_positive_prediction, __pyx_n_s_negative_prediction, __pyx_n_s_loss, __pyx_n_s_MAX_LOSS, __pyx_n_s_sampled_positive_prediction, __pyx_n_s_user_repr, __pyx_n_s_pos_it_repr, __pyx_n_s_neg_it_repr, __pyx_n_s_pos_pairs, __pyx_n_s_random_states); if (unlikely(!__pyx_tuple__23)) __PYX_ERR(0, 933, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__23); __Pyx_GIVEREF(__pyx_tuple__23); - __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(13, 0, 37, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_fit_warp_kos, 921, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 921, __pyx_L1_error) + __pyx_codeobj__24 = (PyObject*)__Pyx_PyCode_New(13, 0, 37, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__23, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_fit_warp_kos, 933, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__24)) __PYX_ERR(0, 933, __pyx_L1_error) - /* "lightfm/_lightfm_fast_openmp.pyx":1080 + /* "lightfm/_lightfm_fast_openmp.pyx":1092 * * * def fit_bpr(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix interactions, */ - __pyx_tuple__25 = PyTuple_Pack(29, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_interactions, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_Y, __pyx_n_s_sample_weight, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_num_threads, __pyx_n_s_random_state, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_positive_item_id, __pyx_n_s_negative_item_id, __pyx_n_s_sampled, __pyx_n_s_row, __pyx_n_s_positive_prediction, __pyx_n_s_negative_prediction, __pyx_n_s_weight, __pyx_n_s_random_states, __pyx_n_s_user_repr, __pyx_n_s_pos_it_repr, __pyx_n_s_neg_it_repr); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 1080, __pyx_L1_error) + __pyx_tuple__25 = PyTuple_Pack(29, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_interactions, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_Y, __pyx_n_s_sample_weight, __pyx_n_s_shuffle_indices, __pyx_n_s_lightfm, __pyx_n_s_learning_rate, __pyx_n_s_item_alpha, __pyx_n_s_user_alpha, __pyx_n_s_num_threads, __pyx_n_s_random_state, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_no_examples, __pyx_n_s_user_id, __pyx_n_s_positive_item_id, __pyx_n_s_negative_item_id, __pyx_n_s_sampled, __pyx_n_s_row, __pyx_n_s_positive_prediction, __pyx_n_s_negative_prediction, __pyx_n_s_weight, __pyx_n_s_random_states, __pyx_n_s_user_repr, __pyx_n_s_pos_it_repr, __pyx_n_s_neg_it_repr); if (unlikely(!__pyx_tuple__25)) __PYX_ERR(0, 1092, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__25); __Pyx_GIVEREF(__pyx_tuple__25); - __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(14, 0, 29, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_fit_bpr, 1080, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 1080, __pyx_L1_error) + __pyx_codeobj__26 = (PyObject*)__Pyx_PyCode_New(14, 0, 29, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__25, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_fit_bpr, 1092, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__26)) __PYX_ERR(0, 1092, __pyx_L1_error) - /* "lightfm/_lightfm_fast_openmp.pyx":1191 + /* "lightfm/_lightfm_fast_openmp.pyx":1203 * * * def predict_lightfm(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * int[::1] user_ids, */ - __pyx_tuple__27 = PyTuple_Pack(11, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_predictions, __pyx_n_s_lightfm, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_no_examples, __pyx_n_s_user_repr, __pyx_n_s_it_repr); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 1191, __pyx_L1_error) + __pyx_tuple__27 = PyTuple_Pack(11, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_user_ids, __pyx_n_s_item_ids, __pyx_n_s_predictions, __pyx_n_s_lightfm, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_no_examples, __pyx_n_s_user_repr, __pyx_n_s_it_repr); if (unlikely(!__pyx_tuple__27)) __PYX_ERR(0, 1203, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__27); __Pyx_GIVEREF(__pyx_tuple__27); - __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_predict_lightfm, 1191, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 1191, __pyx_L1_error) + __pyx_codeobj__28 = (PyObject*)__Pyx_PyCode_New(7, 0, 11, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__27, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_predict_lightfm, 1203, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__28)) __PYX_ERR(0, 1203, __pyx_L1_error) - /* "lightfm/_lightfm_fast_openmp.pyx":1238 + /* "lightfm/_lightfm_fast_openmp.pyx":1250 * * * def predict_ranks(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix test_interactions, */ - __pyx_tuple__29 = PyTuple_Pack(20, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_test_interactions, __pyx_n_s_train_interactions, __pyx_n_s_ranks, __pyx_n_s_lightfm, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_user_id, __pyx_n_s_item_id, __pyx_n_s_predictions_size, __pyx_n_s_row_start, __pyx_n_s_row_stop, __pyx_n_s_user_repr, __pyx_n_s_it_repr, __pyx_n_s_predictions, __pyx_n_s_prediction, __pyx_n_s_rank, __pyx_n_s_item_ids); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 1238, __pyx_L1_error) + __pyx_tuple__29 = PyTuple_Pack(20, __pyx_n_s_item_features, __pyx_n_s_user_features, __pyx_n_s_test_interactions, __pyx_n_s_train_interactions, __pyx_n_s_ranks, __pyx_n_s_lightfm, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_user_id, __pyx_n_s_item_id, __pyx_n_s_predictions_size, __pyx_n_s_row_start, __pyx_n_s_row_stop, __pyx_n_s_user_repr, __pyx_n_s_it_repr, __pyx_n_s_predictions, __pyx_n_s_prediction, __pyx_n_s_rank, __pyx_n_s_item_ids); if (unlikely(!__pyx_tuple__29)) __PYX_ERR(0, 1250, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__29); __Pyx_GIVEREF(__pyx_tuple__29); - __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(7, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_predict_ranks, 1238, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 1238, __pyx_L1_error) + __pyx_codeobj__30 = (PyObject*)__Pyx_PyCode_New(7, 0, 20, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_predict_ranks, 1250, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__30)) __PYX_ERR(0, 1250, __pyx_L1_error) - /* "lightfm/_lightfm_fast_openmp.pyx":1332 + /* "lightfm/_lightfm_fast_openmp.pyx":1344 * * * def calculate_auc_from_rank(CSRMatrix ranks, # <<<<<<<<<<<<<< * int[::1] num_train_positives, * flt[::1] rank_data, */ - __pyx_tuple__31 = PyTuple_Pack(13, __pyx_n_s_ranks, __pyx_n_s_num_train_positives, __pyx_n_s_rank_data, __pyx_n_s_auc, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_user_id, __pyx_n_s_row_start, __pyx_n_s_row_stop, __pyx_n_s_num_negatives, __pyx_n_s_num_positives, __pyx_n_s_rank); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 1332, __pyx_L1_error) + __pyx_tuple__31 = PyTuple_Pack(13, __pyx_n_s_ranks, __pyx_n_s_num_train_positives, __pyx_n_s_rank_data, __pyx_n_s_auc, __pyx_n_s_num_threads, __pyx_n_s_i, __pyx_n_s_j, __pyx_n_s_user_id, __pyx_n_s_row_start, __pyx_n_s_row_stop, __pyx_n_s_num_negatives, __pyx_n_s_num_positives, __pyx_n_s_rank); if (unlikely(!__pyx_tuple__31)) __PYX_ERR(0, 1344, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__31); __Pyx_GIVEREF(__pyx_tuple__31); - __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_calculate_auc_from_rank, 1332, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 1332, __pyx_L1_error) + __pyx_codeobj__32 = (PyObject*)__Pyx_PyCode_New(5, 0, 13, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_calculate_auc_from_rank, 1344, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__32)) __PYX_ERR(0, 1344, __pyx_L1_error) - /* "lightfm/_lightfm_fast_openmp.pyx":1386 + /* "lightfm/_lightfm_fast_openmp.pyx":1398 * * # Expose test functions * def __test_in_positives(int row, int col, CSRMatrix mat): # <<<<<<<<<<<<<< * * if in_positives(col, row, mat): */ - __pyx_tuple__33 = PyTuple_Pack(3, __pyx_n_s_row, __pyx_n_s_col, __pyx_n_s_mat); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 1386, __pyx_L1_error) + __pyx_tuple__33 = PyTuple_Pack(3, __pyx_n_s_row, __pyx_n_s_col, __pyx_n_s_mat); if (unlikely(!__pyx_tuple__33)) __PYX_ERR(0, 1398, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__33); __Pyx_GIVEREF(__pyx_tuple__33); - __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_test_in_positives, 1386, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 1386, __pyx_L1_error) + __pyx_codeobj__34 = (PyObject*)__Pyx_PyCode_New(3, 0, 3, 0, CO_OPTIMIZED|CO_NEWLOCALS, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_lightfm__lightfm_fast_openmp_pyx, __pyx_n_s_test_in_positives, 1398, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj__34)) __PYX_ERR(0, 1398, __pyx_L1_error) /* "(tree fragment)":1 * def __pyx_unpickle_CSRMatrix(__pyx_type, long __pyx_checksum, __pyx_state): # <<<<<<<<<<<<<< @@ -26180,7 +26628,7 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { static CYTHON_SMALL_CODE int __Pyx_InitGlobals(void) { /* InitThreads.init */ - #ifdef WITH_THREAD + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 PyEval_InitThreads(); #endif @@ -26190,8 +26638,8 @@ if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_95829634 = PyInt_FromLong(95829634L); if (unlikely(!__pyx_int_95829634)) __PYX_ERR(0, 1, __pyx_L1_error) + __pyx_int_150189132 = PyInt_FromLong(150189132L); if (unlikely(!__pyx_int_150189132)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_184977713 = PyInt_FromLong(184977713L); if (unlikely(!__pyx_int_184977713)) __PYX_ERR(0, 1, __pyx_L1_error) - __pyx_int_232728138 = PyInt_FromLong(232728138L); if (unlikely(!__pyx_int_232728138)) __PYX_ERR(0, 1, __pyx_L1_error) __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) __PYX_ERR(0, 1, __pyx_L1_error) return 0; __pyx_L1_error:; @@ -26237,6 +26685,9 @@ static int __Pyx_modinit_function_export_code(void) { static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ __pyx_vtabptr_7lightfm_20_lightfm_fast_openmp_CSRMatrix = &__pyx_vtable_7lightfm_20_lightfm_fast_openmp_CSRMatrix; @@ -26346,17 +26797,19 @@ static int __Pyx_modinit_function_import_code(void) { } -#if PY_MAJOR_VERSION < 3 -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC void -#else +#ifndef CYTHON_NO_PYINIT_EXPORT #define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#elif PY_MAJOR_VERSION < 3 +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" void +#else +#define __Pyx_PyMODINIT_FUNC void #endif #else -#ifdef CYTHON_NO_PYINIT_EXPORT -#define __Pyx_PyMODINIT_FUNC PyObject * +#ifdef __cplusplus +#define __Pyx_PyMODINIT_FUNC extern "C" PyObject * #else -#define __Pyx_PyMODINIT_FUNC PyMODINIT_FUNC +#define __Pyx_PyMODINIT_FUNC PyObject * #endif #endif @@ -26439,6 +26892,9 @@ static CYTHON_SMALL_CODE int __pyx_pymod_exec__lightfm_fast_openmp(PyObject *__p { PyObject *__pyx_t_1 = NULL; static PyThread_type_lock __pyx_t_2[8]; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; __Pyx_RefNannyDeclarations #if CYTHON_PEP489_MULTI_PHASE_INIT if (__pyx_m) { @@ -26486,11 +26942,9 @@ if (!__Pyx_RefNanny) { #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ - #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS - #ifdef WITH_THREAD /* Python build with threading support? */ + #if defined(WITH_THREAD) && PY_VERSION_HEX < 0x030700F0 && defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS PyEval_InitThreads(); #endif - #endif /*--- Module creation code ---*/ #if CYTHON_PEP489_MULTI_PHASE_INIT __pyx_m = __pyx_pyinit_module; @@ -26527,14 +26981,14 @@ if (!__Pyx_RefNanny) { } #endif /*--- Builtin init code ---*/ - if (__Pyx_InitCachedBuiltins() < 0) goto __pyx_L1_error; + if (__Pyx_InitCachedBuiltins() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Constants init code ---*/ - if (__Pyx_InitCachedConstants() < 0) goto __pyx_L1_error; + if (__Pyx_InitCachedConstants() < 0) __PYX_ERR(0, 1, __pyx_L1_error) /*--- Global type/function init code ---*/ (void)__Pyx_modinit_global_init_code(); (void)__Pyx_modinit_variable_export_code(); (void)__Pyx_modinit_function_export_code(); - if (unlikely(__Pyx_modinit_type_init_code() != 0)) goto __pyx_L1_error; + if (unlikely(__Pyx_modinit_type_init_code() < 0)) __PYX_ERR(0, 1, __pyx_L1_error) (void)__Pyx_modinit_type_import_code(); (void)__Pyx_modinit_variable_import_code(); (void)__Pyx_modinit_function_import_code(); @@ -26573,100 +27027,100 @@ if (!__Pyx_RefNanny) { */ __pyx_v_7lightfm_20_lightfm_fast_openmp_MAX_REG_SCALE = 1000000.0; - /* "lightfm/_lightfm_fast_openmp.pyx":700 + /* "lightfm/_lightfm_fast_openmp.pyx":712 * * * def fit_logistic(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * int[::1] user_ids, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_1fit_logistic, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 700, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_1fit_logistic, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_logistic, __pyx_t_1) < 0) __PYX_ERR(0, 700, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_logistic, __pyx_t_1) < 0) __PYX_ERR(0, 712, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":790 + /* "lightfm/_lightfm_fast_openmp.pyx":802 * * * def fit_warp(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix interactions, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_3fit_warp, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 790, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_3fit_warp, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 802, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_warp, __pyx_t_1) < 0) __PYX_ERR(0, 790, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_warp, __pyx_t_1) < 0) __PYX_ERR(0, 802, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":921 + /* "lightfm/_lightfm_fast_openmp.pyx":933 * * * def fit_warp_kos(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix data, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_5fit_warp_kos, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 921, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_5fit_warp_kos, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 933, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_warp_kos, __pyx_t_1) < 0) __PYX_ERR(0, 921, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_warp_kos, __pyx_t_1) < 0) __PYX_ERR(0, 933, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":1080 + /* "lightfm/_lightfm_fast_openmp.pyx":1092 * * * def fit_bpr(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix interactions, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_7fit_bpr, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1080, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_7fit_bpr, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1092, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_bpr, __pyx_t_1) < 0) __PYX_ERR(0, 1080, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_fit_bpr, __pyx_t_1) < 0) __PYX_ERR(0, 1092, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":1191 + /* "lightfm/_lightfm_fast_openmp.pyx":1203 * * * def predict_lightfm(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * int[::1] user_ids, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_9predict_lightfm, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1191, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_9predict_lightfm, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1203, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_predict_lightfm, __pyx_t_1) < 0) __PYX_ERR(0, 1191, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_predict_lightfm, __pyx_t_1) < 0) __PYX_ERR(0, 1203, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":1238 + /* "lightfm/_lightfm_fast_openmp.pyx":1250 * * * def predict_ranks(CSRMatrix item_features, # <<<<<<<<<<<<<< * CSRMatrix user_features, * CSRMatrix test_interactions, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_11predict_ranks, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1238, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_11predict_ranks, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1250, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_predict_ranks, __pyx_t_1) < 0) __PYX_ERR(0, 1238, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_predict_ranks, __pyx_t_1) < 0) __PYX_ERR(0, 1250, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":1332 + /* "lightfm/_lightfm_fast_openmp.pyx":1344 * * * def calculate_auc_from_rank(CSRMatrix ranks, # <<<<<<<<<<<<<< * int[::1] num_train_positives, * flt[::1] rank_data, */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_13calculate_auc_from_rank, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1332, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_13calculate_auc_from_rank, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1344, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculate_auc_from_rank, __pyx_t_1) < 0) __PYX_ERR(0, 1332, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_calculate_auc_from_rank, __pyx_t_1) < 0) __PYX_ERR(0, 1344, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "lightfm/_lightfm_fast_openmp.pyx":1386 + /* "lightfm/_lightfm_fast_openmp.pyx":1398 * * # Expose test functions * def __test_in_positives(int row, int col, CSRMatrix mat): # <<<<<<<<<<<<<< * * if in_positives(col, row, mat): */ - __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_15__test_in_positives, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1386, __pyx_L1_error) + __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_7lightfm_20_lightfm_fast_openmp_15__test_in_positives, NULL, __pyx_n_s_lightfm__lightfm_fast_openmp); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 1398, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_in_positives, __pyx_t_1) < 0) __PYX_ERR(0, 1386, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_test_in_positives, __pyx_t_1) < 0) __PYX_ERR(0, 1398, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "(tree fragment)":1 @@ -26960,7 +27414,7 @@ static int __Pyx_ParseOptionalKeywords( } name = first_kw_arg; #if PY_MAJOR_VERSION < 3 - if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + if (likely(PyString_Check(key))) { while (*name) { if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) && _PyString_Eq(**name, key)) { @@ -26987,7 +27441,7 @@ static int __Pyx_ParseOptionalKeywords( while (*name) { int cmp = (**name == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + (__Pyx_PyUnicode_GET_LENGTH(**name) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : #endif PyUnicode_Compare(**name, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; @@ -27003,7 +27457,7 @@ static int __Pyx_ParseOptionalKeywords( while (argname != first_kw_arg) { int cmp = (**argname == key) ? 0 : #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 - (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + (__Pyx_PyUnicode_GET_LENGTH(**argname) != __Pyx_PyUnicode_GET_LENGTH(key)) ? 1 : #endif PyUnicode_Compare(**argname, key); if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; @@ -27077,7 +27531,7 @@ __Pyx_init_memviewslice(struct __pyx_memoryview_obj *memview, int i, retval=-1; Py_buffer *buf = &memview->view; __Pyx_RefNannySetupContext("init_memviewslice", 0); - if (memviewslice->memview || memviewslice->data) { + if (unlikely(memviewslice->memview || memviewslice->data)) { PyErr_SetString(PyExc_ValueError, "memviewslice is already initialized!"); goto fail; @@ -27156,13 +27610,13 @@ __Pyx_INC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) { int first_time; struct __pyx_memoryview_obj *memview = memslice->memview; - if (!memview || (PyObject *) memview == Py_None) + if (unlikely(!memview || (PyObject *) memview == Py_None)) return; - if (__pyx_get_slice_count(memview) < 0) + if (unlikely(__pyx_get_slice_count(memview) < 0)) __pyx_fatalerror("Acquisition count is %d (line %d)", __pyx_get_slice_count(memview), lineno); first_time = __pyx_add_acquisition_count(memview) == 0; - if (first_time) { + if (unlikely(first_time)) { if (have_gil) { Py_INCREF((PyObject *) memview); } else { @@ -27176,18 +27630,16 @@ static CYTHON_INLINE void __Pyx_XDEC_MEMVIEW(__Pyx_memviewslice *memslice, int have_gil, int lineno) { int last_time; struct __pyx_memoryview_obj *memview = memslice->memview; - if (!memview ) { - return; - } else if ((PyObject *) memview == Py_None) { + if (unlikely(!memview || (PyObject *) memview == Py_None)) { memslice->memview = NULL; return; } - if (__pyx_get_slice_count(memview) <= 0) + if (unlikely(__pyx_get_slice_count(memview) <= 0)) __pyx_fatalerror("Acquisition count is %d (line %d)", __pyx_get_slice_count(memview), lineno); last_time = __pyx_sub_acquisition_count(memview) == 1; memslice->data = NULL; - if (last_time) { + if (unlikely(last_time)) { if (have_gil) { Py_CLEAR(memslice->memview); } else { @@ -27565,7 +28017,7 @@ static PyObject *__Pyx_PyFunction_FastCallDict(PyObject *func, PyObject **args, #if CYTHON_COMPILING_IN_CPYTHON static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw) { PyObject *result; - ternaryfunc call = func->ob_type->tp_call; + ternaryfunc call = Py_TYPE(func)->tp_call; if (unlikely(!call)) return PyObject_Call(func, arg, kw); if (unlikely(Py_EnterRecursiveCall((char*)" while calling a Python object"))) @@ -27652,7 +28104,7 @@ static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObjec if (likely(PyCFunction_GET_FLAGS(func) & METH_O)) { return __Pyx_PyObject_CallMethO(func, arg); #if CYTHON_FAST_PYCCALL - } else if (PyCFunction_GET_FLAGS(func) & METH_FASTCALL) { + } else if (__Pyx_PyFastCFunction_Check(func)) { return __Pyx_PyCFunction_FastCall(func, &arg, 1); #endif } @@ -27700,7 +28152,7 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { { #if PY_MAJOR_VERSION >= 3 if (level == -1) { - if (strchr(__Pyx_MODULE_NAME, '.')) { + if ((1) && (strchr(__Pyx_MODULE_NAME, '.'))) { module = PyImport_ImportModuleLevelObject( name, global_dict, empty_dict, list, 1); if (!module) { @@ -28213,9 +28665,9 @@ static CYTHON_INLINE PyObject* __Pyx_decode_c_string( if (stop < 0) stop += length; } + if (unlikely(stop <= start)) + return __Pyx_NewRef(__pyx_empty_unicode); length = stop - start; - if (unlikely(length <= 0)) - return PyUnicode_FromUnicode(NULL, 0); cstring += start; if (decode_func) { return decode_func(cstring, length, errors); @@ -28704,6 +29156,28 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { return -1; } +/* PyObjectGetAttrStrNoError */ +static void __Pyx_PyObject_GetAttrStr_ClearAttributeError(void) { + __Pyx_PyThreadState_declare + __Pyx_PyThreadState_assign + if (likely(__Pyx_PyErr_ExceptionMatches(PyExc_AttributeError))) + __Pyx_PyErr_Clear(); +} +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStrNoError(PyObject* obj, PyObject* attr_name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON && CYTHON_USE_TYPE_SLOTS && PY_VERSION_HEX >= 0x030700B1 + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro == PyObject_GenericGetAttr)) { + return _PyObject_GenericGetAttrWithDict(obj, attr_name, NULL, 1); + } +#endif + result = __Pyx_PyObject_GetAttrStr(obj, attr_name); + if (unlikely(!result)) { + __Pyx_PyObject_GetAttrStr_ClearAttributeError(); + } + return result; +} + /* SetupReduce */ static int __Pyx_setup_reduce_is_named(PyObject* meth, PyObject* name) { int ret; @@ -28731,43 +29205,51 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { PyObject *setstate = NULL; PyObject *setstate_cython = NULL; #if CYTHON_USE_PYTYPE_LOOKUP - if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto GOOD; + if (_PyType_Lookup((PyTypeObject*)type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; #else - if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto GOOD; + if (PyObject_HasAttr(type_obj, __pyx_n_s_getstate)) goto __PYX_GOOD; #endif #if CYTHON_USE_PYTYPE_LOOKUP - object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD; + object_reduce_ex = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #else - object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto BAD; + object_reduce_ex = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce_ex); if (!object_reduce_ex) goto __PYX_BAD; #endif - reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto BAD; + reduce_ex = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_ex); if (unlikely(!reduce_ex)) goto __PYX_BAD; if (reduce_ex == object_reduce_ex) { #if CYTHON_USE_PYTYPE_LOOKUP - object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD; + object_reduce = _PyType_Lookup(&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; #else - object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto BAD; + object_reduce = __Pyx_PyObject_GetAttrStr((PyObject*)&PyBaseObject_Type, __pyx_n_s_reduce); if (!object_reduce) goto __PYX_BAD; #endif - reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto BAD; + reduce = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce); if (unlikely(!reduce)) goto __PYX_BAD; if (reduce == object_reduce || __Pyx_setup_reduce_is_named(reduce, __pyx_n_s_reduce_cython)) { - reduce_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_reduce_cython); if (unlikely(!reduce_cython)) goto BAD; - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto BAD; + reduce_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_reduce_cython); + if (likely(reduce_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce, reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_reduce_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (reduce == object_reduce || PyErr_Occurred()) { + goto __PYX_BAD; + } setstate = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate); if (!setstate) PyErr_Clear(); if (!setstate || __Pyx_setup_reduce_is_named(setstate, __pyx_n_s_setstate_cython)) { - setstate_cython = __Pyx_PyObject_GetAttrStr(type_obj, __pyx_n_s_setstate_cython); if (unlikely(!setstate_cython)) goto BAD; - ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto BAD; - ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto BAD; + setstate_cython = __Pyx_PyObject_GetAttrStrNoError(type_obj, __pyx_n_s_setstate_cython); + if (likely(setstate_cython)) { + ret = PyDict_SetItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate, setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + ret = PyDict_DelItem(((PyTypeObject*)type_obj)->tp_dict, __pyx_n_s_setstate_cython); if (unlikely(ret < 0)) goto __PYX_BAD; + } else if (!setstate || PyErr_Occurred()) { + goto __PYX_BAD; + } } PyType_Modified((PyTypeObject*)type_obj); } } - goto GOOD; -BAD: + goto __PYX_GOOD; +__PYX_BAD: if (!PyErr_Occurred()) PyErr_Format(PyExc_RuntimeError, "Unable to initialize pickling for %s", ((PyTypeObject*)type_obj)->tp_name); ret = -1; -GOOD: +__PYX_GOOD: #if !CYTHON_USE_PYTYPE_LOOKUP Py_XDECREF(object_reduce); Py_XDECREF(object_reduce_ex); @@ -28782,7 +29264,7 @@ static int __Pyx_setup_reduce(PyObject* type_obj) { /* CLineInTraceback */ #ifndef CYTHON_CLINE_IN_TRACEBACK -static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { +static int __Pyx_CLineForTraceback(CYTHON_NCP_UNUSED PyThreadState *tstate, int c_line) { PyObject *use_cline; PyObject *ptype, *pvalue, *ptraceback; #if CYTHON_COMPILING_IN_CPYTHON @@ -28812,7 +29294,7 @@ static int __Pyx_CLineForTraceback(PyThreadState *tstate, int c_line) { } if (!use_cline) { c_line = 0; - PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); + (void) PyObject_SetAttr(__pyx_cython_runtime, __pyx_n_s_cline_in_traceback, Py_False); } else if (use_cline == Py_False || (use_cline != Py_True && PyObject_Not(use_cline) != 0)) { c_line = 0; @@ -28886,7 +29368,7 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { if (__pyx_code_cache.count == __pyx_code_cache.max_count) { int new_max = __pyx_code_cache.max_count + 64; entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( - __pyx_code_cache.entries, (size_t)new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + __pyx_code_cache.entries, ((size_t)new_max) * sizeof(__Pyx_CodeObjectCacheEntry)); if (unlikely(!entries)) { return; } @@ -28909,30 +29391,31 @@ static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( const char *funcname, int c_line, int py_line, const char *filename) { - PyCodeObject *py_code = 0; - PyObject *py_srcfile = 0; - PyObject *py_funcname = 0; + PyCodeObject *py_code = NULL; + PyObject *py_funcname = NULL; #if PY_MAJOR_VERSION < 3 + PyObject *py_srcfile = NULL; py_srcfile = PyString_FromString(filename); - #else - py_srcfile = PyUnicode_FromString(filename); - #endif if (!py_srcfile) goto bad; + #endif if (c_line) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + if (!py_funcname) goto bad; + funcname = PyUnicode_AsUTF8(py_funcname); + if (!funcname) goto bad; #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); - #else - py_funcname = PyUnicode_FromString(funcname); + if (!py_funcname) goto bad; #endif } - if (!py_funcname) goto bad; + #if PY_MAJOR_VERSION < 3 py_code = __Pyx_PyCode_New( 0, 0, @@ -28951,11 +29434,16 @@ static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( __pyx_empty_bytes /*PyObject *lnotab*/ ); Py_DECREF(py_srcfile); - Py_DECREF(py_funcname); + #else + py_code = PyCode_NewEmpty(filename, funcname, py_line); + #endif + Py_XDECREF(py_funcname); // XDECREF since it's only set on Py3 if cline return py_code; bad: - Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); + #if PY_MAJOR_VERSION < 3 + Py_XDECREF(py_srcfile); + #endif return NULL; } static void __Pyx_AddTraceback(const char *funcname, int c_line, @@ -29080,37 +29568,6 @@ __pyx_capsule_create(void *p, CYTHON_UNUSED const char *sig) return cobj; } -/* CIntToPy */ -static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(int) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(int) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(int) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(int), - little, !is_unsigned); - } -} - /* CIntFromPyVerify */ #define __PYX_VERIFY_RETURN_INT(target_type, func_type, func_value)\ __PYX__VERIFY_RETURN_INT(target_type, func_type, func_value, 0) @@ -29483,9 +29940,7 @@ static PyObject * __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) { const char *ts = *tsp; - int i = 0, number; - int ndim = ctx->head->field->type->ndim; -; + int i = 0, number, ndim; ++ts; if (ctx->new_count != 1) { PyErr_SetString(PyExc_ValueError, @@ -29493,6 +29948,7 @@ __pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) return NULL; } if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ndim = ctx->head->field->type->ndim; while (*ts && *ts != ')') { switch (*ts) { case ' ': case '\f': case '\r': case '\n': case '\t': case '\v': continue; @@ -29622,8 +30078,8 @@ static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const cha case 'l': case 'L': case 'q': case 'Q': case 'f': case 'd': case 'g': case 'O': case 'p': - if (ctx->enc_type == *ts && got_Z == ctx->is_complex && - ctx->enc_packmode == ctx->new_packmode) { + if ((ctx->enc_type == *ts) && (got_Z == ctx->is_complex) && + (ctx->enc_packmode == ctx->new_packmode) && (!ctx->is_valid_array)) { ctx->enc_count += ctx->new_count; ctx->new_count = 1; got_Z = 0; @@ -29709,13 +30165,13 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) if (buf->strides) { if (spec & __Pyx_MEMVIEW_CONTIG) { if (spec & (__Pyx_MEMVIEW_PTR|__Pyx_MEMVIEW_FULL)) { - if (buf->strides[dim] != sizeof(void *)) { + if (unlikely(buf->strides[dim] != sizeof(void *))) { PyErr_Format(PyExc_ValueError, "Buffer is not indirectly contiguous " "in dimension %d.", dim); goto fail; } - } else if (buf->strides[dim] != buf->itemsize) { + } else if (unlikely(buf->strides[dim] != buf->itemsize)) { PyErr_SetString(PyExc_ValueError, "Buffer and memoryview are not contiguous " "in the same dimension."); @@ -29726,7 +30182,7 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) Py_ssize_t stride = buf->strides[dim]; if (stride < 0) stride = -stride; - if (stride < buf->itemsize) { + if (unlikely(stride < buf->itemsize)) { PyErr_SetString(PyExc_ValueError, "Buffer and memoryview are not contiguous " "in the same dimension."); @@ -29734,17 +30190,17 @@ __pyx_check_strides(Py_buffer *buf, int dim, int ndim, int spec) } } } else { - if (spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1) { + if (unlikely(spec & __Pyx_MEMVIEW_CONTIG && dim != ndim - 1)) { PyErr_Format(PyExc_ValueError, "C-contiguous buffer is not contiguous in " "dimension %d", dim); goto fail; - } else if (spec & (__Pyx_MEMVIEW_PTR)) { + } else if (unlikely(spec & (__Pyx_MEMVIEW_PTR))) { PyErr_Format(PyExc_ValueError, "C-contiguous buffer is not indirect in " "dimension %d", dim); goto fail; - } else if (buf->suboffsets) { + } else if (unlikely(buf->suboffsets)) { PyErr_SetString(PyExc_ValueError, "Buffer exposes suboffsets but no strides"); goto fail; @@ -29758,7 +30214,7 @@ static int __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec) { if (spec & __Pyx_MEMVIEW_DIRECT) { - if (buf->suboffsets && buf->suboffsets[dim] >= 0) { + if (unlikely(buf->suboffsets && buf->suboffsets[dim] >= 0)) { PyErr_Format(PyExc_ValueError, "Buffer not compatible with direct access " "in dimension %d.", dim); @@ -29766,7 +30222,7 @@ __pyx_check_suboffsets(Py_buffer *buf, int dim, CYTHON_UNUSED int ndim, int spec } } if (spec & __Pyx_MEMVIEW_PTR) { - if (!buf->suboffsets || (buf->suboffsets[dim] < 0)) { + if (unlikely(!buf->suboffsets || (buf->suboffsets[dim] < 0))) { PyErr_Format(PyExc_ValueError, "Buffer is not indirectly accessible " "in dimension %d.", dim); @@ -29784,9 +30240,7 @@ __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag) if (c_or_f_flag & __Pyx_IS_F_CONTIG) { Py_ssize_t stride = 1; for (i = 0; i < ndim; i++) { - if (stride * buf->itemsize != buf->strides[i] && - buf->shape[i] > 1) - { + if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) { PyErr_SetString(PyExc_ValueError, "Buffer not fortran contiguous."); goto fail; @@ -29796,8 +30250,7 @@ __pyx_verify_contig(Py_buffer *buf, int ndim, int c_or_f_flag) } else if (c_or_f_flag & __Pyx_IS_C_CONTIG) { Py_ssize_t stride = 1; for (i = ndim - 1; i >- 1; i--) { - if (stride * buf->itemsize != buf->strides[i] && - buf->shape[i] > 1) { + if (unlikely(stride * buf->itemsize != buf->strides[i] && buf->shape[i] > 1)) { PyErr_SetString(PyExc_ValueError, "Buffer not C contiguous."); goto fail; @@ -29838,7 +30291,7 @@ static int __Pyx_ValidateAndInit_memviewslice( goto fail; } buf = &memview->view; - if (buf->ndim != ndim) { + if (unlikely(buf->ndim != ndim)) { PyErr_Format(PyExc_ValueError, "Buffer has wrong number of dimensions (expected %d, got %d)", ndim, buf->ndim); @@ -29846,9 +30299,9 @@ static int __Pyx_ValidateAndInit_memviewslice( } if (new_memview) { __Pyx_BufFmt_Init(&ctx, stack, dtype); - if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + if (unlikely(!__Pyx_BufFmt_CheckString(&ctx, buf->format))) goto fail; } - if ((unsigned) buf->itemsize != dtype->size) { + if (unlikely((unsigned) buf->itemsize != dtype->size)) { PyErr_Format(PyExc_ValueError, "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "u byte%s) " "does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "u byte%s)", @@ -29859,15 +30312,17 @@ static int __Pyx_ValidateAndInit_memviewslice( (dtype->size > 1) ? "s" : ""); goto fail; } - for (i = 0; i < ndim; i++) { - spec = axes_specs[i]; - if (!__pyx_check_strides(buf, i, ndim, spec)) - goto fail; - if (!__pyx_check_suboffsets(buf, i, ndim, spec)) + if (buf->len > 0) { + for (i = 0; i < ndim; i++) { + spec = axes_specs[i]; + if (unlikely(!__pyx_check_strides(buf, i, ndim, spec))) + goto fail; + if (unlikely(!__pyx_check_suboffsets(buf, i, ndim, spec))) + goto fail; + } + if (unlikely(buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag))) goto fail; } - if (buf->strides && !__pyx_verify_contig(buf, ndim, c_or_f_flag)) - goto fail; if (unlikely(__Pyx_init_memviewslice(memview, ndim, memviewslice, new_memview != NULL) == -1)) { goto fail; @@ -29963,35 +30418,27 @@ static CYTHON_INLINE int __pyx_memview_set_int(const char *itemp, PyObject *obj) return result; } -/* CIntToPy */ - static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; - const int is_unsigned = neg_one > const_zero; - if (is_unsigned) { - if (sizeof(long) < sizeof(long)) { - return PyInt_FromLong((long) value); - } else if (sizeof(long) <= sizeof(unsigned long)) { - return PyLong_FromUnsignedLong((unsigned long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); -#endif - } - } else { - if (sizeof(long) <= sizeof(long)) { - return PyInt_FromLong((long) value); -#ifdef HAVE_LONG_LONG - } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { - return PyLong_FromLongLong((PY_LONG_LONG) value); -#endif - } - } - { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&value; - return _PyLong_FromByteArray(bytes, sizeof(long), - little, !is_unsigned); +/* ObjectToMemviewSlice */ + static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(PyObject *obj, int writable_flag) { + __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; + __Pyx_BufFmt_StackElem stack[1]; + int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; + int retcode; + if (obj == Py_None) { + result.memview = (struct __pyx_memoryview_obj *) Py_None; + return result; } + retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG, + (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1, + &__Pyx_TypeInfo_unsigned_int, stack, + &result, obj); + if (unlikely(retcode == -1)) + goto __pyx_fail; + return result; +__pyx_fail: + result.memview = NULL; + result.data = NULL; + return result; } /* MemviewSliceCopyTemplate */ @@ -30012,7 +30459,7 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, struct __pyx_memoryview_obj *memview_obj = NULL; __Pyx_RefNannySetupContext("__pyx_memoryview_copy_new_contig", 0); for (i = 0; i < ndim; i++) { - if (from_mvs->suboffsets[i] >= 0) { + if (unlikely(from_mvs->suboffsets[i] >= 0)) { PyErr_Format(PyExc_ValueError, "Cannot copy memoryview slice with " "indirect dimensions (axis %d)", i); goto fail; @@ -30061,9 +30508,54 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return new_mvs; } +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_int(int value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(int) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(int) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(int) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(int) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(int), + little, !is_unsigned); + } +} + /* CIntFromPy */ static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *x) { - const int neg_one = (int) ((int) 0 - (int) 1), const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const int neg_one = (int) -1, const_zero = (int) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -30252,7 +30744,14 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, /* CIntFromPy */ static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *x) { - const long neg_one = (long) ((long) 0 - (long) 1), const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -30439,9 +30938,54 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return (long) -1; } +/* CIntToPy */ + static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value) { +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const long neg_one = (long) -1, const_zero = (long) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif + const int is_unsigned = neg_one > const_zero; + if (is_unsigned) { + if (sizeof(long) < sizeof(long)) { + return PyInt_FromLong((long) value); + } else if (sizeof(long) <= sizeof(unsigned long)) { + return PyLong_FromUnsignedLong((unsigned long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(unsigned PY_LONG_LONG)) { + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG) value); +#endif + } + } else { + if (sizeof(long) <= sizeof(long)) { + return PyInt_FromLong((long) value); +#ifdef HAVE_LONG_LONG + } else if (sizeof(long) <= sizeof(PY_LONG_LONG)) { + return PyLong_FromLongLong((PY_LONG_LONG) value); +#endif + } + } + { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&value; + return _PyLong_FromByteArray(bytes, sizeof(long), + little, !is_unsigned); + } +} + /* CIntFromPy */ static CYTHON_INLINE char __Pyx_PyInt_As_char(PyObject *x) { - const char neg_one = (char) ((char) 0 - (char) 1), const_zero = (char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wconversion" +#endif + const char neg_one = (char) -1, const_zero = (char) 0; +#ifdef __Pyx_HAS_GCC_DIAGNOSTIC +#pragma GCC diagnostic pop +#endif const int is_unsigned = neg_one > const_zero; #if PY_MAJOR_VERSION < 3 if (likely(PyInt_Check(x))) { @@ -30628,29 +31172,6 @@ __pyx_memoryview_copy_new_contig(const __Pyx_memviewslice *from_mvs, return (char) -1; } -/* ObjectToMemviewSlice */ - static CYTHON_INLINE __Pyx_memviewslice __Pyx_PyObject_to_MemoryviewSlice_dc_unsigned_int(PyObject *obj, int writable_flag) { - __Pyx_memviewslice result = { 0, 0, { 0 }, { 0 }, { 0 } }; - __Pyx_BufFmt_StackElem stack[1]; - int axes_specs[] = { (__Pyx_MEMVIEW_DIRECT | __Pyx_MEMVIEW_CONTIG) }; - int retcode; - if (obj == Py_None) { - result.memview = (struct __pyx_memoryview_obj *) Py_None; - return result; - } - retcode = __Pyx_ValidateAndInit_memviewslice(axes_specs, __Pyx_IS_C_CONTIG, - (PyBUF_C_CONTIGUOUS | PyBUF_FORMAT) | writable_flag, 1, - &__Pyx_TypeInfo_unsigned_int, stack, - &result, obj); - if (unlikely(retcode == -1)) - goto __pyx_fail; - return result; -__pyx_fail: - result.memview = NULL; - result.data = NULL; - return result; -} - /* CheckBinaryVersion */ static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; @@ -30915,6 +31436,23 @@ static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_DECREF(x); return ival; } +static CYTHON_INLINE Py_hash_t __Pyx_PyIndex_AsHash_t(PyObject* o) { + if (sizeof(Py_hash_t) == sizeof(Py_ssize_t)) { + return (Py_hash_t) __Pyx_PyIndex_AsSsize_t(o); +#if PY_MAJOR_VERSION < 3 + } else if (likely(PyInt_CheckExact(o))) { + return PyInt_AS_LONG(o); +#endif + } else { + Py_ssize_t ival; + PyObject *x; + x = PyNumber_Index(o); + if (!x) return -1; + ival = PyInt_AsLong(x); + Py_DECREF(x); + return ival; + } +} static CYTHON_INLINE PyObject * __Pyx_PyBool_FromLong(long b) { return b ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False); } diff --git a/lightfm/lightfm.py b/lightfm/lightfm.py index b82cba56..4ecb3cab 100644 --- a/lightfm/lightfm.py +++ b/lightfm/lightfm.py @@ -119,6 +119,9 @@ class LightFM(object): Contains the biases for item_features. user_biases: np.float32 array of shape [n_user_features,] Contains the biases for user_features. + avg_loss: list + Contains the average loss values such that the i-th element is the + average of the loss values from the i-th epoch of model-fitting. Notes ----- @@ -256,6 +259,8 @@ def _reset_state(self): self.user_bias_gradients = None self.user_bias_momentum = None + self.avg_loss = None + def _check_initialized(self): for var in ( @@ -271,6 +276,7 @@ def _check_initialized(self): self.user_biases, self.user_bias_gradients, self.user_bias_momentum, + self.avg_loss, ): if var is None: @@ -311,6 +317,8 @@ def _initialize(self, no_components, no_item_features, no_user_features): self.user_embedding_gradients += 1 self.user_bias_gradients += 1 + self.avg_loss = [] + def _construct_feature_matrices( self, n_users, n_items, user_features, item_features ): @@ -758,6 +766,8 @@ def _run_epoch( num_threads, ) + self.avg_loss.append(lightfm_data.avg_loss) + def predict( self, user_ids, item_ids, item_features=None, user_features=None, num_threads=1 ):