近似因子模型Cython编译代码

这是一篇关于使用Cython将Python的近似因子模型代码编译为C代码的文章。原始Python源码有867行,现已转化为C代码并公开供试验调用。文章邀请熟悉C语言和机器学习的专家进行解析和研究。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

/* Generated by Cython 0.24.1 */

/* BEGIN: Cython Metadata
{
    "distutils": {}, 
    "module_name": "redis.Learning"
}
END: Cython Metadata */

#define 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 < 0x03020000)
    #error Cython requires Python 2.6+ or Python 3.2+.
#else
#define CYTHON_ABI "0_24_1"
#include <stddef.h>
#ifndef offsetof
  #define offsetof(type, member) ( (size_t) & ((type*)0) -> member )
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
  #ifndef __fastcall
    #define __fastcall
  #endif
#endif
#ifndef DL_IMPORT
  #define DL_IMPORT(t) t
#endif
#ifndef DL_EXPORT
  #define DL_EXPORT(t) t
#endif
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#ifndef Py_HUGE_VAL
  #define Py_HUGE_VAL HUGE_VAL
#endif
#ifdef PYPY_VERSION
  #define CYTHON_COMPILING_IN_PYPY 1
  #define CYTHON_COMPILING_IN_CPYTHON 0
#else
  #define CYTHON_COMPILING_IN_PYPY 0
  #define CYTHON_COMPILING_IN_CPYTHON 1
#endif
#if !defined(CYTHON_USE_PYLONG_INTERNALS) && CYTHON_COMPILING_IN_CPYTHON && PY_VERSION_HEX >= 0x02070000
  #define CYTHON_USE_PYLONG_INTERNALS 1
#endif
#if CYTHON_USE_PYLONG_INTERNALS
  #include "longintrepr.h"
  #undef SHIFT
  #undef BASE
  #undef MASK
#endif
#if CYTHON_COMPILING_IN_PYPY && PY_VERSION_HEX < 0x02070600 && !defined(Py_OptimizeFlag)
  #define Py_OptimizeFlag 0
#endif
#define __PYX_BUILD_PY_SSIZE_T "n"
#define CYTHON_FORMAT_SSIZE_T "z"
#if PY_MAJOR_VERSION < 3
  #define __Pyx_BUILTIN_MODULE_NAME "__builtin__"
  #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)
  #define __Pyx_DefaultClassType PyClass_Type
#else
  #define __Pyx_BUILTIN_MODULE_NAME "builtins"
  #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)
  #define __Pyx_DefaultClassType PyType_Type
#endif
#ifndef Py_TPFLAGS_CHECKTYPES
  #define Py_TPFLAGS_CHECKTYPES 0
#endif
#ifndef Py_TPFLAGS_HAVE_INDEX
  #define Py_TPFLAGS_HAVE_INDEX 0
#endif
#ifndef Py_TPFLAGS_HAVE_NEWBUFFER
  #define Py_TPFLAGS_HAVE_NEWBUFFER 0
#endif
#ifndef Py_TPFLAGS_HAVE_FINALIZE
  #define Py_TPFLAGS_HAVE_FINALIZE 0
#endif
#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND)
  #define CYTHON_PEP393_ENABLED 1
  #define __Pyx_PyUnicode_READY(op)       (likely(PyUnicode_IS_READY(op)) ?\
                                              0 : _PyUnicode_Ready((PyObject *)(op)))
  #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_KIND(u)         PyUnicode_KIND(u)
  #define __Pyx_PyUnicode_DATA(u)         PyUnicode_DATA(u)
  #define __Pyx_PyUnicode_READ(k, d, i)   PyUnicode_READ(k, d, i)
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != (likely(PyUnicode_IS_READY(u)) ? PyUnicode_GET_LENGTH(u) : PyUnicode_GET_SIZE(u)))
#else
  #define CYTHON_PEP393_ENABLED 0
  #define __Pyx_PyUnicode_READY(op)       (0)
  #define __Pyx_PyUnicode_GET_LENGTH(u)   PyUnicode_GET_SIZE(u)
  #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i]))
  #define __Pyx_PyUnicode_KIND(u)         (sizeof(Py_UNICODE))
  #define __Pyx_PyUnicode_DATA(u)         ((void*)PyUnicode_AS_UNICODE(u))
  #define __Pyx_PyUnicode_READ(k, d, i)   ((void)(k), (Py_UCS4)(((Py_UNICODE*)d)[i]))
  #define __Pyx_PyUnicode_IS_TRUE(u)      (0 != PyUnicode_GET_SIZE(u))
#endif
#if CYTHON_COMPILING_IN_PYPY
  #define __Pyx_PyUnicode_Concat(a, b)      PyNumber_Add(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  PyNumber_Add(a, b)
#else
  #define __Pyx_PyUnicode_Concat(a, b)      PyUnicode_Concat(a, b)
  #define __Pyx_PyUnicode_ConcatSafe(a, b)  ((unlikely((a) == Py_None) || unlikely((b) == Py_None)) ?\
      PyNumber_Add(a, b) : __Pyx_PyUnicode_Concat(a, b))
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyUnicode_Contains)
  #define PyUnicode_Contains(u, s)  PySequence_Contains(u, s)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyByteArray_Check)
  #define PyByteArray_Check(obj)  PyObject_TypeCheck(obj, &PyByteArray_Type)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Format)
  #define PyObject_Format(obj, fmt)  PyObject_CallMethod(obj, "__format__", "O", fmt)
#endif
#if CYTHON_COMPILING_IN_PYPY && !defined(PyObject_Malloc)
  #define PyObject_Malloc(s)   PyMem_Malloc(s)
  #define PyObject_Free(p)     PyMem_Free(p)
  #define PyObject_Realloc(p)  PyMem_Realloc(p)
#endif
#define __Pyx_PyString_FormatSafe(a, b)   ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : __Pyx_PyString_Format(a, b))
#define __Pyx_PyUnicode_FormatSafe(a, b)  ((unlikely((a) == Py_None)) ? PyNumber_Remainder(a, b) : PyUnicode_Format(a, b))
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyString_Format(a, b)  PyUnicode_Format(a, b)
#else
  #define __Pyx_PyString_Format(a, b)  PyString_Format(a, b)
#endif
#if PY_MAJOR_VERSION < 3 && !defined(PyObject_ASCII)
  #define PyObject_ASCII(o)            PyObject_Repr(o)
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBaseString_Type            PyUnicode_Type
  #define PyStringObject               PyUnicodeObject
  #define PyString_Type                PyUnicode_Type
  #define PyString_Check               PyUnicode_Check
  #define PyString_CheckExact          PyUnicode_CheckExact
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj)
  #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj)
#else
  #define __Pyx_PyBaseString_Check(obj) (PyString_Check(obj) || PyUnicode_Check(obj))
  #define __Pyx_PyBaseString_CheckExact(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj))
#endif
#ifndef PySet_CheckExact
  #define PySet_CheckExact(obj)        (Py_TYPE(obj) == &PySet_Type)
#endif
#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type)
#if PY_MAJOR_VERSION >= 3
  #define PyIntObject                  PyLongObject
  #define PyInt_Type                   PyLong_Type
  #define PyInt_Check(op)              PyLong_Check(op)
  #define PyInt_CheckExact(op)         PyLong_CheckExact(op)
  #define PyInt_FromString             PyLong_FromString
  #define PyInt_FromUnicode            PyLong_FromUnicode
  #define PyInt_FromLong               PyLong_FromLong
  #define PyInt_FromSize_t             PyLong_FromSize_t
  #define PyInt_FromSsize_t            PyLong_FromSsize_t
  #define PyInt_AsLong                 PyLong_AsLong
  #define PyInt_AS_LONG                PyLong_AS_LONG
  #define PyInt_AsSsize_t              PyLong_AsSsize_t
  #define PyInt_AsUnsignedLongMask     PyLong_AsUnsignedLongMask
  #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask
  #define PyNumber_Int                 PyNumber_Long
#endif
#if PY_MAJOR_VERSION >= 3
  #define PyBoolObject                 PyLongObject
#endif
#if PY_MAJOR_VERSION >= 3 && CYTHON_COMPILING_IN_PYPY
  #ifndef PyUnicode_InternFromString
    #define PyUnicode_InternFromString(s) PyUnicode_FromString(s)
  #endif
#endif
#if PY_VERSION_HEX < 0x030200A4
  typedef long Py_hash_t;
  #define __Pyx_PyInt_FromHash_t PyInt_FromLong
  #define __Pyx_PyInt_AsHash_t   PyInt_AsLong
#else
  #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t
  #define __Pyx_PyInt_AsHash_t   PyInt_AsSsize_t
#endif
#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func))
#else
  #define __Pyx_PyMethod_New(func, self, klass) PyMethod_New(func, self, klass)
#endif
#if PY_VERSION_HEX >= 0x030500B1
#define __Pyx_PyAsyncMethodsStruct PyAsyncMethods
#define __Pyx_PyType_AsAsync(obj) (Py_TYPE(obj)->tp_as_async)
#elif CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3
typedef struct {
    unaryfunc am_await;
    unaryfunc am_aiter;
    unaryfunc am_anext;
} __Pyx_PyAsyncMethodsStruct;
#define __Pyx_PyType_AsAsync(obj) ((__Pyx_PyAsyncMethodsStruct*) (Py_TYPE(obj)->tp_reserved))
#else
#define __Pyx_PyType_AsAsync(obj) NULL
#endif
#ifndef CYTHON_RESTRICT
  #if defined(__GNUC__)
    #define CYTHON_RESTRICT __restrict__
  #elif defined(_MSC_VER) && _MSC_VER >= 1400
    #define CYTHON_RESTRICT __restrict
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_RESTRICT restrict
  #else
    #define CYTHON_RESTRICT
  #endif
#endif
#define __Pyx_void_to_None(void_result) ((void)(void_result), Py_INCREF(Py_None), Py_None)

#ifndef CYTHON_INLINE
  #if defined(__GNUC__)
    #define CYTHON_INLINE __inline__
  #elif defined(_MSC_VER)
    #define CYTHON_INLINE __inline
  #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define CYTHON_INLINE inline
  #else
    #define CYTHON_INLINE
  #endif
#endif

#if defined(WIN32) || defined(MS_WINDOWS)
  #define _USE_MATH_DEFINES
#endif
#include <math.h>
#ifdef NAN
#define __PYX_NAN() ((float) NAN)
#else
static CYTHON_INLINE float __PYX_NAN() {
  float value;
  memset(&value, 0xFF, sizeof(value));
  return value;
}
#endif
#if defined(__CYGWIN__) && defined(_LDBL_EQ_DBL)
#define __Pyx_truncl trunc
#else
#define __Pyx_truncl truncl
#endif


#define __PYX_ERR(f_index, lineno, Ln_error) \
{ \
  __pyx_filename = __pyx_f[f_index]; __pyx_lineno = lineno; __pyx_clineno = __LINE__; goto Ln_error; \
}

#if PY_MAJOR_VERSION >= 3
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#else
  #define __Pyx_PyNumber_Divide(x,y)         PyNumber_TrueDivide(x,y)
  #define __Pyx_PyNumber_InPlaceDivide(x,y)  PyNumber_InPlaceTrueDivide(x,y)
#endif

#ifndef __PYX_EXTERN_C
  #ifdef __cplusplus
    #define __PYX_EXTERN_C extern "C"
  #else
    #define __PYX_EXTERN_C extern
  #endif
#endif

#define __PYX_HAVE__redis__Learning
#define __PYX_HAVE_API__redis__Learning
#ifdef _OPENMP
#include <omp.h>
#endif /* _OPENMP */

#ifdef PYREX_WITHOUT_ASSERTIONS
#define CYTHON_WITHOUT_ASSERTIONS
#endif

#ifndef CYTHON_UNUSED
# if defined(__GNUC__)
#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
#     define CYTHON_UNUSED __attribute__ ((__unused__))
#   else
#     define CYTHON_UNUSED
#   endif
# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER))
#   define CYTHON_UNUSED __attribute__ ((__unused__))
# else
#   define CYTHON_UNUSED
# endif
#endif
#ifndef CYTHON_NCP_UNUSED
# if CYTHON_COMPILING_IN_CPYTHON
#  define CYTHON_NCP_UNUSED
# else
#  define CYTHON_NCP_UNUSED CYTHON_UNUSED
# endif
#endif
typedef struct {PyObject **p; const char *s; const Py_ssize_t n; const char* encoding;
                const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry;

#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0
#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0
#define __PYX_DEFAULT_STRING_ENCODING ""
#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString
#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#define __Pyx_uchar_cast(c) ((unsigned char)c)
#define __Pyx_long_cast(x) ((long)x)
#define __Pyx_fits_Py_ssize_t(v, type, is_signed)  (\
    (sizeof(type) < sizeof(Py_ssize_t))  ||\
    (sizeof(type) > sizeof(Py_ssize_t) &&\
          likely(v < (type)PY_SSIZE_T_MAX ||\
                 v == (type)PY_SSIZE_T_MAX)  &&\
          (!is_signed || likely(v > (type)PY_SSIZE_T_MIN ||\
                                v == (type)PY_SSIZE_T_MIN)))  ||\
    (sizeof(type) == sizeof(Py_ssize_t) &&\
          (is_signed || likely(v < (type)PY_SSIZE_T_MAX ||\
                               v == (type)PY_SSIZE_T_MAX)))  )
#if defined (__cplusplus) && __cplusplus >= 201103L
    #include <cstdlib>
    #define __Pyx_sst_abs(value) std::abs(value)
#elif SIZEOF_INT >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) abs(value)
#elif SIZEOF_LONG >= SIZEOF_SIZE_T
    #define __Pyx_sst_abs(value) labs(value)
#elif defined (_MSC_VER) && defined (_M_X64)
    #define __Pyx_sst_abs(value) _abs64(value)
#elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
    #define __Pyx_sst_abs(value) llabs(value)
#elif defined (__GNUC__)
    #define __Pyx_sst_abs(value) __builtin_llabs(value)
#else
    #define __Pyx_sst_abs(value) ((value<0) ? -value : value)
#endif
static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*);
static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length);
#define __Pyx_PyByteArray_FromString(s) PyByteArray_FromStringAndSize((const char*)s, strlen((const char*)s))
#define __Pyx_PyByteArray_FromStringAndSize(s, l) PyByteArray_FromStringAndSize((const char*)s, l)
#define __Pyx_PyBytes_FromString        PyBytes_FromString
#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize
static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(const char*);
#if PY_MAJOR_VERSION < 3
    #define __Pyx_PyStr_FromString        __Pyx_PyBytes_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize
#else
    #define __Pyx_PyStr_FromString        __Pyx_PyUnicode_FromString
    #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize
#endif
#define __Pyx_PyObject_AsSString(s)    ((signed char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_AsUString(s)    ((unsigned char*) __Pyx_PyObject_AsString(s))
#define __Pyx_PyObject_FromCString(s)  __Pyx_PyObject_FromString((const char*)s)
#define __Pyx_PyBytes_FromCString(s)   __Pyx_PyBytes_FromString((const char*)s)
#define __Pyx_PyByteArray_FromCString(s)   __Pyx_PyByteArray_FromString((const char*)s)
#define __Pyx_PyStr_FromCString(s)     __Pyx_PyStr_FromString((const char*)s)
#define __Pyx_PyUnicode_FromCString(s) __Pyx_PyUnicode_FromString((const char*)s)
#if PY_MAJOR_VERSION < 3
static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u)
{
    const Py_UNICODE *u_end = u;
    while (*u_end++) ;
    return (size_t)(u_end - u - 1);
}
#else
#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen
#endif
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode
#define __Pyx_PyUnicode_AsUnicode            PyUnicode_AsUnicode
#define __Pyx_NewRef(obj) (Py_INCREF(obj), obj)
#define __Pyx_Owned_Py_None(b) __Pyx_NewRef(Py_None)
#define __Pyx_PyBool_FromLong(b) ((b) ? __Pyx_NewRef(Py_True) : __Pyx_NewRef(Py_False))
static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*);
static CYTHON_INLINE PyObject* __Pyx_PyNumber_IntOrLong(PyObject* x);
static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*);
static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t);
#if CYTHON_COMPILING_IN_CPYTHON
#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x))
#else
#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x)
#endif
#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x))
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyNumber_Int(x) (PyLong_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Long(x))
#else
#define __Pyx_PyNumber_Int(x) (PyInt_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Int(x))
#endif
#define __Pyx_PyNumber_Float(x) (PyFloat_CheckExact(x) ? __Pyx_NewRef(x) : PyNumber_Float(x))
#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII
static int __Pyx_sys_getdefaultencoding_not_ascii;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    PyObject* ascii_chars_u = NULL;
    PyObject* ascii_chars_b = NULL;
    const char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    if (strcmp(default_encoding_c, "ascii") == 0) {
        __Pyx_sys_getdefaultencoding_not_ascii = 0;
    } else {
        char ascii_chars[128];
        int c;
        for (c = 0; c < 128; c++) {
            ascii_chars[c] = c;
        }
        __Pyx_sys_getdefaultencoding_not_ascii = 1;
        ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL);
        if (!ascii_chars_u) goto bad;
        ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL);
        if (!ascii_chars_b || !PyBytes_Check(ascii_chars_b) || memcmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) {
            PyErr_Format(
                PyExc_ValueError,
                "This module compiled with c_string_encoding=ascii, but default encoding '%.200s' is not a superset of ascii.",
                default_encoding_c);
            goto bad;
        }
        Py_DECREF(ascii_chars_u);
        Py_DECREF(ascii_chars_b);
    }
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    Py_XDECREF(ascii_chars_u);
    Py_XDECREF(ascii_chars_b);
    return -1;
}
#endif
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL)
#else
#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL)
#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT
static char* __PYX_DEFAULT_STRING_ENCODING;
static int __Pyx_init_sys_getdefaultencoding_params(void) {
    PyObject* sys;
    PyObject* default_encoding = NULL;
    char* default_encoding_c;
    sys = PyImport_ImportModule("sys");
    if (!sys) goto bad;
    default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL);
    Py_DECREF(sys);
    if (!default_encoding) goto bad;
    default_encoding_c = PyBytes_AsString(default_encoding);
    if (!default_encoding_c) goto bad;
    __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c));
    if (!__PYX_DEFAULT_STRING_ENCODING) goto bad;
    strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c);
    Py_DECREF(default_encoding);
    return 0;
bad:
    Py_XDECREF(default_encoding);
    return -1;
}
#endif
#endif


/* Test for GCC > 2.95 */
#if defined(__GNUC__)     && (__GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)))
  #define likely(x)   __builtin_expect(!!(x), 1)
  #define unlikely(x) __builtin_expect(!!(x), 0)
#else /* !__GNUC__ or GCC < 2.95 */
  #define likely(x)   (x)
  #define unlikely(x) (x)
#endif /* __GNUC__ */

static PyObject *__pyx_m;
static PyObject *__pyx_d;
static PyObject *__pyx_b;
static PyObject *__pyx_empty_tuple;
static PyObject *__pyx_empty_bytes;
static PyObject *__pyx_empty_unicode;
static int __pyx_lineno;
static int __pyx_clineno = 0;
static const char * __pyx_cfilenm= __FILE__;
static const char *__pyx_filename;


static const char *__pyx_f[] = {
  "redis\\Learning.pyx",
};

/*--- Type declarations ---*/
struct __pyx_obj_5redis_8Learning___pyx_scope_struct__generate_bagging_sample_array;
struct __pyx_obj_5redis_8Learning___pyx_scope_struct_1_Bagging_Test_Simple_Func;
struct __pyx_obj_5redis_8Learning___pyx_scope_struct_2_generate_bagging_sample_array;
struct __pyx_obj_5redis_8Learning___pyx_scope_struct_3_fit_predict;
struct __pyx_obj_5redis_8Learning___pyx_scope_struct_4_jobs_generator;
struct __pyx_obj_5redis_8Learning___pyx_scope_struct_5_IOPMD_Ratio;
struct __pyx_obj_5redis_8Learning___pyx_scope_struct_6_Bagging_Test_Lasso_Func;

/* "redis/Learning.pyx":132
 * 	return np.array(ListRequire)
 * 
 * def generate_bagging_sample_array(X, sample_num, sample_size, random_split, begin_index):             # <<<<<<<<<<<<<<
 * 	sample_indexs_array = generate_bagging_sample_index(X, sample_num, sample_size, random_split, begin_index)
 * 	for sample_indexs in sample_indexs_array:
 */
struct __pyx_obj_5redis_8Learning___pyx_scope_struct__generate_bagging_sample_array {
  PyObject_HEAD
  PyObject *__pyx_v_X;
  PyObject *__pyx_v_begin_index;
  PyObject *__pyx_v_random_split;
  PyObject *__pyx_v_sample_indexs;
  PyObject *__pyx_v_sample_indexs_array;
  PyObject *__pyx_v_sample_num;
  PyObject *__pyx_v_sample_size;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "redis/Learning.pyx":137
 * 		yield X[sample_indexs].copy()
 * 
 * def Bagging_Test_Simple_Func(X, factor_max_bound = 20, sample_num = 10, sample_size = 100, disp = False, Type = "forward_stepwise", itertimes = None, random_split = False, begin_index = None, skip_size = 1, alpha = 0.5):             # <<<<<<<<<<<<<<
 * 	factor_dict = dict()
 * 
 */
struct __pyx_obj_5redis_8Learning___pyx_scope_struct_1_Bagging_Test_Simple_Func {
  PyObject_HEAD
  PyObject *__pyx_v_disp;
  PyObject *__pyx_v_factor_max_bound;
  PyObject *__pyx_v_sample_size;
  PyObject *__pyx_v_skip_size;
};


/* "redis/Learning.pyx":393
 * 		return np.array(ListRequire)
 * 
 * 	def generate_bagging_sample_array(self, X, sample_num, sample_size, random_split):             # <<<<<<<<<<<<<<
 * 		sample_indexs_array = self.generate_bagging_sample_index(X, sample_num, sample_size, random_split)
 * 		for sample_indexs in sample_indexs_array:
 */
struct __pyx_obj_5redis_8Learning___pyx_scope_struct_2_generate_bagging_sample_array {
  PyObject_HEAD
  PyObject *__pyx_v_X;
  PyObject *__pyx_v_random_split;
  PyObject *__pyx_v_sample_indexs;
  PyObject *__pyx_v_sample_indexs_array;
  PyObject *__pyx_v_sample_num;
  PyObject *__pyx_v_sample_size;
  PyObject *__pyx_v_self;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "redis/Learning.pyx":545
 * 		return (corrcoef_max, corrcoef_max0, corrcoef_max1)
 * 
 * 	def fit_predict(self, X):             # <<<<<<<<<<<<<<
 * 
 * 		if self.random_split and type(self.begin_index) == type(None):
 */
struct __pyx_obj_5redis_8Learning___pyx_scope_struct_3_fit_predict {
  PyObject_HEAD
  PyObject *__pyx_v_job_server;
  PyObject *__pyx_v_self;
};


/* "redis/Learning.pyx":550
 * 			self.begin_index = self.factor_max_bound + 10
 * 
 * 		def jobs_generator(X, sample_num, sample_size, random_split):             # <<<<<<<<<<<<<<
 * 			for X_bagging_sample in self.generate_bagging_sample_array(X, sample_num, sample_size, random_split):
 * 
 */
struct __pyx_obj_5redis_8Learning___pyx_scope_struct_4_jobs_generator {
  PyObject_HEAD
  struct __pyx_obj_5redis_8Learning___pyx_scope_struct_3_fit_predict *__pyx_outer_scope;
  PyObject *__pyx_v_X;
  PyObject *__pyx_v_X_bagging_sample;
  PyObject *__pyx_v_random_split;
  PyObject *__pyx_v_sample_num;
  PyObject *__pyx_v_sample_size;
  PyObject *__pyx_t_0;
  Py_ssize_t __pyx_t_1;
  PyObject *(*__pyx_t_2)(PyObject *);
};


/* "redis/Learning.pyx":603
 * 
 * 
 * def IOPMD_Ratio(X, factor_max_bound, sample_size, begin, end, num, tol, log_format = False, disp = False):             # <<<<<<<<<<<<<<
 * 
 * 	def alpha_Test(eigen_ratio_sample, begin, end, num, tol, disp):
 */
struct __pyx_obj_5redis_8Learning___pyx_scope_struct_5_IOPMD_Ratio {
  PyObject_HEAD
  PyObject *__pyx_v_log_format;
};


/* "redis/Learning.pyx":799
 * 
 * 
 * def Bagging_Test_Lasso_Func(X, factor_max_bound = 20, sample_num = 10, sample_size = 100, disp = False, random_split = False, begin_index = None, skip_size = 1, alpha = 0.1):             # <<<<<<<<<<<<<<
 * 	factor_dict = dict()
 * 
 */
struct __pyx_obj_5redis_8Learning___pyx_scope_struct_6_Bagging_Test_Lasso_Func {
  PyObject_HEAD
  PyObject *__pyx_v_disp;
  PyObject *__pyx_v_factor_max_bound;
  PyObject *__pyx_v_sample_size;
  PyObject *__pyx_v_skip_size;
};


/* --- Runtime support code (head) --- */
/* Refnanny.proto */
#ifndef CYTHON_REFNANNY
  #define CYTHON_REFNANNY 0
#endif
#if CYTHON_REFNANNY
  typedef struct {
    void (*INCREF)(void*, PyObject*, int);
    void (*DECREF)(void*, PyObject*, int);
    void (*GOTREF)(void*, PyObject*, int);
    void (*GIVEREF)(void*, PyObject*, int);
    void* (*SetupContext)(const char*, int, const char*);
    void (*FinishContext)(void**);
  } __Pyx_RefNannyAPIStruct;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL;
  static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname);
  #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL;
#ifdef WITH_THREAD
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          if (acquire_gil) {\
              PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure();\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
              PyGILState_Release(__pyx_gilstate_save);\
          } else {\
              __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__);\
          }
#else
  #define __Pyx_RefNannySetupContext(name, acquire_gil)\
          __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__)
#endif
  #define __Pyx_RefNannyFinishContext()\
          __Pyx_RefNanny->FinishContext(&__pyx_refnanny)
  #define __Pyx_INCREF(r)  __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_DECREF(r)  __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GOTREF(r)  __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__)
  #define __Pyx_XINCREF(r)  do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0)
  #define __Pyx_XDECREF(r)  do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0)
  #define __Pyx_XGOTREF(r)  do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0)
  #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0)
#else
  #define __Pyx_RefNannyDeclarations
  #define __Pyx_RefNannySetupContext(name, acquire_gil)
  #define __Pyx_RefNannyFinishContext()
  #define __Pyx_INCREF(r) Py_INCREF(r)
  #define __Pyx_DECREF(r) Py_DECREF(r)
  #define __Pyx_GOTREF(r)
  #define __Pyx_GIVEREF(r)
  #define __Pyx_XINCREF(r) Py_XINCREF(r)
  #define __Pyx_XDECREF(r) Py_XDECREF(r)
  #define __Pyx_XGOTREF(r)
  #define __Pyx_XGIVEREF(r)
#endif
#define __Pyx_XDECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_XDECREF(tmp);\
    } while (0)
#define __Pyx_DECREF_SET(r, v) do {\
        PyObject *tmp = (PyObject *) r;\
        r = v; __Pyx_DECREF(tmp);\
    } while (0)
#define __Pyx_CLEAR(r)    do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0)
#define __Pyx_XCLEAR(r)   do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0)

/* PyObjectGetAttrStr.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_getattro))
        return tp->tp_getattro(obj, attr_name);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_getattr))
        return tp->tp_getattr(obj, PyString_AS_STRING(attr_name));
#endif
    return PyObject_GetAttr(obj, attr_name);
}
#else
#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n)
#endif

/* GetBuiltinName.proto */
static PyObject *__Pyx_GetBuiltinName(PyObject *name);

/* RaiseArgTupleInvalid.proto */
static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact,
    Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found);

/* RaiseDoubleKeywords.proto */
static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name);

/* ParseKeywords.proto */
static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[],\
    PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args,\
    const char* function_name);

/* GetModuleGlobalName.proto */
static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name);

/* PyObjectCall.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_Call(PyObject *func, PyObject *arg, PyObject *kw);
#else
#define __Pyx_PyObject_Call(func, arg, kw) PyObject_Call(func, arg, kw)
#endif

/* PyObjectCallMethO.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallMethO(PyObject *func, PyObject *arg);
#endif

/* PyObjectCallOneArg.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallOneArg(PyObject *func, PyObject *arg);

/* GetItemInt.proto */
#define __Pyx_GetItemInt(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Fast(o, (Py_ssize_t)i, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL) :\
               __Pyx_GetItemInt_Generic(o, to_py_func(i))))
#define __Pyx_GetItemInt_List(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_List_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "list index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
#define __Pyx_GetItemInt_Tuple(o, i, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_GetItemInt_Tuple_Fast(o, (Py_ssize_t)i, wraparound, boundscheck) :\
    (PyErr_SetString(PyExc_IndexError, "tuple index out of range"), (PyObject*)NULL))
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i,
                                                              int wraparound, int boundscheck);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j);
static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i,
                                                     int is_list, int wraparound, int boundscheck);

/* PyObjectCallNoArg.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE PyObject* __Pyx_PyObject_CallNoArg(PyObject *func);
#else
#define __Pyx_PyObject_CallNoArg(func) __Pyx_PyObject_Call(func, __pyx_empty_tuple, NULL)
#endif

/* SliceObject.proto */
static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice(
        PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop,
        PyObject** py_start, PyObject** py_stop, PyObject** py_slice,
        int has_cstart, int has_cstop, int wraparound);

/* FetchCommonType.proto */
static PyTypeObject* __Pyx_FetchCommonType(PyTypeObject* type);

/* CythonFunction.proto */
#define __Pyx_CyFunction_USED 1
#include <structmember.h>
#define __Pyx_CYFUNCTION_STATICMETHOD  0x01
#define __Pyx_CYFUNCTION_CLASSMETHOD   0x02
#define __Pyx_CYFUNCTION_CCLASS        0x04
#define __Pyx_CyFunction_GetClosure(f)\
    (((__pyx_CyFunctionObject *) (f))->func_closure)
#define __Pyx_CyFunction_GetClassObj(f)\
    (((__pyx_CyFunctionObject *) (f))->func_classobj)
#define __Pyx_CyFunction_Defaults(type, f)\
    ((type *)(((__pyx_CyFunctionObject *) (f))->defaults))
#define __Pyx_CyFunction_SetDefaultsGetter(f, g)\
    ((__pyx_CyFunctionObject *) (f))->defaults_getter = (g)
typedef struct {
    PyCFunctionObject func;
#if PY_VERSION_HEX < 0x030500A0
    PyObject *func_weakreflist;
#endif
    PyObject *func_dict;
    PyObject *func_name;
    PyObject *func_qualname;
    PyObject *func_doc;
    PyObject *func_globals;
    PyObject *func_code;
    PyObject *func_closure;
    PyObject *func_classobj;
    void *defaults;
    int defaults_pyobjects;
    int flags;
    PyObject *defaults_tuple;
    PyObject *defaults_kwdict;
    PyObject *(*defaults_getter)(PyObject *);
    PyObject *func_annotations;
} __pyx_CyFunctionObject;
static PyTypeObject *__pyx_CyFunctionType = 0;
#define __Pyx_CyFunction_NewEx(ml, flags, qualname, self, module, globals, code)\
    __Pyx_CyFunction_New(__pyx_CyFunctionType, ml, flags, qualname, self, module, globals, code)
static PyObject *__Pyx_CyFunction_New(PyTypeObject *, PyMethodDef *ml,
                                      int flags, PyObject* qualname,
                                      PyObject *self,
                                      PyObject *module, PyObject *globals,
                                      PyObject* code);
static CYTHON_INLINE void *__Pyx_CyFunction_InitDefaults(PyObject *m,
                                                         size_t size,
                                                         int pyobjects);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsTuple(PyObject *m,
                                                            PyObject *tuple);
static CYTHON_INLINE void __Pyx_CyFunction_SetDefaultsKwDict(PyObject *m,
                                                             PyObject *dict);
static CYTHON_INLINE void __Pyx_CyFunction_SetAnnotationsDict(PyObject *m,
                                                              PyObject *dict);
static int __pyx_CyFunction_init(void);

/* PyIntBinop.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx_PyInt_SubtractCObj(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_SubtractCObj(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceSubtract(op1, op2) : PyNumber_Subtract(op1, op2))
#endif

/* ListAppend.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_PyList_Append(L,x) PyList_Append(L,x)
#endif

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);

/* PyIntBinop.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx_PyInt_AddObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_AddObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* IncludeStringH.proto */
#include <string.h>

/* BytesEquals.proto */
static CYTHON_INLINE int __Pyx_PyBytes_Equals(PyObject* s1, PyObject* s2, int equals);

/* UnicodeEquals.proto */
static CYTHON_INLINE int __Pyx_PyUnicode_Equals(PyObject* s1, PyObject* s2, int equals);

/* StrEquals.proto */
#if PY_MAJOR_VERSION >= 3
#define __Pyx_PyString_Equals __Pyx_PyUnicode_Equals
#else
#define __Pyx_PyString_Equals __Pyx_PyBytes_Equals
#endif

/* Import.proto */
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level);

/* ImportFrom.proto */
static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name);

/* ListExtend.proto */
static CYTHON_INLINE int __Pyx_PyList_Extend(PyObject* L, PyObject* v) {
#if CYTHON_COMPILING_IN_CPYTHON
    PyObject* none = _PyList_Extend((PyListObject*)L, v);
    if (unlikely(!none))
        return -1;
    Py_DECREF(none);
    return 0;
#else
    return PyList_SetSlice(L, PY_SSIZE_T_MAX, PY_SSIZE_T_MAX, v);
#endif
}

/* PyThreadStateGet.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyThreadState_declare  PyThreadState *__pyx_tstate;
#define __Pyx_PyThreadState_assign  __pyx_tstate = PyThreadState_GET();
#else
#define __Pyx_PyThreadState_declare
#define __Pyx_PyThreadState_assign
#endif

/* SaveResetException.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_ExceptionSave(type, value, tb)  __Pyx__ExceptionSave(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSave(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#define __Pyx_ExceptionReset(type, value, tb)  __Pyx__ExceptionReset(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionReset(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
#else
#define __Pyx_ExceptionSave(type, value, tb)   PyErr_GetExcInfo(type, value, tb)
#define __Pyx_ExceptionReset(type, value, tb)  PyErr_SetExcInfo(type, value, tb)
#endif

/* GetException.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_GetException(type, value, tb)  __Pyx__GetException(__pyx_tstate, type, value, tb)
static int __Pyx__GetException(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* dict_getitem_default.proto */
static PyObject* __Pyx_PyDict_GetItemDefault(PyObject* d, PyObject* key, PyObject* default_value);

/* DictGetItem.proto */
#if PY_MAJOR_VERSION >= 3 && !CYTHON_COMPILING_IN_PYPY
static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) {
    PyObject *value;
    value = PyDict_GetItemWithError(d, key);
    if (unlikely(!value)) {
        if (!PyErr_Occurred()) {
            PyObject* args = PyTuple_Pack(1, key);
            if (likely(args))
                PyErr_SetObject(PyExc_KeyError, args);
            Py_XDECREF(args);
        }
        return NULL;
    }
    Py_INCREF(value);
    return value;
}
#else
    #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key)
#endif

/* RaiseTooManyValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected);

/* RaiseNeedMoreValuesToUnpack.proto */
static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index);

/* IterFinish.proto */
static CYTHON_INLINE int __Pyx_IterFinish(void);

/* UnpackItemEndCheck.proto */
static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected);

/* py_dict_keys.proto */
static CYTHON_INLINE PyObject* __Pyx_PyDict_Keys(PyObject* d);

/* UnpackUnboundCMethod.proto */
typedef struct {
    PyObject *type;
    PyObject **method_name;
    PyCFunction func;
    PyObject *method;
    int flag;
} __Pyx_CachedCFunction;

/* CallUnboundCMethod0.proto */
static PyObject* __Pyx__CallUnboundCMethod0(__Pyx_CachedCFunction* cfunc, PyObject* self);
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_CallUnboundCMethod0(cfunc, self)\
    ((likely((cfunc)->func)) ?\
        (likely((cfunc)->flag == METH_NOARGS) ?  (*((cfunc)->func))(self, NULL) :\
         (likely((cfunc)->flag == (METH_VARARGS | METH_KEYWORDS)) ?  ((*(PyCFunctionWithKeywords)(cfunc)->func)(self, __pyx_empty_tuple, NULL)) :\
             ((cfunc)->flag == METH_VARARGS ?  (*((cfunc)->func))(self, __pyx_empty_tuple) : __Pyx__CallUnboundCMethod0(cfunc, self)))) :\
        __Pyx__CallUnboundCMethod0(cfunc, self))
#else
#define __Pyx_CallUnboundCMethod0(cfunc, self)  __Pyx__CallUnboundCMethod0(cfunc, self)
#endif

/* PyObjectSetAttrStr.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL)
static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) {
    PyTypeObject* tp = Py_TYPE(obj);
    if (likely(tp->tp_setattro))
        return tp->tp_setattro(obj, attr_name, value);
#if PY_MAJOR_VERSION < 3
    if (likely(tp->tp_setattr))
        return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value);
#endif
    return PyObject_SetAttr(obj, attr_name, value);
}
#else
#define __Pyx_PyObject_DelAttrStr(o,n)   PyObject_DelAttr(o,n)
#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v)
#endif

/* ListCompAppend.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) {
    PyListObject* L = (PyListObject*) list;
    Py_ssize_t len = Py_SIZE(list);
    if (likely(L->allocated > len)) {
        Py_INCREF(x);
        PyList_SET_ITEM(list, len, x);
        Py_SIZE(list) = len+1;
        return 0;
    }
    return PyList_Append(list, x);
}
#else
#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x)
#endif

/* PyObjectCallMethod1.proto */
static PyObject* __Pyx_PyObject_CallMethod1(PyObject* obj, PyObject* method_name, PyObject* arg);

/* append.proto */
static CYTHON_INLINE int __Pyx_PyObject_Append(PyObject* L, PyObject* x);

/* SetItemInt.proto */
#define __Pyx_SetItemInt(o, i, v, type, is_signed, to_py_func, is_list, wraparound, boundscheck)\
    (__Pyx_fits_Py_ssize_t(i, type, is_signed) ?\
    __Pyx_SetItemInt_Fast(o, (Py_ssize_t)i, v, is_list, wraparound, boundscheck) :\
    (is_list ? (PyErr_SetString(PyExc_IndexError, "list assignment index out of range"), -1) :\
               __Pyx_SetItemInt_Generic(o, to_py_func(i), v)))
static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v);
static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v,
                                               int is_list, int wraparound, int boundscheck);

/* PyIntBinop.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx_PyInt_AddCObj(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_AddCObj(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceAdd(op1, op2) : PyNumber_Add(op1, op2))
#endif

/* None.proto */
static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname);

/* PyIntBinop.proto */
#if CYTHON_COMPILING_IN_CPYTHON
static PyObject* __Pyx_PyInt_TrueDivideObjC(PyObject *op1, PyObject *op2, long intval, int inplace);
#else
#define __Pyx_PyInt_TrueDivideObjC(op1, op2, intval, inplace)\
    (inplace ? PyNumber_InPlaceTrueDivide(op1, op2) : PyNumber_TrueDivide(op1, op2))
#endif

/* CalculateMetaclass.proto */
static PyObject *__Pyx_CalculateMetaclass(PyTypeObject *metaclass, PyObject *bases);

/* Py3ClassCreate.proto */
static PyObject *__Pyx_Py3MetaclassPrepare(PyObject *metaclass, PyObject *bases, PyObject *name, PyObject *qualname,
                                           PyObject *mkw, PyObject *modname, PyObject *doc);
static PyObject *__Pyx_Py3ClassCreate(PyObject *metaclass, PyObject *name, PyObject *bases, PyObject *dict,
                                      PyObject *mkw, int calculate_metaclass, int allow_py2_metaclass);

/* CodeObjectCache.proto */
typedef struct {
    PyCodeObject* code_object;
    int code_line;
} __Pyx_CodeObjectCacheEntry;
struct __Pyx_CodeObjectCache {
    int count;
    int max_count;
    __Pyx_CodeObjectCacheEntry* entries;
};
static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL};
static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line);
static PyCodeObject *__pyx_find_code_object(int code_line);
static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object);

/* AddTraceback.proto */
static void __Pyx_AddTraceback(const char *funcname, int c_line,
                               int py_line, const char *filename);

/* CIntToPy.proto */
static CYTHON_INLINE PyObject* __Pyx_PyInt_From_long(long value);

/* Print.proto */
static int __Pyx_Print(PyObject*, PyObject *, int);
#if CYTHON_COMPILING_IN_PYPY || PY_MAJOR_VERSION >= 3
static PyObject* __pyx_print = 0;
static PyObject* __pyx_print_kwargs = 0;
#endif

/* PrintOne.proto */
static int __Pyx_PrintOne(PyObject* stream, PyObject *o);

/* CIntFromPy.proto */
static CYTHON_INLINE long __Pyx_PyInt_As_long(PyObject *);

/* CIntFromPy.proto */
static CYTHON_INLINE int __Pyx_PyInt_As_int(PyObject *);

/* PyErrFetchRestore.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_ErrRestoreWithState(type, value, tb)  __Pyx_ErrRestoreInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)    __Pyx_ErrFetchInState(PyThreadState_GET(), type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  __Pyx_ErrRestoreInState(__pyx_tstate, type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)    __Pyx_ErrFetchInState(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx_ErrRestoreInState(PyThreadState *tstate, PyObject *type, PyObject *value, PyObject *tb);
static CYTHON_INLINE void __Pyx_ErrFetchInState(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
#define __Pyx_ErrRestoreWithState(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetchWithState(type, value, tb)  PyErr_Fetch(type, value, tb)
#define __Pyx_ErrRestore(type, value, tb)  PyErr_Restore(type, value, tb)
#define __Pyx_ErrFetch(type, value, tb)  PyErr_Fetch(type, value, tb)
#endif

/* RaiseException.proto */
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause);

/* SwapException.proto */
#if CYTHON_COMPILING_IN_CPYTHON
#define __Pyx_ExceptionSwap(type, value, tb)  __Pyx__ExceptionSwap(__pyx_tstate, type, value, tb)
static CYTHON_INLINE void __Pyx__ExceptionSwap(PyThreadState *tstate, PyObject **type, PyObject **value, PyObject **tb);
#else
static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb);
#endif

/* CoroutineBase.proto */
typedef PyObject *(*__pyx_coroutine_body_t)(PyObject *, PyObject *);
typedef struct {
    PyObject_HEAD
    __pyx_coroutine_body_t body;
    PyObject *closure;
    PyObject *exc_type;
    PyObject *exc_value;
    PyObject *exc_traceback;
    PyObject *gi_weakreflist;
    PyObject *classobj;
    PyObject *yieldfrom;
    PyObject *gi_name;
    PyObject *gi_qualname;
    PyObject *gi_modulename;
    int resume_label;
    char is_running;
} __pyx_CoroutineObject;
static __pyx_CoroutineObject *__Pyx__Coroutine_New(
    PyTypeObject *type, __pyx_coroutine_body_t body, PyObject *closure,
    PyObject *name, PyObject *qualname, PyObject *module_name);
static int __Pyx_Coroutine_clear(PyObject *self);
#if 1 || PY_VERSION_HEX < 0x030300B0
static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue);
#else
#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue)
#endif

/* PatchModuleWithCoroutine.proto */
static PyObject* __Pyx_Coroutine_patch_module(PyObject* module, const char* py_code);

/* PatchGeneratorABC.proto */
static int __Pyx_patch_abc(void);

/* Generator.proto */
#define __Pyx_Generator_USED
static PyTypeObject *__pyx_GeneratorType = 0;
#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType)
#define __Pyx_Generator_New(body, closure, name, qualname, module_name)\
    __Pyx__Coroutine_New(__pyx_GeneratorType, body, closure, name, qualname, module_name)
static PyObject *__Pyx_Generator_Next(PyObject *self);
static int __pyx_Generator_init(void);

/* CheckBinaryVersion.proto */
static int __Pyx_check_binary_version(void);

/* InitStrings.proto */
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t);


/* Module declarations from 'redis.Learning' */
static PyTypeObject *__pyx_ptype_5redis_8Learning___pyx_scope_struct__generate_bagging_sample_array = 0;
static PyTypeObject *__pyx_ptype_5redis_8Learning___pyx_scope_struct_1_Bagging_Test_Simple_Func = 0;
static PyTypeObject *__pyx_ptype_5redis_8Learning___pyx_scope_struct_2_generate_bagging_sample_array = 0;
static PyTypeObject *__pyx_ptype_5redis_8Learning___pyx_scope_struct_3_fit_predict = 0;
static PyTypeObject *__pyx_ptype_5redis_8Learning___pyx_scope_struct_4_jobs_generator = 0;
static PyTypeObject *__pyx_ptype_5redis_8Learning___pyx_scope_struct_5_IOPMD_Ratio = 0;
static PyTypeObject *__pyx_ptype_5redis_8Learning___pyx_scope_struct_6_Bagging_Test_Lasso_Func = 0;
#define __Pyx_MODULE_NAME "redis.Learning"
int __pyx_module_is_main_redis__Learning = 0;

/* Implementation of 'redis.Learning' */
static PyObject *__pyx_builtin_object;
static PyObject *__pyx_builtin_staticmethod;
static PyObject *__pyx_builtin_range;
static PyObject *__pyx_builtin_filter;
static PyObject *__pyx_builtin_min;
static const char __pyx_k_E[] = "E";
static const char __pyx_k_F[] = "F";
static const char __pyx_k_T[] = "T";
static const char __pyx_k_X[] = "X";
static const char __pyx_k_i[] = "i";
static const char __pyx_k_j[] = "j";
static const char __pyx_k_k[] = "k";
static const char __pyx_k_v[] = "v";
static const char __pyx_k_w[] = "w";
static const char __pyx_k_y[] = "y_";
static const char __pyx_k_ir[] = "ir";
static const char __pyx_k_np[] = "np";
static const char __pyx_k_os[] = "os";
static const char __pyx_k_pp[] = "pp";
static const char __pyx_k_rp[] = "rp";
static const char __pyx_k__34[] = "{}+++++++++++++++++++";
static const char __pyx_k__76[] = "_";
static const char __pyx_k_abc[] = "abc";
static const char __pyx_k_abs[] = "abs";
static const char __pyx_k_any[] = "any";
static const char __pyx_k_clf[] = "clf";
static const char __pyx_k_det[] = "det";
static const char __pyx_k_dim[] = "dim";
static const char __pyx_k_doc[] = "__doc__";
static const char __pyx_k_dot[] = "dot";
static const char __pyx_k_end[] = "end";
static const char __pyx_k_eps[] = "eps";
static const char __pyx_k_exp[] = "exp";
static const char __pyx_k_eye[] = "eye";
static const char __pyx_k_fit[] = "fit";
static const char __pyx_k_get[] = "get";
static const char __pyx_k_job[] = "job";
static const char __pyx_k_key[] = "key";
static const char __pyx_k_max[] = "max";
static const char __pyx_k_min[] = "min";
static const char __pyx_k_nan[] = "nan";
static const char __pyx_k_num[] = "num";
static const char __pyx_k_plt[] = "plt";
static const char __pyx_k_sum[] = "sum";
static const char __pyx_k_svd[] = "svd";
static const char __pyx_k_tol[] = "tol";
static const char __pyx_k_Type[] = "Type";
static const char __pyx_k__104[] = "*";
static const char __pyx_k_args[] = "args";
static const char __pyx_k_auto[] = "auto";
static const char __pyx_k_axis[] = "axis";
static const char __pyx_k_coef[] = "coef :";
static const char __pyx_k_copy[] = "copy";
static const char __pyx_k_diag[] = "diag";
static const char __pyx_k_disp[] = "disp";
static const char __pyx_k_eigh[] = "eigh";
static const char __pyx_k_file[] = "file";
static const char __pyx_k_init[] = "__init__";
static const char __pyx_k_jobs[] = "jobs";
static const char __pyx_k_keys[] = "keys";
static const char __pyx_k_main[] = "__main__";
static const char __pyx_k_next[] = "next";
static const char __pyx_k_norm[] = "norm";
static const char __pyx_k_self[] = "self";
static const char __pyx_k_send[] = "send";
static const char __pyx_k_size[] = "size";
static const char __pyx_k_test[] = "__test__";
static const char __pyx_k_time[] = "time";
static const char __pyx_k_wait[] = "wait";
static const char __pyx_k_Lasso[] = "Lasso";
static const char __pyx_k_Queue[] = "Queue";
static const char __pyx_k_alpha[] = "alpha";
static const char __pyx_k_array[] = "array";
static const char __pyx_k_begin[] = "begin";
static const char __pyx_k_close[] = "close";
static const char __pyx_k_empty[] = "empty";
static const char __pyx_k_expon[] = "expon";
static const char __pyx_k_gamma[] = "gamma";
static const char __pyx_k_items[] = "items";
static const char __pyx_k_ncpus[] = "ncpus";
static const char __pyx_k_numpy[] = "numpy";
static const char __pyx_k_outer[] = "outer";
static const char __pyx_k_print[] = "print";
static const char __pyx_k_range[] = "range";
static const char __pyx_k_ratio[] = "ratio :";
static const char __pyx_k_scale[] = "scale";
static const char __pyx_k_shape[] = "shape";
static const char __pyx_k_sleep[] = "sleep";
static const char __pyx_k_split[] = "split";
static const char __pyx_k_theta[] = "theta";
static const char __pyx_k_throw[] = "throw";
static const char __pyx_k_zeros[] = "zeros";
static const char __pyx_k_DBSCAN[] = "DBSCAN";
static const char __pyx_k_Server[] = "Server";
static const char __pyx_k_append[] = "append";
static const char __pyx_k_arange[] = "arange";
static const char __pyx_k_argmax[] = "argmax";
static const char __pyx_k_around[] = "around";
static const char __pyx_k_coef_2[] = "coef_";
static const char __pyx_k_filter[] = "filter";
static const char __pyx_k_format[] = "format";
static const char __pyx_k_import[] = "__import__";
static const char __pyx_k_labels[] = "labels :";
static const char __pyx_k_lambda[] = "_lambda";
static const char __pyx_k_linalg[] = "linalg";
static const char __pyx_k_loader[] = "loader";
static const char __pyx_k_matrix[] = "matrix";
static const char __pyx_k_module[] = "__module__";
static const char __pyx_k_object[] = "object";
static const char __pyx_k_random[] = "random";
static const char __pyx_k_submit[] = "submit";
static const char __pyx_k_unique[] = "unique";
static const char __pyx_k_values[] = "values";
static const char __pyx_k_ABCMeta[] = "ABCMeta";
static const char __pyx_k_E_first[] = "E_first";
static const char __pyx_k_Process[] = "Process";
static const char __pyx_k_Require[] = "Require";
static const char __pyx_k_X_first[] = "X_first";
static const char __pyx_k_argsort[] = "argsort";
static const char __pyx_k_det_val[] = "det_val";
static const char __pyx_k_eigen_v[] = "eigen_v";
static const char __pyx_k_gamma_2[] = "gamma :";
static const char __pyx_k_partial[] = "partial";
static const char __pyx_k_poisson[] = "poisson";
static const char __pyx_k_prepare[] = "__prepare__";
static const char __pyx_k_randint[] = "randint";
static const char __pyx_k_ratio_2[] = "ratio";
static const char __pyx_k_reshape[] = "reshape";
static const char __pyx_k_samples[] = "samples";
static const char __pyx_k_shape_2[] = " shape ({}, {})";
static const char __pyx_k_sklearn[] = "sklearn";
static const char __pyx_k_slogdet[] = "slogdet";
static const char __pyx_k_the_val[] = "the val :";
static const char __pyx_k_corrcoef[] = "corrcoef";
static const char __pyx_k_decimals[] = "decimals";
static const char __pyx_k_deepcopy[] = "deepcopy";
static const char __pyx_k_eigvalsh[] = "eigvalsh";
static const char __pyx_k_key_list[] = "key_list";
static const char __pyx_k_labels_2[] = "labels";
static const char __pyx_k_linspace[] = "linspace";
static const char __pyx_k_qualname[] = "__qualname__";
static const char __pyx_k_Main_Part[] = "Main_Part";
static const char __pyx_k_Test_Func[] = "Test_Func";
static const char __pyx_k_alpha_end[] = "alpha_end";
static const char __pyx_k_alpha_num[] = "alpha_num";
static const char __pyx_k_functools[] = "functools";
static const char __pyx_k_itertimes[] = "itertimes";
static const char __pyx_k_max_label[] = "max_label";
static const char __pyx_k_metaclass[] = "__metaclass__";
static const char __pyx_k_set_ncpus[] = "set_ncpus";
static const char __pyx_k_skip_size[] = "skip_size";
static const char __pyx_k_theta_end[] = "theta_end";
static const char __pyx_k_theta_num[] = "theta_num";
static const char __pyx_k_threading[] = "threading";
static const char __pyx_k_total_num[] = "total_num :";
static const char __pyx_k_transform[] = "transform";
static const char __pyx_k_alpha_Test[] = "alpha_Test";
static const char __pyx_k_conclusion[] = "conclusion :";
static const char __pyx_k_generate_E[] = "generate_E";
static const char __pyx_k_generate_F[] = "generate_F";
static const char __pyx_k_generate_X[] = "generate_X";
static const char __pyx_k_increasing[] = "increasing";
static const char __pyx_k_job_server[] = "job_server";
static const char __pyx_k_log_format[] = "log_format";
static const char __pyx_k_n_clusters[] = "n_clusters";
static const char __pyx_k_nan_to_num[] = "nan_to_num";
static const char __pyx_k_rbf_kernel[] = "rbf_kernel";
static const char __pyx_k_sample_num[] = "sample_num";
static const char __pyx_k_thetha_end[] = "thetha_end";
static const char __pyx_k_thetha_num[] = "thetha_num";
static const char __pyx_k_total_Dict[] = "total_Dict";
static const char __pyx_k_IOPMD_Ratio[] = "IOPMD_Ratio";
static const char __pyx_k_ListRequire[] = "ListRequire";
static const char __pyx_k_alpha_begin[] = "alpha_begin";
static const char __pyx_k_alpha_theta[] = "alpha_theta";
static const char __pyx_k_base_matrix[] = "base_matrix";
static const char __pyx_k_begin_index[] = "begin_index";
static const char __pyx_k_begin_times[] = "begin times {}";
static const char __pyx_k_factor_dict[] = "factor_dict :";
static const char __pyx_k_fit_predict[] = "fit_predict";
static const char __pyx_k_iopmd_ratio[] = "iopmd_ratio";
static const char __pyx_k_left_lambda[] = "left_lambda";
static const char __pyx_k_norm_from_E[] = "norm from E :";
static const char __pyx_k_orth_matrix[] = "orth_matrix";
static const char __pyx_k_projected_X[] = "projected_X";
static const char __pyx_k_sample_size[] = "sample_size";
static const char __pyx_k_scipy_stats[] = "scipy.stats";
static const char __pyx_k_start_alpha[] = "start_alpha";
static const char __pyx_k_temp_matrix[] = "temp_matrix";
static const char __pyx_k_theta_begin[] = "theta_begin";
static const char __pyx_k_total_num_2[] = "total_num";
static const char __pyx_k_will_append[] = "will_append";
static const char __pyx_k_average_Dict[] = "average_Dict :";
static const char __pyx_k_conclusion_2[] = "conclusion";
static const char __pyx_k_corrcoef_max[] = "corrcoef_max";
static const char __pyx_k_factor_index[] = "factor_index";
static const char __pyx_k_first_matrix[] = "first_matrix";
static const char __pyx_k_lambda_for_F[] = "lambda_for_F";
static const char __pyx_k_linear_model[] = "linear_model";
static const char __pyx_k_n_components[] = "n_components";
static const char __pyx_k_numpy_linalg[] = "numpy.linalg";
static const char __pyx_k_numpy_random[] = "numpy.random";
static const char __pyx_k_poisson_mean[] = "poisson_mean";
static const char __pyx_k_random_split[] = "random_split";
static const char __pyx_k_right_lambda[] = "right_lambda";
static const char __pyx_k_round_format[] = "round format :";
static const char __pyx_k_staticmethod[] = "staticmethod";
static const char __pyx_k_thetha_begin[] = "thetha_begin";
static const char __pyx_k_corrcoef_max0[] = "corrcoef_max0";
static const char __pyx_k_corrcoef_max1[] = "corrcoef_max1";
static const char __pyx_k_dim_of_sample[] = "dim_of_sample";
static const char __pyx_k_factor_dict_2[] = "factor_dict";
static const char __pyx_k_fit_transform[] = "fit_transform";
static const char __pyx_k_lambda_vector[] = "lambda_vector";
static const char __pyx_k_max_label_num[] = "max_label_num";
static const char __pyx_k_num_of_sample[] = "num_of_sample";
static const char __pyx_k_out_of_bounds[] = "out_of_bounds";
static const char __pyx_k_preprocessing[] = "preprocessing";
static const char __pyx_k_random_sample[] = "random_sample";
static const char __pyx_k_return_counts[] = "return_counts";
static const char __pyx_k_sample_indexs[] = "sample_indexs";
static const char __pyx_k_the_max_index[] = "the max index :";
static const char __pyx_k_unique_labels[] = "unique labels :";
static const char __pyx_k_The_shape_of_X[] = "The shape of X :";
static const char __pyx_k_abstractmethod[] = "abstractmethod";
static const char __pyx_k_conclusion_set[] = "conclusion_set";
static const char __pyx_k_corrcoef_array[] = "corrcoef_array";
static const char __pyx_k_jobs_generator[] = "jobs_generator";
static const char __pyx_k_norm_from_Main[] = "norm_from_Main";
static const char __pyx_k_num_of_factors[] = "num_of_factors";
static const char __pyx_k_redis_Learning[] = "redis.Learning";
static const char __pyx_k_IOPMD_Ratio_tol[] = "IOPMD_Ratio_tol";
static const char __pyx_k_Main_Part_first[] = "Main_Part_first";
static const char __pyx_k_array_require_T[] = "array_require_T";
static const char __pyx_k_generate_loader[] = "generate_loader";
static const char __pyx_k_generate_matrix[] = "generate_matrix";
static const char __pyx_k_generate_sample[] = "generate_sample";
static const char __pyx_k_min_iopmd_ratio[] = "min iopmd_ratio :";
static const char __pyx_k_multiprocessing[] = "multiprocessing";
static const char __pyx_k_sklearn_cluster[] = "sklearn.cluster";
static const char __pyx_k_unique_labels_2[] = "unique_labels";
static const char __pyx_k_X_bagging_sample[] = "X_bagging_sample";
static const char __pyx_k_alpha_theta_Test[] = "alpha_theta_Test";
static const char __pyx_k_factor_max_bound[] = "factor_max_bound";
static const char __pyx_k_forward_stepwise[] = "forward_stepwise";
static const char __pyx_k_iopmd_ratio_list[] = "iopmd_ratio_list";
static const char __pyx_k_min_n_components[] = "min_n_components";
static const char __pyx_k_sklearn_isotonic[] = "sklearn.isotonic";
static const char __pyx_k_the_unique_ratio[] = "the unique ratio :";
static const char __pyx_k_transform_matrix[] = "transform_matrix";
static const char __pyx_k_backward_isotonic[] = "backward_isotonic";
static const char __pyx_k_bagging_generator[] = "bagging_generator";
static const char __pyx_k_lambda_for_loader[] = "lambda_for_loader";
static const char __pyx_k_matplotlib_pyplot[] = "matplotlib.pyplot";
static const char __pyx_k_IsotonicRegression[] = "IsotonicRegression";
static const char __pyx_k_eigen_ratio_sample[] = "eigen_ratio_sample";
static const char __pyx_k_length_of_key_list[] = "length of key_list :";
static const char __pyx_k_multivariate_normal[] = "multivariate_normal";
static const char __pyx_k_norm_from_Main_Part[] = "norm from Main_Part :";
static const char __pyx_k_projected_and_eigen[] = "projected_and_eigen";
static const char __pyx_k_sample_indexs_array[] = "sample_indexs_array";
static const char __pyx_k_spectral_clustering[] = "spectral_clustering";
static const char __pyx_k_unique_array_tuple0[] = "unique_array_tuple0";
static const char __pyx_k_unique_array_tuple1[] = "unique_array_tuple1";
static const char __pyx_k_average_metric_array[] = "average_metric_array";
static const char __pyx_k_Bagging_Test_Parallel[] = "Bagging_Test_Parallel";
static const char __pyx_k_IOPMD_Ratio_Gamma_end[] = "IOPMD_Ratio_Gamma_end";
static const char __pyx_k_IOPMD_Ratio_Gamma_num[] = "IOPMD_Ratio_Gamma_num";
static const char __pyx_k_ratio_factor_dict_low[] = "ratio_factor_dict_low :";
static const char __pyx_k_SparseRandomProjection[] = "SparseRandomProjection";
static const char __pyx_k_alpha_combination_Test[] = "alpha_combination_Test";
static const char __pyx_k_ratio_factor_dict_high[] = "ratio_factor_dict_high :";
static const char __pyx_k_Bagging_Test_Lasso_Func[] = "Bagging_Test_Lasso_Func";
static const char __pyx_k_IOPMD_Ratio_Gamma_begin[] = "IOPMD_Ratio_Gamma_begin";
static const char __pyx_k_labels_indentity_array0[] = "labels_indentity_array0 :";
static const char __pyx_k_labels_indentity_array1[] = "labels_indentity_array1 :";
static const char __pyx_k_ratio_factor_dict_low_2[] = "ratio_factor_dict_low";
static const char __pyx_k_Bagging_Test_Simple_Func[] = "Bagging_Test_Simple_Func";
static const char __pyx_k_The_shape_of_projected_X[] = "The shape of projected_X :";
static const char __pyx_k_ratio_factor_dict_high_2[] = "ratio_factor_dict_high";
static const char __pyx_k_sklearn_metrics_pairwise[] = "sklearn.metrics.pairwise";
static const char __pyx_k_the_largest_eigen_v_of_E[] = "the largest eigen_v of E :";
static const char __pyx_k_the_largest_eigen_v_of_X[] = "the largest eigen_v of X :";
static const char __pyx_k_labels_indentity_array0_2[] = "labels_indentity_array0";
static const char __pyx_k_labels_indentity_array1_2[] = "labels_indentity_array1";
static const char __pyx_k_sklearn_random_projection[] = "sklearn.random_projection";
static const char __pyx_k_X_bagging_sample_job_tuple[] = "X_bagging_sample_job_tuple";
static const char __pyx_k_Bagging_Test_Transform_Func[] = "Bagging_Test_Transform_Func";
static const char __pyx_k_isotonic_eigen_ratio_sample[] = "isotonic_eigen_ratio_sample";
static const char __pyx_k_Bagging_Test_Parallel___init[] = "Bagging_Test_Parallel.__init__";
static const char __pyx_k_IOPMD_Ratio_locals_alpha_Test[] = "IOPMD_Ratio.<locals>.alpha_Test";
static const char __pyx_k_generate_bagging_sample_array[] = "generate_bagging_sample_array";
static const char __pyx_k_generate_bagging_sample_index[] = "generate_bagging_sample_index";
static const char __pyx_k_johnson_lindenstrauss_min_dim[] = "johnson_lindenstrauss_min_dim";
static const char __pyx_k_unique_labels_indentity_array0[] = "unique labels_indentity_array0 :";
static const char __pyx_k_unique_labels_indentity_array1[] = "unique labels_indentity_array1 :";
static const char __pyx_k_Bagging_Test_Parallel_projected[] = "Bagging_Test_Parallel.projected_and_eigen";
static const char __pyx_k_Bagging_Test_Simple_Func_locals[] = "Bagging_Test_Simple_Func.<locals>.change_eigen_ratio_sample_order";
static const char __pyx_k_change_eigen_ratio_sample_order[] = "change_eigen_ratio_sample_order";
static const char __pyx_k_generate_forward_stepwise_eigen[] = "generate_forward_stepwise_eigen_ratio_sample";
static const char __pyx_k_the_ratio_of_E_and_Main_Part_in[] = "the ratio of E and Main_Part in the largest eigen_v :";
static const char __pyx_k_Bagging_Test_Lasso_Func_locals_g[] = "Bagging_Test_Lasso_Func.<locals>.generate_forward_stepwise_eigen_ratio_sample";
static const char __pyx_k_Bagging_Test_Parallel_change_eig[] = "Bagging_Test_Parallel.change_eigen_ratio_sample_order";
static const char __pyx_k_Bagging_Test_Parallel_fit_predic[] = "Bagging_Test_Parallel.fit_predict.<locals>.jobs_generator";
static const char __pyx_k_Bagging_Test_Parallel_generate_X[] = "Bagging_Test_Parallel.generate_X_bagging_sample_conclusion";
static const char __pyx_k_Bagging_Test_Parallel_generate_b[] = "Bagging_Test_Parallel.generate_bagging_sample_array";
static const char __pyx_k_Bagging_Test_Parallel_generate_f[] = "Bagging_Test_Parallel.generate_forward_stepwise_eigen_ratio_sample";
static const char __pyx_k_D_professional_software_java_rel[] = "D:\\professional software\\java related\\coding\\2017.2.25\\Learning\\redis\\Learning.pyx";
static const char __pyx_k_IOPMD_Ratio_locals_alpha_Test_lo[] = "IOPMD_Ratio.<locals>.alpha_Test.<locals>.<lambda>";
static const char __pyx_k_The_Type_not_in_forward_stepwise[] = "The Type not in ['forward_stepwise', 'backward_isotonic'] will return";
static const char __pyx_k_generate_E_locals_generate_matri[] = "generate_E.<locals>.generate_matrix";
static const char __pyx_k_generate_X_bagging_sample_conclu[] = "generate_X_bagging_sample_conclusion";
static const char __pyx_k_generate_backward_isotonic_eigen[] = "generate_backward_isotonic_eigen_ratio_sample";
static const char __pyx_k_the_largest_eigen_v_of_Main_Part[] = "the largest eigen_v of Main_Part :";
static const char __pyx_k_Bagging_Test_Simple_Func_locals_2[] = "Bagging_Test_Simple_Func.<locals>.generate_forward_stepwise_eigen_ratio_sample";
static const char __pyx_k_Bagging_Test_Simple_Func_locals_3[] = "Bagging_Test_Simple_Func.<locals>.generate_backward_isotonic_eigen_ratio_sample";
static const char __pyx_k_Bagging_Test_Parallel_fit_predic_2[] = "Bagging_Test_Parallel.fit_predict";
static const char __pyx_k_Bagging_Test_Parallel_generate_b_2[] = "Bagging_Test_Parallel.generate_bagging_sample_index";
static const char __pyx_k_Bagging_Test_Parallel_generate_b_3[] = "Bagging_Test_Parallel.generate_backward_isotonic_eigen_ratio_sample";
static PyObject *__pyx_n_s_ABCMeta;
static PyObject *__pyx_n_s_Bagging_Test_Lasso_Func;
static PyObject *__pyx_n_s_Bagging_Test_Lasso_Func_locals_g;
static PyObject *__pyx_n_s_Bagging_Test_Parallel;
static PyObject *__pyx_n_s_Bagging_Test_Parallel___init;
static PyObject *__pyx_n_s_Bagging_Test_Parallel_change_eig;
static PyObject *__pyx_n_s_Bagging_Test_Parallel_fit_predic;
static PyObject *__pyx_n_s_Bagging_Test_Parallel_fit_predic_2;
static PyObject *__pyx_n_s_Bagging_Test_Parallel_generate_X;
static PyObject *__pyx_n_s_Bagging_Test_Parallel_generate_b;
static PyObject *__pyx_n_s_Bagging_Test_Parallel_generate_b_2;
static PyObject *__pyx_n_s_Bagging_Test_Parallel_generate_b_3;
static PyObject *__pyx_n_s_Bagging_Test_Parallel_generate_f;
static PyObject *__pyx_n_s_Bagging_Test_Parallel_projected;
static PyObject *__pyx_n_s_Bagging_Test_Simple_Func;
static PyObject *__pyx_n_s_Bagging_Test_Simple_Func_locals;
static PyObject *__pyx_n_s_Bagging_Test_Simple_Func_locals_2;
static PyObject *__pyx_n_s_Bagging_Test_Simple_Func_locals_3;
static PyObject *__pyx_n_s_Bagging_Test_Transform_Func;
static PyObject *__pyx_n_s_DBSCAN;
static PyObject *__pyx_kp_s_D_professional_software_java_rel;
static PyObject *__pyx_n_s_E;
static PyObject *__pyx_n_s_E_first;
static PyObject *__pyx_n_s_F;
static PyObject *__pyx_n_s_IOPMD_Ratio;
static PyObject *__pyx_n_s_IOPMD_Ratio_Gamma_begin;
static PyObject *__pyx_n_s_IOPMD_Ratio_Gamma_end;
static PyObject *__pyx_n_s_IOPMD_Ratio_Gamma_num;
static PyObject *__pyx_n_s_IOPMD_Ratio_locals_alpha_Test;
static PyObject *__pyx_n_s_IOPMD_Ratio_locals_alpha_Test_lo;
static PyObject *__pyx_n_s_IOPMD_Ratio_tol;
static PyObject *__pyx_n_s_IsotonicRegression;
static PyObject *__pyx_n_s_Lasso;
static PyObject *__pyx_n_s_ListRequire;
static PyObject *__pyx_n_s_Main_Part;
static PyObject *__pyx_n_s_Main_Part_first;
static PyObject *__pyx_n_s_Process;
static PyObject *__pyx_n_s_Queue;
static PyObject *__pyx_n_s_Require;
static PyObject *__pyx_n_s_Server;
static PyObject *__pyx_n_s_SparseRandomProjection;
static PyObject *__pyx_n_s_T;
static PyObject *__pyx_n_s_Test_Func;
static PyObject *__pyx_kp_s_The_Type_not_in_forward_stepwise;
static PyObject *__pyx_kp_s_The_shape_of_X;
static PyObject *__pyx_kp_s_The_shape_of_projected_X;
static PyObject *__pyx_n_s_Type;
static PyObject *__pyx_n_s_X;
static PyObject *__pyx_n_s_X_bagging_sample;
static PyObject *__pyx_n_s_X_bagging_sample_job_tuple;
static PyObject *__pyx_n_s_X_first;
static PyObject *__pyx_n_s__104;
static PyObject *__pyx_kp_s__34;
static PyObject *__pyx_n_s__76;
static PyObject *__pyx_n_s_abc;
static PyObject *__pyx_n_s_abs;
static PyObject *__pyx_n_s_abstractmethod;
static PyObject *__pyx_n_s_alpha;
static PyObject *__pyx_n_s_alpha_Test;
static PyObject *__pyx_n_s_alpha_begin;
static PyObject *__pyx_n_s_alpha_combination_Test;
static PyObject *__pyx_n_s_alpha_end;
static PyObject *__pyx_n_s_alpha_num;
static PyObject *__pyx_n_s_alpha_theta;
static PyObject *__pyx_n_s_alpha_theta_Test;
static PyObject *__pyx_n_s_any;
static PyObject *__pyx_n_s_append;
static PyObject *__pyx_n_s_arange;
static PyObject *__pyx_n_s_argmax;
static PyObject *__pyx_n_s_args;
static PyObject *__pyx_n_s_argsort;
static PyObject *__pyx_n_s_around;
static PyObject *__pyx_n_s_array;
static PyObject *__pyx_n_s_array_require_T;
static PyObject *__pyx_n_s_auto;
static PyObject *__pyx_kp_s_average_Dict;
static PyObject *__pyx_n_s_average_metric_array;
static PyObject *__pyx_n_s_axis;
static PyObject *__pyx_n_s_backward_isotonic;
static PyObject *__pyx_n_s_bagging_generator;
static PyObject *__pyx_n_s_base_matrix;
static PyObject *__pyx_n_s_begin;
static PyObject *__pyx_n_s_begin_index;
static PyObject *__pyx_kp_s_begin_times;
static PyObject *__pyx_n_s_change_eigen_ratio_sample_order;
static PyObject *__pyx_n_s_clf;
static PyObject *__pyx_n_s_close;
static PyObject *__pyx_kp_s_coef;
static PyObject *__pyx_n_s_coef_2;
static PyObject *__pyx_kp_s_conclusion;
static PyObject *__pyx_n_s_conclusion_2;
static PyObject *__pyx_n_s_conclusion_set;
static PyObject *__pyx_n_s_copy;
static PyObject *__pyx_n_s_corrcoef;
static PyObject *__pyx_n_s_corrcoef_array;
static PyObject *__pyx_n_s_corrcoef_max;
static PyObject *__pyx_n_s_corrcoef_max0;
static PyObject *__pyx_n_s_corrcoef_max1;
static PyObject *__pyx_n_s_decimals;
static PyObject *__pyx_n_s_deepcopy;
static PyObject *__pyx_n_s_det;
static PyObject *__pyx_n_s_det_val;
static PyObject *__pyx_n_s_diag;
static PyObject *__pyx_n_s_dim;
static PyObject *__pyx_n_s_dim_of_sample;
static PyObject *__pyx_n_s_disp;
static PyObject *__pyx_n_s_doc;
static PyObject *__pyx_n_s_dot;
static PyObject *__pyx_n_s_eigen_ratio_sample;
static PyObject *__pyx_n_s_eigen_v;
static PyObject *__pyx_n_s_eigh;
static PyObject *__pyx_n_s_eigvalsh;
static PyObject *__pyx_n_s_empty;
static PyObject *__pyx_n_s_end;
static PyObject *__pyx_n_s_eps;
static PyObject *__pyx_n_s_exp;
static PyObject *__pyx_n_s_expon;
static PyObject *__pyx_n_s_eye;
static PyObject *__pyx_kp_s_factor_dict;
static PyObject *__pyx_n_s_factor_dict_2;
static PyObject *__pyx_n_s_factor_index;
static PyObject *__pyx_n_s_factor_max_bound;
static PyObject *__pyx_n_s_file;
static PyObject *__pyx_n_s_filter;
static PyObject *__pyx_n_s_first_matrix;
static PyObject *__pyx_n_s_fit;
static PyObject *__pyx_n_s_fit_predict;
static PyObject *__pyx_n_s_fit_transform;
static PyObject *__pyx_n_s_format;
static PyObject *__pyx_n_s_forward_stepwise;
static PyObject *__pyx_n_s_functools;
static PyObject *__pyx_n_s_gamma;
static PyObject *__pyx_kp_s_gamma_2;
static PyObject *__pyx_n_s_generate_E;
static PyObject *__pyx_n_s_generate_E_locals_generate_matri;
static PyObject *__pyx_n_s_generate_F;
static PyObject *__pyx_n_s_generate_X;
static PyObject *__pyx_n_s_generate_X_bagging_sample_conclu;
static PyObject *__pyx_n_s_generate_backward_isotonic_eigen;
static PyObject *__pyx_n_s_generate_bagging_sample_array;
static PyObject *__pyx_n_s_generate_bagging_sample_index;
static PyObject *__pyx_n_s_generate_forward_stepwise_eigen;
static PyObject *__pyx_n_s_generate_loader;
static PyObject *__pyx_n_s_generate_matrix;
static PyObject *__pyx_n_s_generate_sample;
static PyObject *__pyx_n_s_get;
static PyObject *__pyx_n_s_i;
static PyObject *__pyx_n_s_import;
static PyObject *__pyx_n_s_increasing;
static PyObject *__pyx_n_s_init;
static PyObject *__pyx_n_s_iopmd_ratio;
static PyObject *__pyx_n_s_iopmd_ratio_list;
static PyObject *__pyx_n_s_ir;
static PyObject *__pyx_n_s_isotonic_eigen_ratio_sample;
static PyObject *__pyx_n_s_items;
static PyObject *__pyx_n_s_itertimes;
static PyObject *__pyx_n_s_j;
static PyObject *__pyx_n_s_job;
static PyObject *__pyx_n_s_job_server;
static PyObject *__pyx_n_s_jobs;
static PyObject *__pyx_n_s_jobs_generator;
static PyObject *__pyx_n_s_johnson_lindenstrauss_min_dim;
static PyObject *__pyx_n_s_k;
static PyObject *__pyx_n_s_key;
static PyObject *__pyx_n_s_key_list;
static PyObject *__pyx_n_s_keys;
static PyObject *__pyx_kp_s_labels;
static PyObject *__pyx_n_s_labels_2;
static PyObject *__pyx_kp_s_labels_indentity_array0;
static PyObject *__pyx_n_s_labels_indentity_array0_2;
static PyObject *__pyx_kp_s_labels_indentity_array1;
static PyObject *__pyx_n_s_labels_indentity_array1_2;
static PyObject *__pyx_n_s_lambda;
static PyObject *__pyx_n_s_lambda_for_F;
static PyObject *__pyx_n_s_lambda_for_loader;
static PyObject *__pyx_n_s_lambda_vector;
static PyObject *__pyx_n_s_left_lambda;
static PyObject *__pyx_kp_s_length_of_key_list;
static PyObject *__pyx_n_s_linalg;
static PyObject *__pyx_n_s_linear_model;
static PyObject *__pyx_n_s_linspace;
static PyObject *__pyx_n_s_loader;
static PyObject *__pyx_n_s_log_format;
static PyObject *__pyx_n_s_main;
static PyObject *__pyx_n_s_matplotlib_pyplot;
static PyObject *__pyx_n_s_matrix;
static PyObject *__pyx_n_s_max;
static PyObject *__pyx_n_s_max_label;
static PyObject *__pyx_n_s_max_label_num;
static PyObject *__pyx_n_s_metaclass;
static PyObject *__pyx_n_s_min;
static PyObject *__pyx_kp_s_min_iopmd_ratio;
static PyObject *__pyx_n_s_min_n_components;
static PyObject *__pyx_n_s_module;
static PyObject *__pyx_n_s_multiprocessing;
static PyObject *__pyx_n_s_multivariate_normal;
static PyObject *__pyx_n_s_n_clusters;
static PyObject *__pyx_n_s_n_components;
static PyObject *__pyx_n_s_nan;
static PyObject *__pyx_n_s_nan_to_num;
static PyObject *__pyx_n_s_ncpus;
static PyObject *__pyx_n_s_next;
static PyObject *__pyx_n_s_norm;
static PyObject *__pyx_kp_s_norm_from_E;
static PyObject *__pyx_n_s_norm_from_Main;
static PyObject *__pyx_kp_s_norm_from_Main_Part;
static PyObject *__pyx_n_s_np;
static PyObject *__pyx_n_s_num;
static PyObject *__pyx_n_s_num_of_factors;
static PyObject *__pyx_n_s_num_of_sample;
static PyObject *__pyx_n_s_numpy;
static PyObject *__pyx_n_s_numpy_linalg;
static PyObject *__pyx_n_s_numpy_random;
static PyObject *__pyx_n_s_object;
static PyObject *__pyx_n_s_orth_matrix;
static PyObject *__pyx_n_s_os;
static PyObject *__pyx_n_s_out_of_bounds;
static PyObject *__pyx_n_s_outer;
static PyObject *__pyx_n_s_partial;
static PyObject *__pyx_n_s_plt;
static PyObject *__pyx_n_s_poisson;
static PyObject *__pyx_n_s_poisson_mean;
static PyObject *__pyx_n_s_pp;
static PyObject *__pyx_n_s_prepare;
static PyObject *__pyx_n_s_preprocessing;
static PyObject *__pyx_n_s_print;
static PyObject *__pyx_n_s_projected_X;
static PyObject *__pyx_n_s_projected_and_eigen;
static PyObject *__pyx_n_s_qualname;
static PyObject *__pyx_n_s_randint;
static PyObject *__pyx_n_s_random;
static PyObject *__pyx_n_s_random_sample;
static PyObject *__pyx_n_s_random_split;
static PyObject *__pyx_n_s_range;
static PyObject *__pyx_kp_s_ratio;
static PyObject *__pyx_n_s_ratio_2;
static PyObject *__pyx_kp_s_ratio_factor_dict_high;
static PyObject *__pyx_n_s_ratio_factor_dict_high_2;
static PyObject *__pyx_kp_s_ratio_factor_dict_low;
static PyObject *__pyx_n_s_ratio_factor_dict_low_2;
static PyObject *__pyx_n_s_rbf_kernel;
static PyObject *__pyx_n_s_redis_Learning;
static PyObject *__pyx_n_s_reshape;
static PyObject *__pyx_n_s_return_counts;
static PyObject *__pyx_n_s_right_lambda;
static PyObject *__pyx_kp_s_round_format;
static PyObject *__pyx_n_s_rp;
static PyObject *__pyx_n_s_sample_indexs;
static PyObject *__pyx_n_s_sample_indexs_array;
static PyObject *__pyx_n_s_sample_num;
static PyObject *__pyx_n_s_sample_size;
static PyObject *__pyx_n_s_samples;
static PyObject *__pyx_n_s_scale;
static PyObject *__pyx_n_s_scipy_stats;
static PyObject *__pyx_n_s_self;
static PyObject *__pyx_n_s_send;
static PyObject *__pyx_n_s_set_ncpus;
static PyObject *__pyx_n_s_shape;
static PyObject *__pyx_kp_s_shape_2;
static PyObject *__pyx_n_s_size;
static PyObject *__pyx_n_s_skip_size;
static PyObject *__pyx_n_s_sklearn;
static PyObject *__pyx_n_s_sklearn_cluster;
static PyObject *__pyx_n_s_sklearn_isotonic;
static PyObject *__pyx_n_s_sklearn_metrics_pairwise;
static PyObject *__pyx_n_s_sklearn_random_projection;
static PyObject *__pyx_n_s_sleep;
static PyObject *__pyx_n_s_slogdet;
static PyObject *__pyx_n_s_spectral_clustering;
static PyObject *__pyx_n_s_split;
static PyObject *__pyx_n_s_start_alpha;
static PyObject *__pyx_n_s_staticmethod;
static PyObject *__pyx_n_s_submit;
static PyObject *__pyx_n_s_sum;
static PyObject *__pyx_n_s_svd;
static PyObject *__pyx_n_s_temp_matrix;
static PyObject *__pyx_n_s_test;
static PyObject *__pyx_kp_s_the_largest_eigen_v_of_E;
static PyObject *__pyx_kp_s_the_largest_eigen_v_of_Main_Part;
static PyObject *__pyx_kp_s_the_largest_eigen_v_of_X;
static PyObject *__pyx_kp_s_the_max_index;
static PyObject *__pyx_kp_s_the_ratio_of_E_and_Main_Part_in;
static PyObject *__pyx_kp_s_the_unique_ratio;
static PyObject *__pyx_kp_s_the_val;
static PyObject *__pyx_n_s_theta;
static PyObject *__pyx_n_s_theta_begin;
static PyObject *__pyx_n_s_theta_end;
static PyObject *__pyx_n_s_theta_num;
static PyObject *__pyx_n_s_thetha_begin;
static PyObject *__pyx_n_s_thetha_end;
static PyObject *__pyx_n_s_thetha_num;
static PyObject *__pyx_n_s_threading;
static PyObject *__pyx_n_s_throw;
static PyObject *__pyx_n_s_time;
static PyObject *__pyx_n_s_tol;
static PyObject *__pyx_n_s_total_Dict;
static PyObject *__pyx_kp_s_total_num;
static PyObject *__pyx_n_s_total_num_2;
static PyObject *__pyx_n_s_transform;
static PyObject *__pyx_n_s_transform_matrix;
static PyObject *__pyx_n_s_unique;
static PyObject *__pyx_n_s_unique_array_tuple0;
static PyObject *__pyx_n_s_unique_array_tuple1;
static PyObject *__pyx_kp_s_unique_labels;
static PyObject *__pyx_n_s_unique_labels_2;
static PyObject *__pyx_kp_s_unique_labels_indentity_array0;
static PyObject *__pyx_kp_s_unique_labels_indentity_array1;
static PyObject *__pyx_n_s_v;
static PyObject *__pyx_n_s_values;
static PyObject *__pyx_n_s_w;
static PyObject *__pyx_n_s_wait;
static PyObject *__pyx_n_s_will_append;
static PyObject *__pyx_n_s_y;
static PyObject *__pyx_n_s_zeros;
static PyObject *__pyx_pf_5redis_8Learning_generate_sample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num_of_sample, PyObject *__pyx_v_dim_of_sample); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_10generate_E_generate_matrix(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dim, PyObject *__pyx_v__lambda); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_2generate_E(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_left_lambda, PyObject *__pyx_v_right_lambda, PyObject *__pyx_v_samples); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_4generate_F(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num_of_sample, PyObject *__pyx_v_num_of_factors, PyObject *__pyx_v_poisson_mean); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_6generate_loader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num_of_factors, PyObject *__pyx_v_dim_of_sample, PyObject *__pyx_v_poisson_mean); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_8generate_X(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num_of_sample, PyObject *__pyx_v_num_of_factors, PyObject *__pyx_v_dim_of_sample, PyObject *__pyx_v_lambda_for_F, PyObject *__pyx_v_lambda_for_loader, PyObject *__pyx_v_left_lambda, PyObject *__pyx_v_right_lambda, PyObject *__pyx_v_disp); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_10projected_and_eigen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_eps, PyObject *__pyx_v_disp); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_12generate_bagging_sample_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_sample_num, PyObject *__pyx_v_sample_size, PyObject *__pyx_v_random_split, PyObject *__pyx_v_begin_index); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_14generate_bagging_sample_array(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_sample_num, PyObject *__pyx_v_sample_size, PyObject *__pyx_v_random_split, PyObject *__pyx_v_begin_index); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_24Bagging_Test_Simple_Func_change_eigen_ratio_sample_order(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_eigen_ratio_sample); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_24Bagging_Test_Simple_Func_2generate_forward_stepwise_eigen_ratio_sample(PyObject *__pyx_self, PyObject *__pyx_v_X_bagging_sample); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_24Bagging_Test_Simple_Func_4generate_backward_isotonic_eigen_ratio_sample(PyObject *__pyx_self, PyObject *__pyx_v_X_bagging_sample, PyObject *__pyx_v_itertimes); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_17Bagging_Test_Simple_Func(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_factor_max_bound, PyObject *__pyx_v_sample_num, PyObject *__pyx_v_sample_size, PyObject *__pyx_v_disp, PyObject *__pyx_v_Type, PyObject *__pyx_v_itertimes, PyObject *__pyx_v_random_split, PyObject *__pyx_v_begin_index, PyObject *__pyx_v_skip_size, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_19alpha_combination_Test(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_start_alpha, PyObject *__pyx_v_num, PyObject *__pyx_v_Test_Func); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_21Bagging_Test_Parallel_projected_and_eigen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_eps, PyObject *__pyx_v_disp); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_21Bagging_Test_Parallel_2__init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_factor_max_bound, PyObject *__pyx_v_sample_num, PyObject *__pyx_v_sample_size, PyObject *__pyx_v_disp, PyObject *__pyx_v_Type, PyObject *__pyx_v_itertimes, PyObject *__pyx_v_ncpus, PyObject *__pyx_v_random_split, PyObject *__pyx_v_begin_index, PyObject *__pyx_v_skip_size, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_21Bagging_Test_Parallel_4generate_bagging_sample_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_sample_num, PyObject *__pyx_v_sample_size, PyObject *__pyx_v_random_split); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_21Bagging_Test_Parallel_6generate_bagging_sample_array(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X, PyObject *__pyx_v_sample_num, PyObject *__pyx_v_sample_size, PyObject *__pyx_v_random_split); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_21Bagging_Test_Parallel_9change_eigen_ratio_sample_order(CYTHON_UNUSED PyObject *__pyx_self, CYTHON_UNUSED PyObject *__pyx_v_self, PyObject *__pyx_v_eigen_ratio_sample); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_21Bagging_Test_Parallel_11generate_forward_stepwise_eigen_ratio_sample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X_bagging_sample, PyObject *__pyx_v_factor_max_bound, PyObject *__pyx_v_sample_size); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_21Bagging_Test_Parallel_13generate_backward_isotonic_eigen_ratio_sample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X_bagging_sample, PyObject *__pyx_v_factor_max_bound, PyObject *__pyx_v_itertimes); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_21Bagging_Test_Parallel_15generate_X_bagging_sample_conclusion(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X_bagging_sample, PyObject *__pyx_v_Type, PyObject *__pyx_v_itertimes); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_21Bagging_Test_Parallel_11fit_predict_jobs_generator(PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_sample_num, PyObject *__pyx_v_sample_size, PyObject *__pyx_v_random_split); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_21Bagging_Test_Parallel_17fit_predict(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_X); /* proto */
static PyObject *__pyx_lambda_funcdef_lambda(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_x); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_11IOPMD_Ratio_alpha_Test(PyObject *__pyx_self, PyObject *__pyx_v_eigen_ratio_sample, PyObject *__pyx_v_begin, PyObject *__pyx_v_end, PyObject *__pyx_v_num, PyObject *__pyx_v_tol, PyObject *__pyx_v_disp); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_21IOPMD_Ratio(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_factor_max_bound, PyObject *__pyx_v_sample_size, PyObject *__pyx_v_begin, PyObject *__pyx_v_end, PyObject *__pyx_v_num, PyObject *__pyx_v_tol, PyObject *__pyx_v_log_format, PyObject *__pyx_v_disp); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_23alpha_theta_Test(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_matrix, PyObject *__pyx_v_factor_index, PyObject *__pyx_v_alpha_begin, PyObject *__pyx_v_alpha_end, PyObject *__pyx_v_alpha_num, PyObject *__pyx_v_thetha_begin, PyObject *__pyx_v_thetha_end, PyObject *__pyx_v_thetha_num, PyObject *__pyx_v_log_format, PyObject *__pyx_v_disp); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_25Bagging_Test_Transform_Func(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_factor_max_bound, PyObject *__pyx_v_sample_num, PyObject *__pyx_v_sample_size, PyObject *__pyx_v_random_split, PyObject *__pyx_v_begin_index, PyObject *__pyx_v_IOPMD_Ratio_Gamma_begin, PyObject *__pyx_v_IOPMD_Ratio_Gamma_end, PyObject *__pyx_v_IOPMD_Ratio_Gamma_num, PyObject *__pyx_v_IOPMD_Ratio_tol, PyObject *__pyx_v_alpha_begin, PyObject *__pyx_v_alpha_end, PyObject *__pyx_v_alpha_num, PyObject *__pyx_v_theta_begin, PyObject *__pyx_v_theta_end, PyObject *__pyx_v_theta_num, PyObject *__pyx_v_log_format, PyObject *__pyx_v_disp); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_23Bagging_Test_Lasso_Func_generate_forward_stepwise_eigen_ratio_sample(PyObject *__pyx_self, PyObject *__pyx_v_X_bagging_sample); /* proto */
static PyObject *__pyx_pf_5redis_8Learning_27Bagging_Test_Lasso_Func(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_factor_max_bound, PyObject *__pyx_v_sample_num, PyObject *__pyx_v_sample_size, PyObject *__pyx_v_disp, PyObject *__pyx_v_random_split, PyObject *__pyx_v_begin_index, PyObject *__pyx_v_skip_size, PyObject *__pyx_v_alpha); /* proto */
static PyObject *__pyx_tp_new_5redis_8Learning___pyx_scope_struct__generate_bagging_sample_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5redis_8Learning___pyx_scope_struct_1_Bagging_Test_Simple_Func(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5redis_8Learning___pyx_scope_struct_2_generate_bagging_sample_array(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5redis_8Learning___pyx_scope_struct_3_fit_predict(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5redis_8Learning___pyx_scope_struct_4_jobs_generator(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5redis_8Learning___pyx_scope_struct_5_IOPMD_Ratio(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static PyObject *__pyx_tp_new_5redis_8Learning___pyx_scope_struct_6_Bagging_Test_Lasso_Func(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/
static __Pyx_CachedCFunction __pyx_umethod_PyDict_Type_keys = {0, &__pyx_n_s_keys, 0, 0, 0};
static PyObject *__pyx_float_0_1;
static PyObject *__pyx_float_0_3;
static PyObject *__pyx_float_0_5;
static PyObject *__pyx_float_0_7;
static PyObject *__pyx_float_0_01;
static PyObject *__pyx_float_0_99;
static PyObject *__pyx_float_0_00001;
static PyObject *__pyx_int_0;
static PyObject *__pyx_int_1;
static PyObject *__pyx_int_2;
static PyObject *__pyx_int_3;
static PyObject *__pyx_int_10;
static PyObject *__pyx_int_11;
static PyObject *__pyx_int_20;
static PyObject *__pyx_int_30;
static PyObject *__pyx_int_50;
static PyObject *__pyx_int_100;
static PyObject *__pyx_int_200;
static PyObject *__pyx_int_500;
static PyObject *__pyx_int_700;
static PyObject *__pyx_int_neg_1;
static PyObject *__pyx_tuple_;
static PyObject *__pyx_slice__3;
static PyObject *__pyx_slice__4;
static PyObject *__pyx_slice__5;
static PyObject *__pyx_slice__6;
static PyObject *__pyx_slice__7;
static PyObject *__pyx_slice__8;
static PyObject *__pyx_slice__9;
static PyObject *__pyx_slice__10;
static PyObject *__pyx_slice__11;
static PyObject *__pyx_slice__12;
static PyObject *__pyx_slice__14;
static PyObject *__pyx_slice__15;
static PyObject *__pyx_slice__16;
static PyObject *__pyx_slice__17;
static PyObject *__pyx_slice__18;
static PyObject *__pyx_slice__19;
static PyObject *__pyx_slice__20;
static PyObject *__pyx_slice__22;
static PyObject *__pyx_slice__23;
static PyObject *__pyx_slice__32;
static PyObject *__pyx_slice__33;
static PyObject *__pyx_slice__35;
static PyObject *__pyx_slice__36;
static PyObject *__pyx_slice__37;
static PyObject *__pyx_slice__38;
static PyObject *__pyx_slice__39;
static PyObject *__pyx_slice__40;
static PyObject *__pyx_slice__41;
static PyObject *__pyx_slice__42;
static PyObject *__pyx_slice__44;
static PyObject *__pyx_slice__45;
static PyObject *__pyx_slice__47;
static PyObject *__pyx_slice__48;
static PyObject *__pyx_slice__49;
static PyObject *__pyx_slice__50;
static PyObject *__pyx_slice__51;
static PyObject *__pyx_slice__52;
static PyObject *__pyx_slice__53;
static PyObject *__pyx_slice__55;
static PyObject *__pyx_slice__56;
static PyObject *__pyx_slice__58;
static PyObject *__pyx_slice__59;
static PyObject *__pyx_slice__62;
static PyObject *__pyx_slice__63;
static PyObject *__pyx_slice__64;
static PyObject *__pyx_slice__65;
static PyObject *__pyx_slice__66;
static PyObject *__pyx_slice__67;
static PyObject *__pyx_slice__68;
static PyObject *__pyx_slice__69;
static PyObject *__pyx_slice__72;
static PyObject *__pyx_slice__73;
static PyObject *__pyx_slice__74;
static PyObject *__pyx_slice__78;
static PyObject *__pyx_slice__79;
static PyObject *__pyx_slice__81;
static PyObject *__pyx_slice__82;
static PyObject *__pyx_slice__84;
static PyObject *__pyx_slice__86;
static PyObject *__pyx_slice__89;
static PyObject *__pyx_slice__90;
static PyObject *__pyx_slice__91;
static PyObject *__pyx_slice__92;
static PyObject *__pyx_slice__93;
static PyObject *__pyx_slice__94;
static PyObject *__pyx_slice__95;
static PyObject *__pyx_slice__99;
static PyObject *__pyx_tuple__13;
static PyObject *__pyx_tuple__21;
static PyObject *__pyx_tuple__24;
static PyObject *__pyx_tuple__25;
static PyObject *__pyx_tuple__27;
static PyObject *__pyx_tuple__29;
static PyObject *__pyx_tuple__31;
static PyObject *__pyx_tuple__43;
static PyObject *__pyx_tuple__46;
static PyObject *__pyx_tuple__54;
static PyObject *__pyx_tuple__57;
static PyObject *__pyx_tuple__60;
static PyObject *__pyx_tuple__70;
static PyObject *__pyx_tuple__75;
static PyObject *__pyx_tuple__77;
static PyObject *__pyx_tuple__80;
static PyObject *__pyx_tuple__83;
static PyObject *__pyx_tuple__85;
static PyObject *__pyx_tuple__87;
static PyObject *__pyx_tuple__88;
static PyObject *__pyx_tuple__96;
static PyObject *__pyx_tuple__97;
static PyObject *__pyx_codeobj__2;
static PyObject *__pyx_slice__100;
static PyObject *__pyx_slice__102;
static PyObject *__pyx_tuple__101;
static PyObject *__pyx_tuple__103;
static PyObject *__pyx_tuple__105;
static PyObject *__pyx_tuple__107;
static PyObject *__pyx_tuple__109;
static PyObject *__pyx_tuple__111;
static PyObject *__pyx_tuple__113;
static PyObject *__pyx_tuple__115;
static PyObject *__pyx_tuple__117;
static PyObject *__pyx_tuple__119;
static PyObject *__pyx_tuple__121;
static PyObject *__pyx_tuple__123;
static PyObject *__pyx_tuple__125;
static PyObject *__pyx_tuple__127;
static PyObject *__pyx_tuple__128;
static PyObject *__pyx_tuple__130;
static PyObject *__pyx_tuple__131;
static PyObject *__pyx_tuple__133;
static PyObject *__pyx_tuple__135;
static PyObject *__pyx_tuple__137;
static PyObject *__pyx_tuple__139;
static PyObject *__pyx_tuple__141;
static PyObject *__pyx_tuple__142;
static PyObject *__pyx_tuple__144;
static PyObject *__pyx_tuple__146;
static PyObject *__pyx_tuple__148;
static PyObject *__pyx_tuple__150;
static PyObject *__pyx_tuple__152;
static PyObject *__pyx_codeobj__26;
static PyObject *__pyx_codeobj__28;
static PyObject *__pyx_codeobj__30;
static PyObject *__pyx_codeobj__61;
static PyObject *__pyx_codeobj__71;
static PyObject *__pyx_codeobj__98;
static PyObject *__pyx_codeobj__106;
static PyObject *__pyx_codeobj__108;
static PyObject *__pyx_codeobj__110;
static PyObject *__pyx_codeobj__112;
static PyObject *__pyx_codeobj__114;
static PyObject *__pyx_codeobj__116;
static PyObject *__pyx_codeobj__118;
static PyObject *__pyx_codeobj__120;
static PyObject *__pyx_codeobj__122;
static PyObject *__pyx_codeobj__124;
static PyObject *__pyx_codeobj__126;
static PyObject *__pyx_codeobj__129;
static PyObject *__pyx_codeobj__132;
static PyObject *__pyx_codeobj__134;
static PyObject *__pyx_codeobj__136;
static PyObject *__pyx_codeobj__138;
static PyObject *__pyx_codeobj__140;
static PyObject *__pyx_codeobj__143;
static PyObject *__pyx_codeobj__145;
static PyObject *__pyx_codeobj__147;
static PyObject *__pyx_codeobj__149;
static PyObject *__pyx_codeobj__151;
static PyObject *__pyx_codeobj__153;

/* "redis/Learning.pyx":30
 * 
 * 
 * def generate_sample(num_of_sample, dim_of_sample):             # <<<<<<<<<<<<<<
 * 	return multivariate_normal(np.zeros([dim_of_sample]), np.eye(dim_of_sample), num_of_sample)
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5redis_8Learning_1generate_sample(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5redis_8Learning_1generate_sample = {"generate_sample", (PyCFunction)__pyx_pw_5redis_8Learning_1generate_sample, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5redis_8Learning_1generate_sample(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_num_of_sample = 0;
  PyObject *__pyx_v_dim_of_sample = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate_sample (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_num_of_sample,&__pyx_n_s_dim_of_sample,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_of_sample)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dim_of_sample)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_sample", 1, 2, 2, 1); __PYX_ERR(0, 30, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "generate_sample") < 0)) __PYX_ERR(0, 30, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_num_of_sample = values[0];
    __pyx_v_dim_of_sample = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate_sample", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 30, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("redis.Learning.generate_sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5redis_8Learning_generate_sample(__pyx_self, __pyx_v_num_of_sample, __pyx_v_dim_of_sample);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5redis_8Learning_generate_sample(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num_of_sample, PyObject *__pyx_v_dim_of_sample) {
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  __Pyx_RefNannySetupContext("generate_sample", 0);

  /* "redis/Learning.pyx":31
 * 
 * def generate_sample(num_of_sample, dim_of_sample):
 * 	return multivariate_normal(np.zeros([dim_of_sample]), np.eye(dim_of_sample), num_of_sample)             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_multivariate_normal); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_zeros); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_INCREF(__pyx_v_dim_of_sample);
  __Pyx_GIVEREF(__pyx_v_dim_of_sample);
  PyList_SET_ITEM(__pyx_t_4, 0, __pyx_v_dim_of_sample);
  __pyx_t_6 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_6) {
    __pyx_t_3 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __Pyx_GOTREF(__pyx_t_3);
  } else {
    __pyx_t_7 = PyTuple_New(1+1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 31, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_6); __pyx_t_6 = NULL;
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_7, 0+1, __pyx_t_4);
    __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 31, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_eye); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_4, __pyx_v_dim_of_sample); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    __pyx_t_6 = PyTuple_New(1+1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 31, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_7); __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_v_dim_of_sample);
    __Pyx_GIVEREF(__pyx_v_dim_of_sample);
    PyTuple_SET_ITEM(__pyx_t_6, 0+1, __pyx_v_dim_of_sample);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 31, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_8 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_8 = 1;
    }
  }
  __pyx_t_6 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_6, 0+__pyx_t_8, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_6, 1+__pyx_t_8, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_num_of_sample);
  __Pyx_GIVEREF(__pyx_v_num_of_sample);
  PyTuple_SET_ITEM(__pyx_t_6, 2+__pyx_t_8, __pyx_v_num_of_sample);
  __pyx_t_3 = 0;
  __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 31, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "redis/Learning.pyx":30
 * 
 * 
 * def generate_sample(num_of_sample, dim_of_sample):             # <<<<<<<<<<<<<<
 * 	return multivariate_normal(np.zeros([dim_of_sample]), np.eye(dim_of_sample), num_of_sample)
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("redis.Learning.generate_sample", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "redis/Learning.pyx":34
 * 
 * 
 * def generate_E(left_lambda, right_lambda, samples):             # <<<<<<<<<<<<<<
 * 	def generate_matrix(dim, _lambda):
 * 		base_matrix = np.zeros([dim, dim])
 */

/* Python wrapper */
static PyObject *__pyx_pw_5redis_8Learning_3generate_E(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5redis_8Learning_3generate_E = {"generate_E", (PyCFunction)__pyx_pw_5redis_8Learning_3generate_E, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5redis_8Learning_3generate_E(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_left_lambda = 0;
  PyObject *__pyx_v_right_lambda = 0;
  PyObject *__pyx_v_samples = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate_E (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_left_lambda,&__pyx_n_s_right_lambda,&__pyx_n_s_samples,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_left_lambda)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_right_lambda)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_E", 1, 3, 3, 1); __PYX_ERR(0, 34, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_samples)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_E", 1, 3, 3, 2); __PYX_ERR(0, 34, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "generate_E") < 0)) __PYX_ERR(0, 34, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_left_lambda = values[0];
    __pyx_v_right_lambda = values[1];
    __pyx_v_samples = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate_E", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 34, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("redis.Learning.generate_E", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5redis_8Learning_2generate_E(__pyx_self, __pyx_v_left_lambda, __pyx_v_right_lambda, __pyx_v_samples);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "redis/Learning.pyx":35
 * 
 * def generate_E(left_lambda, right_lambda, samples):
 * 	def generate_matrix(dim, _lambda):             # <<<<<<<<<<<<<<
 * 		base_matrix = np.zeros([dim, dim])
 * 		for i in range(base_matrix.shape[0]):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5redis_8Learning_10generate_E_1generate_matrix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5redis_8Learning_10generate_E_1generate_matrix = {"generate_matrix", (PyCFunction)__pyx_pw_5redis_8Learning_10generate_E_1generate_matrix, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5redis_8Learning_10generate_E_1generate_matrix(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_dim = 0;
  PyObject *__pyx_v__lambda = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate_matrix (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_dim,&__pyx_n_s_lambda,0};
    PyObject* values[2] = {0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dim)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lambda)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_matrix", 1, 2, 2, 1); __PYX_ERR(0, 35, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "generate_matrix") < 0)) __PYX_ERR(0, 35, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
    }
    __pyx_v_dim = values[0];
    __pyx_v__lambda = values[1];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate_matrix", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 35, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("redis.Learning.generate_E.generate_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5redis_8Learning_10generate_E_generate_matrix(__pyx_self, __pyx_v_dim, __pyx_v__lambda);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5redis_8Learning_10generate_E_generate_matrix(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_dim, PyObject *__pyx_v__lambda) {
  PyObject *__pyx_v_base_matrix = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_j = NULL;
  PyObject *__pyx_v_orth_matrix = NULL;
  PyObject *__pyx_v_lambda_vector = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  Py_ssize_t __pyx_t_8;
  PyObject *(*__pyx_t_9)(PyObject *);
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  PyObject *__pyx_t_13 = NULL;
  __Pyx_RefNannySetupContext("generate_matrix", 0);

  /* "redis/Learning.pyx":36
 * def generate_E(left_lambda, right_lambda, samples):
 * 	def generate_matrix(dim, _lambda):
 * 		base_matrix = np.zeros([dim, dim])             # <<<<<<<<<<<<<<
 * 		for i in range(base_matrix.shape[0]):
 * 			for j in range(i):
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_dim);
  __Pyx_GIVEREF(__pyx_v_dim);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_dim);
  __Pyx_INCREF(__pyx_v_dim);
  __Pyx_GIVEREF(__pyx_v_dim);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_dim);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 36, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_base_matrix = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "redis/Learning.pyx":37
 * 	def generate_matrix(dim, _lambda):
 * 		base_matrix = np.zeros([dim, dim])
 * 		for i in range(base_matrix.shape[0]):             # <<<<<<<<<<<<<<
 * 			for j in range(i):
 * 				base_matrix[i][j] = random()
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_base_matrix, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 37, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 37, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 37, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 37, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_7(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 37, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "redis/Learning.pyx":38
 * 		base_matrix = np.zeros([dim, dim])
 * 		for i in range(base_matrix.shape[0]):
 * 			for j in range(i):             # <<<<<<<<<<<<<<
 * 				base_matrix[i][j] = random()
 * 
 */
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_i);
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    if (likely(PyList_CheckExact(__pyx_t_5)) || PyTuple_CheckExact(__pyx_t_5)) {
      __pyx_t_3 = __pyx_t_5; __Pyx_INCREF(__pyx_t_3); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_9 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_3))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 38, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_3)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_8); __Pyx_INCREF(__pyx_t_5); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 38, __pyx_L1_error)
          #else
          __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_5);
          #endif
        }
      } else {
        __pyx_t_5 = __pyx_t_9(__pyx_t_3);
        if (unlikely(!__pyx_t_5)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 38, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_5);
      }
      __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_5);
      __pyx_t_5 = 0;

      /* "redis/Learning.pyx":39
 * 		for i in range(base_matrix.shape[0]):
 * 			for j in range(i):
 * 				base_matrix[i][j] = random()             # <<<<<<<<<<<<<<
 * 
 * 		for i in range(base_matrix.shape[0]):
 */
      __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_random); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __pyx_t_4 = NULL;
      if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
        __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
        if (likely(__pyx_t_4)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
          __Pyx_INCREF(__pyx_t_4);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_2, function);
        }
      }
      if (__pyx_t_4) {
        __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error)
        __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
      } else {
        __pyx_t_5 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 39, __pyx_L1_error)
      }
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __pyx_t_2 = PyObject_GetItem(__pyx_v_base_matrix, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      if (unlikely(PyObject_SetItem(__pyx_t_2, __pyx_v_j, __pyx_t_5) < 0)) __PYX_ERR(0, 39, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

      /* "redis/Learning.pyx":38
 * 		base_matrix = np.zeros([dim, dim])
 * 		for i in range(base_matrix.shape[0]):
 * 			for j in range(i):             # <<<<<<<<<<<<<<
 * 				base_matrix[i][j] = random()
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "redis/Learning.pyx":37
 * 	def generate_matrix(dim, _lambda):
 * 		base_matrix = np.zeros([dim, dim])
 * 		for i in range(base_matrix.shape[0]):             # <<<<<<<<<<<<<<
 * 			for j in range(i):
 * 				base_matrix[i][j] = random()
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "redis/Learning.pyx":41
 * 				base_matrix[i][j] = random()
 * 
 * 		for i in range(base_matrix.shape[0]):             # <<<<<<<<<<<<<<
 * 			for j in range(base_matrix.shape[0])[i:]:
 * 				base_matrix[i][j] = base_matrix[j][i]
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_base_matrix, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 41, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 41, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 41, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_7(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 41, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "redis/Learning.pyx":42
 * 
 * 		for i in range(base_matrix.shape[0]):
 * 			for j in range(base_matrix.shape[0])[i:]:             # <<<<<<<<<<<<<<
 * 				base_matrix[i][j] = base_matrix[j][i]
 * 
 */
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_base_matrix, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_5);
    PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
    __pyx_t_5 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_t_5, 0, 0, &__pyx_v_i, NULL, NULL, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
      __pyx_t_5 = __pyx_t_3; __Pyx_INCREF(__pyx_t_5); __pyx_t_8 = 0;
      __pyx_t_9 = NULL;
    } else {
      __pyx_t_8 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 42, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __pyx_t_9 = Py_TYPE(__pyx_t_5)->tp_iternext; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 42, __pyx_L1_error)
    }
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    for (;;) {
      if (likely(!__pyx_t_9)) {
        if (likely(PyList_CheckExact(__pyx_t_5))) {
          if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_3 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 42, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        } else {
          if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_5)) break;
          #if CYTHON_COMPILING_IN_CPYTHON
          __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_8); __Pyx_INCREF(__pyx_t_3); __pyx_t_8++; if (unlikely(0 < 0)) __PYX_ERR(0, 42, __pyx_L1_error)
          #else
          __pyx_t_3 = PySequence_ITEM(__pyx_t_5, __pyx_t_8); __pyx_t_8++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error)
          __Pyx_GOTREF(__pyx_t_3);
          #endif
        }
      } else {
        __pyx_t_3 = __pyx_t_9(__pyx_t_5);
        if (unlikely(!__pyx_t_3)) {
          PyObject* exc_type = PyErr_Occurred();
          if (exc_type) {
            if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
            else __PYX_ERR(0, 42, __pyx_L1_error)
          }
          break;
        }
        __Pyx_GOTREF(__pyx_t_3);
      }
      __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_3);
      __pyx_t_3 = 0;

      /* "redis/Learning.pyx":43
 * 		for i in range(base_matrix.shape[0]):
 * 			for j in range(base_matrix.shape[0])[i:]:
 * 				base_matrix[i][j] = base_matrix[j][i]             # <<<<<<<<<<<<<<
 * 
 * 		orth_matrix = eigh(base_matrix)[1]
 */
      __pyx_t_3 = PyObject_GetItem(__pyx_v_base_matrix, __pyx_v_j); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      __pyx_t_2 = PyObject_GetItem(__pyx_t_3, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __pyx_t_3 = PyObject_GetItem(__pyx_v_base_matrix, __pyx_v_i); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_3);
      if (unlikely(PyObject_SetItem(__pyx_t_3, __pyx_v_j, __pyx_t_2) < 0)) __PYX_ERR(0, 43, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

      /* "redis/Learning.pyx":42
 * 
 * 		for i in range(base_matrix.shape[0]):
 * 			for j in range(base_matrix.shape[0])[i:]:             # <<<<<<<<<<<<<<
 * 				base_matrix[i][j] = base_matrix[j][i]
 * 
 */
    }
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;

    /* "redis/Learning.pyx":41
 * 				base_matrix[i][j] = random()
 * 
 * 		for i in range(base_matrix.shape[0]):             # <<<<<<<<<<<<<<
 * 			for j in range(base_matrix.shape[0])[i:]:
 * 				base_matrix[i][j] = base_matrix[j][i]
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "redis/Learning.pyx":45
 * 				base_matrix[i][j] = base_matrix[j][i]
 * 
 * 		orth_matrix = eigh(base_matrix)[1]             # <<<<<<<<<<<<<<
 * 		lambda_vector = np.random.random_sample((base_matrix.shape[0] ,)) * _lambda
 * 
 */
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_eigh); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_5, __pyx_v_base_matrix); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_3 = PyTuple_New(1+1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_INCREF(__pyx_v_base_matrix);
    __Pyx_GIVEREF(__pyx_v_base_matrix);
    PyTuple_SET_ITEM(__pyx_t_3, 0+1, __pyx_v_base_matrix);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 45, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  }
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_GetItemInt(__pyx_t_1, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 45, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_orth_matrix = __pyx_t_5;
  __pyx_t_5 = 0;

  /* "redis/Learning.pyx":46
 * 
 * 		orth_matrix = eigh(base_matrix)[1]
 * 		lambda_vector = np.random.random_sample((base_matrix.shape[0] ,)) * _lambda             # <<<<<<<<<<<<<<
 * 
 * 		return np.dot(np.dot(orth_matrix.T, np.diag(lambda_vector)), orth_matrix)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_random); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_random_sample); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_base_matrix, __pyx_n_s_shape); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_1))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_1, function);
    }
  }
  if (!__pyx_t_2) {
    __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __Pyx_GOTREF(__pyx_t_5);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __pyx_t_2 = NULL;
    __Pyx_GIVEREF(__pyx_t_3);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_t_3);
    __pyx_t_3 = 0;
    __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 46, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyNumber_Multiply(__pyx_t_5, __pyx_v__lambda); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 46, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_v_lambda_vector = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "redis/Learning.pyx":48
 * 		lambda_vector = np.random.random_sample((base_matrix.shape[0] ,)) * _lambda
 * 
 * 		return np.dot(np.dot(orth_matrix.T, np.diag(lambda_vector)), orth_matrix)             # <<<<<<<<<<<<<<
 * 
 * 	return np.dot(np.dot(generate_matrix(samples.shape[0], left_lambda), samples), generate_matrix(samples.shape[1], right_lambda))
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_dot); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_dot); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_orth_matrix, __pyx_n_s_T); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_11);
  __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s_diag); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_12);
  __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
  __pyx_t_11 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_12))) {
    __pyx_t_11 = PyMethod_GET_SELF(__pyx_t_12);
    if (likely(__pyx_t_11)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_12);
      __Pyx_INCREF(__pyx_t_11);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_12, function);
    }
  }
  if (!__pyx_t_11) {
    __pyx_t_10 = __Pyx_PyObject_CallOneArg(__pyx_t_12, __pyx_v_lambda_vector); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 48, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
  } else {
    __pyx_t_13 = PyTuple_New(1+1); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 48, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_13);
    __Pyx_GIVEREF(__pyx_t_11); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_11); __pyx_t_11 = NULL;
    __Pyx_INCREF(__pyx_v_lambda_vector);
    __Pyx_GIVEREF(__pyx_v_lambda_vector);
    PyTuple_SET_ITEM(__pyx_t_13, 0+1, __pyx_v_lambda_vector);
    __pyx_t_10 = __Pyx_PyObject_Call(__pyx_t_12, __pyx_t_13, NULL); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 48, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  }
  __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
  __pyx_t_12 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_12)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_12);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_13 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (__pyx_t_12) {
    __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_12); __pyx_t_12 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_6, __pyx_t_3);
  __Pyx_GIVEREF(__pyx_t_10);
  PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_6, __pyx_t_10);
  __pyx_t_3 = 0;
  __pyx_t_10 = 0;
  __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_13, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_13 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_13);
  if (__pyx_t_2) {
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_13, 0+__pyx_t_6, __pyx_t_5);
  __Pyx_INCREF(__pyx_v_orth_matrix);
  __Pyx_GIVEREF(__pyx_v_orth_matrix);
  PyTuple_SET_ITEM(__pyx_t_13, 1+__pyx_t_6, __pyx_v_orth_matrix);
  __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_13, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "redis/Learning.pyx":35
 * 
 * def generate_E(left_lambda, right_lambda, samples):
 * 	def generate_matrix(dim, _lambda):             # <<<<<<<<<<<<<<
 * 		base_matrix = np.zeros([dim, dim])
 * 		for i in range(base_matrix.shape[0]):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_XDECREF(__pyx_t_12);
  __Pyx_XDECREF(__pyx_t_13);
  __Pyx_AddTraceback("redis.Learning.generate_E.generate_matrix", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_base_matrix);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_j);
  __Pyx_XDECREF(__pyx_v_orth_matrix);
  __Pyx_XDECREF(__pyx_v_lambda_vector);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "redis/Learning.pyx":34
 * 
 * 
 * def generate_E(left_lambda, right_lambda, samples):             # <<<<<<<<<<<<<<
 * 	def generate_matrix(dim, _lambda):
 * 		base_matrix = np.zeros([dim, dim])
 */

static PyObject *__pyx_pf_5redis_8Learning_2generate_E(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_left_lambda, PyObject *__pyx_v_right_lambda, PyObject *__pyx_v_samples) {
  PyObject *__pyx_v_generate_matrix = 0;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  Py_ssize_t __pyx_t_7;
  PyObject *__pyx_t_8 = NULL;
  __Pyx_RefNannySetupContext("generate_E", 0);

  /* "redis/Learning.pyx":35
 * 
 * def generate_E(left_lambda, right_lambda, samples):
 * 	def generate_matrix(dim, _lambda):             # <<<<<<<<<<<<<<
 * 		base_matrix = np.zeros([dim, dim])
 * 		for i in range(base_matrix.shape[0]):
 */
  __pyx_t_1 = __Pyx_CyFunction_NewEx(&__pyx_mdef_5redis_8Learning_10generate_E_1generate_matrix, 0, __pyx_n_s_generate_E_locals_generate_matri, NULL, __pyx_n_s_redis_Learning, __pyx_d, ((PyObject *)__pyx_codeobj__2)); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_generate_matrix = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "redis/Learning.pyx":50
 * 		return np.dot(np.dot(orth_matrix.T, np.diag(lambda_vector)), orth_matrix)
 * 
 * 	return np.dot(np.dot(generate_matrix(samples.shape[0], left_lambda), samples), generate_matrix(samples.shape[1], right_lambda))             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dot); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_dot); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_samples, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_4, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_6);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __pyx_pf_5redis_8Learning_10generate_E_generate_matrix(__pyx_v_generate_matrix, __pyx_t_6, __pyx_v_left_lambda); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
  __pyx_t_6 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
    __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_5);
    if (likely(__pyx_t_6)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
      __Pyx_INCREF(__pyx_t_6);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_5, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_8 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  if (__pyx_t_6) {
    __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_6); __pyx_t_6 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_8, 0+__pyx_t_7, __pyx_t_4);
  __Pyx_INCREF(__pyx_v_samples);
  __Pyx_GIVEREF(__pyx_v_samples);
  PyTuple_SET_ITEM(__pyx_t_8, 1+__pyx_t_7, __pyx_v_samples);
  __pyx_t_4 = 0;
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_8, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_v_samples, __pyx_n_s_shape); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_5, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_8);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __pyx_t_5 = __pyx_pf_5redis_8Learning_10generate_E_generate_matrix(__pyx_v_generate_matrix, __pyx_t_8, __pyx_v_right_lambda); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
  __pyx_t_8 = NULL;
  __pyx_t_7 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_8)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_8);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
      __pyx_t_7 = 1;
    }
  }
  __pyx_t_4 = PyTuple_New(2+__pyx_t_7); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  if (__pyx_t_8) {
    __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_8); __pyx_t_8 = NULL;
  }
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_4, 0+__pyx_t_7, __pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_5);
  PyTuple_SET_ITEM(__pyx_t_4, 1+__pyx_t_7, __pyx_t_5);
  __pyx_t_2 = 0;
  __pyx_t_5 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 50, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "redis/Learning.pyx":34
 * 
 * 
 * def generate_E(left_lambda, right_lambda, samples):             # <<<<<<<<<<<<<<
 * 	def generate_matrix(dim, _lambda):
 * 		base_matrix = np.zeros([dim, dim])
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_AddTraceback("redis.Learning.generate_E", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_generate_matrix);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "redis/Learning.pyx":53
 * 
 * 
 * def generate_F(num_of_sample, num_of_factors, poisson_mean):             # <<<<<<<<<<<<<<
 * 	Require = np.zeros([num_of_sample, num_of_factors])
 * 	for i in range(Require.shape[0]):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5redis_8Learning_5generate_F(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5redis_8Learning_5generate_F = {"generate_F", (PyCFunction)__pyx_pw_5redis_8Learning_5generate_F, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5redis_8Learning_5generate_F(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_num_of_sample = 0;
  PyObject *__pyx_v_num_of_factors = 0;
  PyObject *__pyx_v_poisson_mean = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate_F (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_num_of_sample,&__pyx_n_s_num_of_factors,&__pyx_n_s_poisson_mean,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_of_sample)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_of_factors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_F", 1, 3, 3, 1); __PYX_ERR(0, 53, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_poisson_mean)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_F", 1, 3, 3, 2); __PYX_ERR(0, 53, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "generate_F") < 0)) __PYX_ERR(0, 53, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_num_of_sample = values[0];
    __pyx_v_num_of_factors = values[1];
    __pyx_v_poisson_mean = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate_F", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 53, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("redis.Learning.generate_F", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5redis_8Learning_4generate_F(__pyx_self, __pyx_v_num_of_sample, __pyx_v_num_of_factors, __pyx_v_poisson_mean);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5redis_8Learning_4generate_F(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num_of_sample, PyObject *__pyx_v_num_of_factors, PyObject *__pyx_v_poisson_mean) {
  PyObject *__pyx_v_Require = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("generate_F", 0);

  /* "redis/Learning.pyx":54
 * 
 * def generate_F(num_of_sample, num_of_factors, poisson_mean):
 * 	Require = np.zeros([num_of_sample, num_of_factors])             # <<<<<<<<<<<<<<
 * 	for i in range(Require.shape[0]):
 * 		Require[i,:] = multivariate_normal(poisson(poisson_mean, num_of_factors), np.eye(num_of_factors))
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_num_of_sample);
  __Pyx_GIVEREF(__pyx_v_num_of_sample);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_num_of_sample);
  __Pyx_INCREF(__pyx_v_num_of_factors);
  __Pyx_GIVEREF(__pyx_v_num_of_factors);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_num_of_factors);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 54, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_Require = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "redis/Learning.pyx":55
 * def generate_F(num_of_sample, num_of_factors, poisson_mean):
 * 	Require = np.zeros([num_of_sample, num_of_factors])
 * 	for i in range(Require.shape[0]):             # <<<<<<<<<<<<<<
 * 		Require[i,:] = multivariate_normal(poisson(poisson_mean, num_of_factors), np.eye(num_of_factors))
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_Require, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 55, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 55, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 55, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_7(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 55, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "redis/Learning.pyx":56
 * 	Require = np.zeros([num_of_sample, num_of_factors])
 * 	for i in range(Require.shape[0]):
 * 		Require[i,:] = multivariate_normal(poisson(poisson_mean, num_of_factors), np.eye(num_of_factors))             # <<<<<<<<<<<<<<
 * 
 * 	return Require
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_multivariate_normal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_poisson); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_9 = 1;
      }
    }
    __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_poisson_mean);
    __Pyx_GIVEREF(__pyx_v_poisson_mean);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_poisson_mean);
    __Pyx_INCREF(__pyx_v_num_of_factors);
    __Pyx_GIVEREF(__pyx_v_num_of_factors);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_num_of_factors);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_eye); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    if (!__pyx_t_10) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_num_of_factors); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 56, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL;
      __Pyx_INCREF(__pyx_v_num_of_factors);
      __Pyx_GIVEREF(__pyx_v_num_of_factors);
      PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_num_of_factors);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 56, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    __pyx_t_11 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_9, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_9, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_i);
    __Pyx_INCREF(__pyx_slice__3);
    __Pyx_GIVEREF(__pyx_slice__3);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_slice__3);
    if (unlikely(PyObject_SetItem(__pyx_v_Require, __pyx_t_5, __pyx_t_3) < 0)) __PYX_ERR(0, 56, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "redis/Learning.pyx":55
 * def generate_F(num_of_sample, num_of_factors, poisson_mean):
 * 	Require = np.zeros([num_of_sample, num_of_factors])
 * 	for i in range(Require.shape[0]):             # <<<<<<<<<<<<<<
 * 		Require[i,:] = multivariate_normal(poisson(poisson_mean, num_of_factors), np.eye(num_of_factors))
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "redis/Learning.pyx":58
 * 		Require[i,:] = multivariate_normal(poisson(poisson_mean, num_of_factors), np.eye(num_of_factors))
 * 
 * 	return Require             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_Require);
  __pyx_r = __pyx_v_Require;
  goto __pyx_L0;

  /* "redis/Learning.pyx":53
 * 
 * 
 * def generate_F(num_of_sample, num_of_factors, poisson_mean):             # <<<<<<<<<<<<<<
 * 	Require = np.zeros([num_of_sample, num_of_factors])
 * 	for i in range(Require.shape[0]):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("redis.Learning.generate_F", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Require);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "redis/Learning.pyx":61
 * 
 * 
 * def generate_loader(num_of_factors, dim_of_sample, poisson_mean):             # <<<<<<<<<<<<<<
 * 	Require = np.zeros([num_of_factors, dim_of_sample])
 * 	for i in range(Require.shape[0]):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5redis_8Learning_7generate_loader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5redis_8Learning_7generate_loader = {"generate_loader", (PyCFunction)__pyx_pw_5redis_8Learning_7generate_loader, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5redis_8Learning_7generate_loader(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_num_of_factors = 0;
  PyObject *__pyx_v_dim_of_sample = 0;
  PyObject *__pyx_v_poisson_mean = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate_loader (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_num_of_factors,&__pyx_n_s_dim_of_sample,&__pyx_n_s_poisson_mean,0};
    PyObject* values[3] = {0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_of_factors)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dim_of_sample)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_loader", 1, 3, 3, 1); __PYX_ERR(0, 61, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_poisson_mean)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_loader", 1, 3, 3, 2); __PYX_ERR(0, 61, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "generate_loader") < 0)) __PYX_ERR(0, 61, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 3) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
    }
    __pyx_v_num_of_factors = values[0];
    __pyx_v_dim_of_sample = values[1];
    __pyx_v_poisson_mean = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate_loader", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 61, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("redis.Learning.generate_loader", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5redis_8Learning_6generate_loader(__pyx_self, __pyx_v_num_of_factors, __pyx_v_dim_of_sample, __pyx_v_poisson_mean);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5redis_8Learning_6generate_loader(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num_of_factors, PyObject *__pyx_v_dim_of_sample, PyObject *__pyx_v_poisson_mean) {
  PyObject *__pyx_v_Require = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *(*__pyx_t_7)(PyObject *);
  PyObject *__pyx_t_8 = NULL;
  Py_ssize_t __pyx_t_9;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  __Pyx_RefNannySetupContext("generate_loader", 0);

  /* "redis/Learning.pyx":62
 * 
 * def generate_loader(num_of_factors, dim_of_sample, poisson_mean):
 * 	Require = np.zeros([num_of_factors, dim_of_sample])             # <<<<<<<<<<<<<<
 * 	for i in range(Require.shape[0]):
 * 		Require[i,:] = multivariate_normal(poisson(poisson_mean, dim_of_sample), np.eye(dim_of_sample))
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_zeros); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyList_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 62, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_INCREF(__pyx_v_num_of_factors);
  __Pyx_GIVEREF(__pyx_v_num_of_factors);
  PyList_SET_ITEM(__pyx_t_2, 0, __pyx_v_num_of_factors);
  __Pyx_INCREF(__pyx_v_dim_of_sample);
  __Pyx_GIVEREF(__pyx_v_dim_of_sample);
  PyList_SET_ITEM(__pyx_t_2, 1, __pyx_v_dim_of_sample);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_5 = PyTuple_New(1+1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 62, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_5, 0+1, __pyx_t_2);
    __pyx_t_2 = 0;
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 62, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_Require = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "redis/Learning.pyx":63
 * def generate_loader(num_of_factors, dim_of_sample, poisson_mean):
 * 	Require = np.zeros([num_of_factors, dim_of_sample])
 * 	for i in range(Require.shape[0]):             # <<<<<<<<<<<<<<
 * 		Require[i,:] = multivariate_normal(poisson(poisson_mean, dim_of_sample), np.eye(dim_of_sample))
 * 
 */
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_Require, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_3)) || PyTuple_CheckExact(__pyx_t_3)) {
    __pyx_t_1 = __pyx_t_3; __Pyx_INCREF(__pyx_t_1); __pyx_t_6 = 0;
    __pyx_t_7 = NULL;
  } else {
    __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 63, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_7 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 63, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  for (;;) {
    if (likely(!__pyx_t_7)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 63, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      } else {
        if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_3); __pyx_t_6++; if (unlikely(0 < 0)) __PYX_ERR(0, 63, __pyx_L1_error)
        #else
        __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 63, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_3);
        #endif
      }
    } else {
      __pyx_t_3 = __pyx_t_7(__pyx_t_1);
      if (unlikely(!__pyx_t_3)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 63, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_3);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_3);
    __pyx_t_3 = 0;

    /* "redis/Learning.pyx":64
 * 	Require = np.zeros([num_of_factors, dim_of_sample])
 * 	for i in range(Require.shape[0]):
 * 		Require[i,:] = multivariate_normal(poisson(poisson_mean, dim_of_sample), np.eye(dim_of_sample))             # <<<<<<<<<<<<<<
 * 
 * 	return Require
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_multivariate_normal); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_poisson); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_4);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_4, function);
        __pyx_t_9 = 1;
      }
    }
    __pyx_t_10 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_INCREF(__pyx_v_poisson_mean);
    __Pyx_GIVEREF(__pyx_v_poisson_mean);
    PyTuple_SET_ITEM(__pyx_t_10, 0+__pyx_t_9, __pyx_v_poisson_mean);
    __Pyx_INCREF(__pyx_v_dim_of_sample);
    __Pyx_GIVEREF(__pyx_v_dim_of_sample);
    PyTuple_SET_ITEM(__pyx_t_10, 1+__pyx_t_9, __pyx_v_dim_of_sample);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_10, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __pyx_t_8 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_eye); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_8))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_8);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_8);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_8, function);
      }
    }
    if (!__pyx_t_10) {
      __pyx_t_4 = __Pyx_PyObject_CallOneArg(__pyx_t_8, __pyx_v_dim_of_sample); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
    } else {
      __pyx_t_11 = PyTuple_New(1+1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_11);
      __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_10); __pyx_t_10 = NULL;
      __Pyx_INCREF(__pyx_v_dim_of_sample);
      __Pyx_GIVEREF(__pyx_v_dim_of_sample);
      PyTuple_SET_ITEM(__pyx_t_11, 0+1, __pyx_v_dim_of_sample);
      __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_8, __pyx_t_11, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 64, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    }
    __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
    __pyx_t_8 = NULL;
    __pyx_t_9 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_5))) {
      __pyx_t_8 = PyMethod_GET_SELF(__pyx_t_5);
      if (likely(__pyx_t_8)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_5);
        __Pyx_INCREF(__pyx_t_8);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_5, function);
        __pyx_t_9 = 1;
      }
    }
    __pyx_t_11 = PyTuple_New(2+__pyx_t_9); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    if (__pyx_t_8) {
      __Pyx_GIVEREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_8); __pyx_t_8 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_2);
    PyTuple_SET_ITEM(__pyx_t_11, 0+__pyx_t_9, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_4);
    PyTuple_SET_ITEM(__pyx_t_11, 1+__pyx_t_9, __pyx_t_4);
    __pyx_t_2 = 0;
    __pyx_t_4 = 0;
    __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_5, __pyx_t_11, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0;
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 64, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __Pyx_INCREF(__pyx_v_i);
    __Pyx_GIVEREF(__pyx_v_i);
    PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_i);
    __Pyx_INCREF(__pyx_slice__4);
    __Pyx_GIVEREF(__pyx_slice__4);
    PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_slice__4);
    if (unlikely(PyObject_SetItem(__pyx_v_Require, __pyx_t_5, __pyx_t_3) < 0)) __PYX_ERR(0, 64, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;

    /* "redis/Learning.pyx":63
 * def generate_loader(num_of_factors, dim_of_sample, poisson_mean):
 * 	Require = np.zeros([num_of_factors, dim_of_sample])
 * 	for i in range(Require.shape[0]):             # <<<<<<<<<<<<<<
 * 		Require[i,:] = multivariate_normal(poisson(poisson_mean, dim_of_sample), np.eye(dim_of_sample))
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "redis/Learning.pyx":66
 * 		Require[i,:] = multivariate_normal(poisson(poisson_mean, dim_of_sample), np.eye(dim_of_sample))
 * 
 * 	return Require             # <<<<<<<<<<<<<<
 * 
 * 
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_Require);
  __pyx_r = __pyx_v_Require;
  goto __pyx_L0;

  /* "redis/Learning.pyx":61
 * 
 * 
 * def generate_loader(num_of_factors, dim_of_sample, poisson_mean):             # <<<<<<<<<<<<<<
 * 	Require = np.zeros([num_of_factors, dim_of_sample])
 * 	for i in range(Require.shape[0]):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_8);
  __Pyx_XDECREF(__pyx_t_10);
  __Pyx_XDECREF(__pyx_t_11);
  __Pyx_AddTraceback("redis.Learning.generate_loader", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_Require);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "redis/Learning.pyx":69
 * 
 * 
 * def generate_X(num_of_sample, num_of_factors ,dim_of_sample , lambda_for_F, lambda_for_loader, \             # <<<<<<<<<<<<<<
 * 				left_lambda, right_lambda, disp = True):
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5redis_8Learning_9generate_X(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5redis_8Learning_9generate_X = {"generate_X", (PyCFunction)__pyx_pw_5redis_8Learning_9generate_X, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5redis_8Learning_9generate_X(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_num_of_sample = 0;
  PyObject *__pyx_v_num_of_factors = 0;
  PyObject *__pyx_v_dim_of_sample = 0;
  PyObject *__pyx_v_lambda_for_F = 0;
  PyObject *__pyx_v_lambda_for_loader = 0;
  PyObject *__pyx_v_left_lambda = 0;
  PyObject *__pyx_v_right_lambda = 0;
  PyObject *__pyx_v_disp = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate_X (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_num_of_sample,&__pyx_n_s_num_of_factors,&__pyx_n_s_dim_of_sample,&__pyx_n_s_lambda_for_F,&__pyx_n_s_lambda_for_loader,&__pyx_n_s_left_lambda,&__pyx_n_s_right_lambda,&__pyx_n_s_disp,0};
    PyObject* values[8] = {0,0,0,0,0,0,0,0};

    /* "redis/Learning.pyx":70
 * 
 * def generate_X(num_of_sample, num_of_factors ,dim_of_sample , lambda_for_F, lambda_for_loader, \
 * 				left_lambda, right_lambda, disp = True):             # <<<<<<<<<<<<<<
 * 
 * 	E = generate_E(left_lambda, right_lambda, generate_sample(num_of_sample, dim_of_sample))
 */
    values[7] = ((PyObject *)Py_True);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_of_sample)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_num_of_factors)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_X", 0, 7, 8, 1); __PYX_ERR(0, 69, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_dim_of_sample)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_X", 0, 7, 8, 2); __PYX_ERR(0, 69, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lambda_for_F)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_X", 0, 7, 8, 3); __PYX_ERR(0, 69, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_lambda_for_loader)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_X", 0, 7, 8, 4); __PYX_ERR(0, 69, __pyx_L3_error)
        }
        case  5:
        if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_left_lambda)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_X", 0, 7, 8, 5); __PYX_ERR(0, 69, __pyx_L3_error)
        }
        case  6:
        if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_right_lambda)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_X", 0, 7, 8, 6); __PYX_ERR(0, 69, __pyx_L3_error)
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_disp);
          if (value) { values[7] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "generate_X") < 0)) __PYX_ERR(0, 69, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_num_of_sample = values[0];
    __pyx_v_num_of_factors = values[1];
    __pyx_v_dim_of_sample = values[2];
    __pyx_v_lambda_for_F = values[3];
    __pyx_v_lambda_for_loader = values[4];
    __pyx_v_left_lambda = values[5];
    __pyx_v_right_lambda = values[6];
    __pyx_v_disp = values[7];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate_X", 0, 7, 8, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 69, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("redis.Learning.generate_X", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5redis_8Learning_8generate_X(__pyx_self, __pyx_v_num_of_sample, __pyx_v_num_of_factors, __pyx_v_dim_of_sample, __pyx_v_lambda_for_F, __pyx_v_lambda_for_loader, __pyx_v_left_lambda, __pyx_v_right_lambda, __pyx_v_disp);

  /* "redis/Learning.pyx":69
 * 
 * 
 * def generate_X(num_of_sample, num_of_factors ,dim_of_sample , lambda_for_F, lambda_for_loader, \             # <<<<<<<<<<<<<<
 * 				left_lambda, right_lambda, disp = True):
 * 
 */

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5redis_8Learning_8generate_X(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_num_of_sample, PyObject *__pyx_v_num_of_factors, PyObject *__pyx_v_dim_of_sample, PyObject *__pyx_v_lambda_for_F, PyObject *__pyx_v_lambda_for_loader, PyObject *__pyx_v_left_lambda, PyObject *__pyx_v_right_lambda, PyObject *__pyx_v_disp) {
  PyObject *__pyx_v_E = NULL;
  PyObject *__pyx_v_F = NULL;
  PyObject *__pyx_v_loader = NULL;
  PyObject *__pyx_v_Main_Part = NULL;
  PyObject *__pyx_v_X = NULL;
  PyObject *__pyx_v_norm_from_Main = NULL;
  PyObject *__pyx_v_X_first = NULL;
  PyObject *__pyx_v_E_first = NULL;
  PyObject *__pyx_v_Main_Part_first = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  PyObject *__pyx_t_5 = NULL;
  Py_ssize_t __pyx_t_6;
  PyObject *__pyx_t_7 = NULL;
  int __pyx_t_8;
  __Pyx_RefNannySetupContext("generate_X", 0);

  /* "redis/Learning.pyx":72
 * 				left_lambda, right_lambda, disp = True):
 * 
 * 	E = generate_E(left_lambda, right_lambda, generate_sample(num_of_sample, dim_of_sample))             # <<<<<<<<<<<<<<
 * 	F = generate_F(num_of_sample, num_of_factors, lambda_for_F)
 * 	loader = generate_loader(num_of_factors, dim_of_sample, lambda_for_loader)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_generate_E); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_generate_sample); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_5 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_4))) {
    __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_4);
    if (likely(__pyx_t_5)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_4);
      __Pyx_INCREF(__pyx_t_5);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_4, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_5) {
    __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_5); __pyx_t_5 = NULL;
  }
  __Pyx_INCREF(__pyx_v_num_of_sample);
  __Pyx_GIVEREF(__pyx_v_num_of_sample);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_num_of_sample);
  __Pyx_INCREF(__pyx_v_dim_of_sample);
  __Pyx_GIVEREF(__pyx_v_dim_of_sample);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_dim_of_sample);
  __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_4) {
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_4); __pyx_t_4 = NULL;
  }
  __Pyx_INCREF(__pyx_v_left_lambda);
  __Pyx_GIVEREF(__pyx_v_left_lambda);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_left_lambda);
  __Pyx_INCREF(__pyx_v_right_lambda);
  __Pyx_GIVEREF(__pyx_v_right_lambda);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_right_lambda);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 72, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_E = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "redis/Learning.pyx":73
 * 
 * 	E = generate_E(left_lambda, right_lambda, generate_sample(num_of_sample, dim_of_sample))
 * 	F = generate_F(num_of_sample, num_of_factors, lambda_for_F)             # <<<<<<<<<<<<<<
 * 	loader = generate_loader(num_of_factors, dim_of_sample, lambda_for_loader)
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_generate_F); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_3 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_7) {
    __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_7); __pyx_t_7 = NULL;
  }
  __Pyx_INCREF(__pyx_v_num_of_sample);
  __Pyx_GIVEREF(__pyx_v_num_of_sample);
  PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_num_of_sample);
  __Pyx_INCREF(__pyx_v_num_of_factors);
  __Pyx_GIVEREF(__pyx_v_num_of_factors);
  PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_num_of_factors);
  __Pyx_INCREF(__pyx_v_lambda_for_F);
  __Pyx_GIVEREF(__pyx_v_lambda_for_F);
  PyTuple_SET_ITEM(__pyx_t_3, 2+__pyx_t_6, __pyx_v_lambda_for_F);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 73, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_F = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "redis/Learning.pyx":74
 * 	E = generate_E(left_lambda, right_lambda, generate_sample(num_of_sample, dim_of_sample))
 * 	F = generate_F(num_of_sample, num_of_factors, lambda_for_F)
 * 	loader = generate_loader(num_of_factors, dim_of_sample, lambda_for_loader)             # <<<<<<<<<<<<<<
 * 
 * 	Main_Part = np.dot(F, loader)
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_generate_loader); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_7 = PyTuple_New(3+__pyx_t_6); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_v_num_of_factors);
  __Pyx_GIVEREF(__pyx_v_num_of_factors);
  PyTuple_SET_ITEM(__pyx_t_7, 0+__pyx_t_6, __pyx_v_num_of_factors);
  __Pyx_INCREF(__pyx_v_dim_of_sample);
  __Pyx_GIVEREF(__pyx_v_dim_of_sample);
  PyTuple_SET_ITEM(__pyx_t_7, 1+__pyx_t_6, __pyx_v_dim_of_sample);
  __Pyx_INCREF(__pyx_v_lambda_for_loader);
  __Pyx_GIVEREF(__pyx_v_lambda_for_loader);
  PyTuple_SET_ITEM(__pyx_t_7, 2+__pyx_t_6, __pyx_v_lambda_for_loader);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_7, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 74, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_v_loader = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "redis/Learning.pyx":76
 * 	loader = generate_loader(num_of_factors, dim_of_sample, lambda_for_loader)
 * 
 * 	Main_Part = np.dot(F, loader)             # <<<<<<<<<<<<<<
 * 	X = Main_Part + E
 * 
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_dot); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = NULL;
  __pyx_t_6 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_2)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_2);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
      __pyx_t_6 = 1;
    }
  }
  __pyx_t_3 = PyTuple_New(2+__pyx_t_6); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (__pyx_t_2) {
    __Pyx_GIVEREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __pyx_t_2 = NULL;
  }
  __Pyx_INCREF(__pyx_v_F);
  __Pyx_GIVEREF(__pyx_v_F);
  PyTuple_SET_ITEM(__pyx_t_3, 0+__pyx_t_6, __pyx_v_F);
  __Pyx_INCREF(__pyx_v_loader);
  __Pyx_GIVEREF(__pyx_v_loader);
  PyTuple_SET_ITEM(__pyx_t_3, 1+__pyx_t_6, __pyx_v_loader);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 76, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_Main_Part = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "redis/Learning.pyx":77
 * 
 * 	Main_Part = np.dot(F, loader)
 * 	X = Main_Part + E             # <<<<<<<<<<<<<<
 * 
 * 	norm_from_Main = norm(Main_Part) / norm(X)
 */
  __pyx_t_1 = PyNumber_Add(__pyx_v_Main_Part, __pyx_v_E); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 77, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_X = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "redis/Learning.pyx":79
 * 	X = Main_Part + E
 * 
 * 	norm_from_Main = norm(Main_Part) / norm(X)             # <<<<<<<<<<<<<<
 * 
 * 	if disp:
 */
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_norm); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_7);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_7, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_Main_Part); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_Main_Part);
    __Pyx_GIVEREF(__pyx_v_Main_Part);
    PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_Main_Part);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_norm); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (!__pyx_t_3) {
    __pyx_t_7 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_v_X); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
  } else {
    __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __pyx_t_3 = NULL;
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_X);
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 79, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_7); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 79, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_v_norm_from_Main = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "redis/Learning.pyx":81
 * 	norm_from_Main = norm(Main_Part) / norm(X)
 * 
 * 	if disp:             # <<<<<<<<<<<<<<
 * 		X_first = svd(X)[1][0]
 * 		E_first = svd(E)[1][0]
 */
  __pyx_t_8 = __Pyx_PyObject_IsTrue(__pyx_v_disp); if (unlikely(__pyx_t_8 < 0)) __PYX_ERR(0, 81, __pyx_L1_error)
  if (__pyx_t_8) {

    /* "redis/Learning.pyx":82
 * 
 * 	if disp:
 * 		X_first = svd(X)[1][0]             # <<<<<<<<<<<<<<
 * 		E_first = svd(E)[1][0]
 * 		Main_Part_first = svd(Main_Part)[1][0]
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_svd); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_X); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 82, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_INCREF(__pyx_v_X);
      __Pyx_GIVEREF(__pyx_v_X);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_X);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 82, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_X_first = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "redis/Learning.pyx":83
 * 	if disp:
 * 		X_first = svd(X)[1][0]
 * 		E_first = svd(E)[1][0]             # <<<<<<<<<<<<<<
 * 		Main_Part_first = svd(Main_Part)[1][0]
 * 
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_svd); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_4 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_4)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_4);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_4) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_E); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 83, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_1);
      __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
      __Pyx_INCREF(__pyx_v_E);
      __Pyx_GIVEREF(__pyx_v_E);
      PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_E);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 83, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 83, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_E_first = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "redis/Learning.pyx":84
 * 		X_first = svd(X)[1][0]
 * 		E_first = svd(E)[1][0]
 * 		Main_Part_first = svd(Main_Part)[1][0]             # <<<<<<<<<<<<<<
 * 
 * 		print
 */
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_svd); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_1 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_1 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_1)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_1);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_1) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_v_Main_Part); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
    } else {
      __pyx_t_4 = PyTuple_New(1+1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_4);
      __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __pyx_t_1 = NULL;
      __Pyx_INCREF(__pyx_v_Main_Part);
      __Pyx_GIVEREF(__pyx_v_Main_Part);
      PyTuple_SET_ITEM(__pyx_t_4, 0+1, __pyx_v_Main_Part);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_4, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_7, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 84, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_v_Main_Part_first = __pyx_t_2;
    __pyx_t_2 = 0;

    /* "redis/Learning.pyx":86
 * 		Main_Part_first = svd(Main_Part)[1][0]
 * 
 * 		print             # <<<<<<<<<<<<<<
 * 		print "the largest eigen_v of X :"
 * 		print X_first
 */
    if (__Pyx_Print(0, __pyx_empty_tuple, 1) < 0) __PYX_ERR(0, 86, __pyx_L1_error)

    /* "redis/Learning.pyx":87
 * 
 * 		print
 * 		print "the largest eigen_v of X :"             # <<<<<<<<<<<<<<
 * 		print X_first
 * 		print "the largest eigen_v of Main_Part :"
 */
    if (__Pyx_PrintOne(0, __pyx_kp_s_the_largest_eigen_v_of_X) < 0) __PYX_ERR(0, 87, __pyx_L1_error)

    /* "redis/Learning.pyx":88
 * 		print
 * 		print "the largest eigen_v of X :"
 * 		print X_first             # <<<<<<<<<<<<<<
 * 		print "the largest eigen_v of Main_Part :"
 * 		print Main_Part_first
 */
    if (__Pyx_PrintOne(0, __pyx_v_X_first) < 0) __PYX_ERR(0, 88, __pyx_L1_error)

    /* "redis/Learning.pyx":89
 * 		print "the largest eigen_v of X :"
 * 		print X_first
 * 		print "the largest eigen_v of Main_Part :"             # <<<<<<<<<<<<<<
 * 		print Main_Part_first
 * 		print "the largest eigen_v of E :"
 */
    if (__Pyx_PrintOne(0, __pyx_kp_s_the_largest_eigen_v_of_Main_Part) < 0) __PYX_ERR(0, 89, __pyx_L1_error)

    /* "redis/Learning.pyx":90
 * 		print X_first
 * 		print "the largest eigen_v of Main_Part :"
 * 		print Main_Part_first             # <<<<<<<<<<<<<<
 * 		print "the largest eigen_v of E :"
 * 		print E_first
 */
    if (__Pyx_PrintOne(0, __pyx_v_Main_Part_first) < 0) __PYX_ERR(0, 90, __pyx_L1_error)

    /* "redis/Learning.pyx":91
 * 		print "the largest eigen_v of Main_Part :"
 * 		print Main_Part_first
 * 		print "the largest eigen_v of E :"             # <<<<<<<<<<<<<<
 * 		print E_first
 * 		print "the ratio of E and Main_Part in the largest eigen_v :"
 */
    if (__Pyx_PrintOne(0, __pyx_kp_s_the_largest_eigen_v_of_E) < 0) __PYX_ERR(0, 91, __pyx_L1_error)

    /* "redis/Learning.pyx":92
 * 		print Main_Part_first
 * 		print "the largest eigen_v of E :"
 * 		print E_first             # <<<<<<<<<<<<<<
 * 		print "the ratio of E and Main_Part in the largest eigen_v :"
 * 		print E_first / Main_Part_first
 */
    if (__Pyx_PrintOne(0, __pyx_v_E_first) < 0) __PYX_ERR(0, 92, __pyx_L1_error)

    /* "redis/Learning.pyx":93
 * 		print "the largest eigen_v of E :"
 * 		print E_first
 * 		print "the ratio of E and Main_Part in the largest eigen_v :"             # <<<<<<<<<<<<<<
 * 		print E_first / Main_Part_first
 * 
 */
    if (__Pyx_PrintOne(0, __pyx_kp_s_the_ratio_of_E_and_Main_Part_in) < 0) __PYX_ERR(0, 93, __pyx_L1_error)

    /* "redis/Learning.pyx":94
 * 		print E_first
 * 		print "the ratio of E and Main_Part in the largest eigen_v :"
 * 		print E_first / Main_Part_first             # <<<<<<<<<<<<<<
 * 
 * 		print "norm from Main_Part :"
 */
    __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_E_first, __pyx_v_Main_Part_first); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 94, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PrintOne(0, __pyx_t_2) < 0) __PYX_ERR(0, 94, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "redis/Learning.pyx":96
 * 		print E_first / Main_Part_first
 * 
 * 		print "norm from Main_Part :"             # <<<<<<<<<<<<<<
 * 		print norm_from_Main
 * 		print "norm from E :"
 */
    if (__Pyx_PrintOne(0, __pyx_kp_s_norm_from_Main_Part) < 0) __PYX_ERR(0, 96, __pyx_L1_error)

    /* "redis/Learning.pyx":97
 * 
 * 		print "norm from Main_Part :"
 * 		print norm_from_Main             # <<<<<<<<<<<<<<
 * 		print "norm from E :"
 * 		print 1 - norm_from_Main
 */
    if (__Pyx_PrintOne(0, __pyx_v_norm_from_Main) < 0) __PYX_ERR(0, 97, __pyx_L1_error)

    /* "redis/Learning.pyx":98
 * 		print "norm from Main_Part :"
 * 		print norm_from_Main
 * 		print "norm from E :"             # <<<<<<<<<<<<<<
 * 		print 1 - norm_from_Main
 * 		print
 */
    if (__Pyx_PrintOne(0, __pyx_kp_s_norm_from_E) < 0) __PYX_ERR(0, 98, __pyx_L1_error)

    /* "redis/Learning.pyx":99
 * 		print norm_from_Main
 * 		print "norm from E :"
 * 		print 1 - norm_from_Main             # <<<<<<<<<<<<<<
 * 		print
 * 
 */
    __pyx_t_2 = __Pyx_PyInt_SubtractCObj(__pyx_int_1, __pyx_v_norm_from_Main, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PrintOne(0, __pyx_t_2) < 0) __PYX_ERR(0, 99, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "redis/Learning.pyx":100
 * 		print "norm from E :"
 * 		print 1 - norm_from_Main
 * 		print             # <<<<<<<<<<<<<<
 * 
 * 	return (X, 1 - norm_from_Main)
 */
    if (__Pyx_Print(0, __pyx_empty_tuple, 1) < 0) __PYX_ERR(0, 100, __pyx_L1_error)

    /* "redis/Learning.pyx":81
 * 	norm_from_Main = norm(Main_Part) / norm(X)
 * 
 * 	if disp:             # <<<<<<<<<<<<<<
 * 		X_first = svd(X)[1][0]
 * 		E_first = svd(E)[1][0]
 */
  }

  /* "redis/Learning.pyx":102
 * 		print
 * 
 * 	return (X, 1 - norm_from_Main)             # <<<<<<<<<<<<<<
 * 
 * def projected_and_eigen(X, eps = 0.5, disp = False):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_2 = __Pyx_PyInt_SubtractCObj(__pyx_int_1, __pyx_v_norm_from_Main, 1, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_7 = PyTuple_New(2); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 102, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __Pyx_INCREF(__pyx_v_X);
  __Pyx_GIVEREF(__pyx_v_X);
  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_X);
  __Pyx_GIVEREF(__pyx_t_2);
  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_2);
  __pyx_t_2 = 0;
  __pyx_r = __pyx_t_7;
  __pyx_t_7 = 0;
  goto __pyx_L0;

  /* "redis/Learning.pyx":69
 * 
 * 
 * def generate_X(num_of_sample, num_of_factors ,dim_of_sample , lambda_for_F, lambda_for_loader, \             # <<<<<<<<<<<<<<
 * 				left_lambda, right_lambda, disp = True):
 * 
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_AddTraceback("redis.Learning.generate_X", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_E);
  __Pyx_XDECREF(__pyx_v_F);
  __Pyx_XDECREF(__pyx_v_loader);
  __Pyx_XDECREF(__pyx_v_Main_Part);
  __Pyx_XDECREF(__pyx_v_X);
  __Pyx_XDECREF(__pyx_v_norm_from_Main);
  __Pyx_XDECREF(__pyx_v_X_first);
  __Pyx_XDECREF(__pyx_v_E_first);
  __Pyx_XDECREF(__pyx_v_Main_Part_first);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "redis/Learning.pyx":104
 * 	return (X, 1 - norm_from_Main)
 * 
 * def projected_and_eigen(X, eps = 0.5, disp = False):             # <<<<<<<<<<<<<<
 * 	min_n_components = johnson_lindenstrauss_min_dim(X.shape[0], eps = eps)
 * 	n_components = min_n_components
 */

/* Python wrapper */
static PyObject *__pyx_pw_5redis_8Learning_11projected_and_eigen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5redis_8Learning_11projected_and_eigen = {"projected_and_eigen", (PyCFunction)__pyx_pw_5redis_8Learning_11projected_and_eigen, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5redis_8Learning_11projected_and_eigen(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_eps = 0;
  PyObject *__pyx_v_disp = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("projected_and_eigen (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_X,&__pyx_n_s_eps,&__pyx_n_s_disp,0};
    PyObject* values[3] = {0,0,0};
    values[1] = ((PyObject *)__pyx_float_0_5);
    values[2] = ((PyObject *)Py_False);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_eps);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_disp);
          if (value) { values[2] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "projected_and_eigen") < 0)) __PYX_ERR(0, 104, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_X = values[0];
    __pyx_v_eps = values[1];
    __pyx_v_disp = values[2];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("projected_and_eigen", 0, 1, 3, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 104, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("redis.Learning.projected_and_eigen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5redis_8Learning_10projected_and_eigen(__pyx_self, __pyx_v_X, __pyx_v_eps, __pyx_v_disp);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5redis_8Learning_10projected_and_eigen(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_eps, PyObject *__pyx_v_disp) {
  PyObject *__pyx_v_min_n_components = NULL;
  PyObject *__pyx_v_n_components = NULL;
  PyObject *__pyx_v_rp = NULL;
  PyObject *__pyx_v_projected_X = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  int __pyx_t_5;
  __Pyx_RefNannySetupContext("projected_and_eigen", 0);

  /* "redis/Learning.pyx":105
 * 
 * def projected_and_eigen(X, eps = 0.5, disp = False):
 * 	min_n_components = johnson_lindenstrauss_min_dim(X.shape[0], eps = eps)             # <<<<<<<<<<<<<<
 * 	n_components = min_n_components
 * 	rp = SparseRandomProjection(n_components = n_components)
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_johnson_lindenstrauss_min_dim); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_X, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_GIVEREF(__pyx_t_3);
  PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3);
  __pyx_t_3 = 0;
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_eps, __pyx_v_eps) < 0) __PYX_ERR(0, 105, __pyx_L1_error)
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 105, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_min_n_components = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "redis/Learning.pyx":106
 * def projected_and_eigen(X, eps = 0.5, disp = False):
 * 	min_n_components = johnson_lindenstrauss_min_dim(X.shape[0], eps = eps)
 * 	n_components = min_n_components             # <<<<<<<<<<<<<<
 * 	rp = SparseRandomProjection(n_components = n_components)
 * 	projected_X = rp.fit_transform(X)
 */
  __Pyx_INCREF(__pyx_v_min_n_components);
  __pyx_v_n_components = __pyx_v_min_n_components;

  /* "redis/Learning.pyx":107
 * 	min_n_components = johnson_lindenstrauss_min_dim(X.shape[0], eps = eps)
 * 	n_components = min_n_components
 * 	rp = SparseRandomProjection(n_components = n_components)             # <<<<<<<<<<<<<<
 * 	projected_X = rp.fit_transform(X)
 * 	if disp:
 */
  __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s_SparseRandomProjection); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  if (PyDict_SetItem(__pyx_t_3, __pyx_n_s_n_components, __pyx_v_n_components) < 0) __PYX_ERR(0, 107, __pyx_L1_error)
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_4, __pyx_empty_tuple, __pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 107, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_rp = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "redis/Learning.pyx":108
 * 	n_components = min_n_components
 * 	rp = SparseRandomProjection(n_components = n_components)
 * 	projected_X = rp.fit_transform(X)             # <<<<<<<<<<<<<<
 * 	if disp:
 * 		print "The shape of X :"
 */
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_rp, __pyx_n_s_fit_transform); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 108, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_3);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_3, function);
    }
  }
  if (!__pyx_t_4) {
    __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_v_X); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
  } else {
    __pyx_t_1 = PyTuple_New(1+1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_GIVEREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); __pyx_t_4 = NULL;
    __Pyx_INCREF(__pyx_v_X);
    __Pyx_GIVEREF(__pyx_v_X);
    PyTuple_SET_ITEM(__pyx_t_1, 0+1, __pyx_v_X);
    __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 108, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  }
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  __pyx_v_projected_X = __pyx_t_2;
  __pyx_t_2 = 0;

  /* "redis/Learning.pyx":109
 * 	rp = SparseRandomProjection(n_components = n_components)
 * 	projected_X = rp.fit_transform(X)
 * 	if disp:             # <<<<<<<<<<<<<<
 * 		print "The shape of X :"
 * 		print X.shape
 */
  __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_disp); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 109, __pyx_L1_error)
  if (__pyx_t_5) {

    /* "redis/Learning.pyx":110
 * 	projected_X = rp.fit_transform(X)
 * 	if disp:
 * 		print "The shape of X :"             # <<<<<<<<<<<<<<
 * 		print X.shape
 * 		print "The shape of projected_X :"
 */
    if (__Pyx_PrintOne(0, __pyx_kp_s_The_shape_of_X) < 0) __PYX_ERR(0, 110, __pyx_L1_error)

    /* "redis/Learning.pyx":111
 * 	if disp:
 * 		print "The shape of X :"
 * 		print X.shape             # <<<<<<<<<<<<<<
 * 		print "The shape of projected_X :"
 * 		print projected_X.shape
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_X, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 111, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PrintOne(0, __pyx_t_2) < 0) __PYX_ERR(0, 111, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "redis/Learning.pyx":112
 * 		print "The shape of X :"
 * 		print X.shape
 * 		print "The shape of projected_X :"             # <<<<<<<<<<<<<<
 * 		print projected_X.shape
 * 
 */
    if (__Pyx_PrintOne(0, __pyx_kp_s_The_shape_of_projected_X) < 0) __PYX_ERR(0, 112, __pyx_L1_error)

    /* "redis/Learning.pyx":113
 * 		print X.shape
 * 		print "The shape of projected_X :"
 * 		print projected_X.shape             # <<<<<<<<<<<<<<
 * 
 * 	return projected_X
 */
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_projected_X, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 113, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    if (__Pyx_PrintOne(0, __pyx_t_2) < 0) __PYX_ERR(0, 113, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;

    /* "redis/Learning.pyx":109
 * 	rp = SparseRandomProjection(n_components = n_components)
 * 	projected_X = rp.fit_transform(X)
 * 	if disp:             # <<<<<<<<<<<<<<
 * 		print "The shape of X :"
 * 		print X.shape
 */
  }

  /* "redis/Learning.pyx":115
 * 		print projected_X.shape
 * 
 * 	return projected_X             # <<<<<<<<<<<<<<
 * 
 * ##################################################################################################
 */
  __Pyx_XDECREF(__pyx_r);
  __Pyx_INCREF(__pyx_v_projected_X);
  __pyx_r = __pyx_v_projected_X;
  goto __pyx_L0;

  /* "redis/Learning.pyx":104
 * 	return (X, 1 - norm_from_Main)
 * 
 * def projected_and_eigen(X, eps = 0.5, disp = False):             # <<<<<<<<<<<<<<
 * 	min_n_components = johnson_lindenstrauss_min_dim(X.shape[0], eps = eps)
 * 	n_components = min_n_components
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("redis.Learning.projected_and_eigen", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_min_n_components);
  __Pyx_XDECREF(__pyx_v_n_components);
  __Pyx_XDECREF(__pyx_v_rp);
  __Pyx_XDECREF(__pyx_v_projected_X);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "redis/Learning.pyx":119
 * ##################################################################################################
 * 
 * def generate_bagging_sample_index(X, sample_num, sample_size, random_split, begin_index):             # <<<<<<<<<<<<<<
 * 	ListRequire = []
 * 	for i in range(sample_num):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5redis_8Learning_13generate_bagging_sample_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5redis_8Learning_13generate_bagging_sample_index = {"generate_bagging_sample_index", (PyCFunction)__pyx_pw_5redis_8Learning_13generate_bagging_sample_index, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5redis_8Learning_13generate_bagging_sample_index(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_sample_num = 0;
  PyObject *__pyx_v_sample_size = 0;
  PyObject *__pyx_v_random_split = 0;
  PyObject *__pyx_v_begin_index = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate_bagging_sample_index (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_X,&__pyx_n_s_sample_num,&__pyx_n_s_sample_size,&__pyx_n_s_random_split,&__pyx_n_s_begin_index,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sample_num)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_bagging_sample_index", 1, 5, 5, 1); __PYX_ERR(0, 119, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sample_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_bagging_sample_index", 1, 5, 5, 2); __PYX_ERR(0, 119, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_random_split)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_bagging_sample_index", 1, 5, 5, 3); __PYX_ERR(0, 119, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_begin_index)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_bagging_sample_index", 1, 5, 5, 4); __PYX_ERR(0, 119, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "generate_bagging_sample_index") < 0)) __PYX_ERR(0, 119, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_X = values[0];
    __pyx_v_sample_num = values[1];
    __pyx_v_sample_size = values[2];
    __pyx_v_random_split = values[3];
    __pyx_v_begin_index = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate_bagging_sample_index", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 119, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("redis.Learning.generate_bagging_sample_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5redis_8Learning_12generate_bagging_sample_index(__pyx_self, __pyx_v_X, __pyx_v_sample_num, __pyx_v_sample_size, __pyx_v_random_split, __pyx_v_begin_index);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5redis_8Learning_12generate_bagging_sample_index(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_sample_num, PyObject *__pyx_v_sample_size, PyObject *__pyx_v_random_split, PyObject *__pyx_v_begin_index) {
  PyObject *__pyx_v_ListRequire = NULL;
  CYTHON_UNUSED PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_size = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  int __pyx_t_5;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  Py_ssize_t __pyx_t_8;
  PyObject *__pyx_t_9 = NULL;
  int __pyx_t_10;
  __Pyx_RefNannySetupContext("generate_bagging_sample_index", 0);

  /* "redis/Learning.pyx":120
 * 
 * def generate_bagging_sample_index(X, sample_num, sample_size, random_split, begin_index):
 * 	ListRequire = []             # <<<<<<<<<<<<<<
 * 	for i in range(sample_num):
 * 
 */
  __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 120, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_v_ListRequire = ((PyObject*)__pyx_t_1);
  __pyx_t_1 = 0;

  /* "redis/Learning.pyx":121
 * def generate_bagging_sample_index(X, sample_num, sample_size, random_split, begin_index):
 * 	ListRequire = []
 * 	for i in range(sample_num):             # <<<<<<<<<<<<<<
 * 
 * 		if random_split:
 */
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_v_sample_num);
  __Pyx_GIVEREF(__pyx_v_sample_num);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_sample_num);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 121, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 121, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 121, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 121, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 121, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 121, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "redis/Learning.pyx":123
 * 	for i in range(sample_num):
 * 
 * 		if random_split:             # <<<<<<<<<<<<<<
 * 			size = np.random.randint(begin_index, sample_size, 1)[0]
 * 		else:
 */
    __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_random_split); if (unlikely(__pyx_t_5 < 0)) __PYX_ERR(0, 123, __pyx_L1_error)
    if (__pyx_t_5) {

      /* "redis/Learning.pyx":124
 * 
 * 		if random_split:
 * 			size = np.random.randint(begin_index, sample_size, 1)[0]             # <<<<<<<<<<<<<<
 * 		else:
 * 			size = sample_size
 */
      __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_random); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_7);
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_randint); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
      __pyx_t_7 = NULL;
      __pyx_t_8 = 0;
      if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_6))) {
        __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_6);
        if (likely(__pyx_t_7)) {
          PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_6);
          __Pyx_INCREF(__pyx_t_7);
          __Pyx_INCREF(function);
          __Pyx_DECREF_SET(__pyx_t_6, function);
          __pyx_t_8 = 1;
        }
      }
      __pyx_t_9 = PyTuple_New(3+__pyx_t_8); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_9);
      if (__pyx_t_7) {
        __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __pyx_t_7 = NULL;
      }
      __Pyx_INCREF(__pyx_v_begin_index);
      __Pyx_GIVEREF(__pyx_v_begin_index);
      PyTuple_SET_ITEM(__pyx_t_9, 0+__pyx_t_8, __pyx_v_begin_index);
      __Pyx_INCREF(__pyx_v_sample_size);
      __Pyx_GIVEREF(__pyx_v_sample_size);
      PyTuple_SET_ITEM(__pyx_t_9, 1+__pyx_t_8, __pyx_v_sample_size);
      __Pyx_INCREF(__pyx_int_1);
      __Pyx_GIVEREF(__pyx_int_1);
      PyTuple_SET_ITEM(__pyx_t_9, 2+__pyx_t_8, __pyx_int_1);
      __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_9, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_2);
      __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
      __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
      __pyx_t_6 = __Pyx_GetItemInt(__pyx_t_2, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 124, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_6);
      __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
      __Pyx_XDECREF_SET(__pyx_v_size, __pyx_t_6);
      __pyx_t_6 = 0;

      /* "redis/Learning.pyx":123
 * 	for i in range(sample_num):
 * 
 * 		if random_split:             # <<<<<<<<<<<<<<
 * 			size = np.random.randint(begin_index, sample_size, 1)[0]
 * 		else:
 */
      goto __pyx_L5;
    }

    /* "redis/Learning.pyx":126
 * 			size = np.random.randint(begin_index, sample_size, 1)[0]
 * 		else:
 * 			size = sample_size             # <<<<<<<<<<<<<<
 * 
 * 		ListRequire.append(np.random.randint(X.shape[1], size = size))
 */
    /*else*/ {
      __Pyx_INCREF(__pyx_v_sample_size);
      __Pyx_XDECREF_SET(__pyx_v_size, __pyx_v_sample_size);
    }
    __pyx_L5:;

    /* "redis/Learning.pyx":128
 * 			size = sample_size
 * 
 * 		ListRequire.append(np.random.randint(X.shape[1], size = size))             # <<<<<<<<<<<<<<
 * 
 * 	return np.array(ListRequire)
 */
    __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_random); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_randint); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_X, __pyx_n_s_shape); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_2, 1, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_9);
    __pyx_t_9 = 0;
    __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    if (PyDict_SetItem(__pyx_t_9, __pyx_n_s_size, __pyx_v_size) < 0) __PYX_ERR(0, 128, __pyx_L1_error)
    __pyx_t_7 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_t_2, __pyx_t_9); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0;
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_ListRequire, __pyx_t_7); if (unlikely(__pyx_t_10 == -1)) __PYX_ERR(0, 128, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;

    /* "redis/Learning.pyx":121
 * def generate_bagging_sample_index(X, sample_num, sample_size, random_split, begin_index):
 * 	ListRequire = []
 * 	for i in range(sample_num):             # <<<<<<<<<<<<<<
 * 
 * 		if random_split:
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "redis/Learning.pyx":130
 * 		ListRequire.append(np.random.randint(X.shape[1], size = size))
 * 
 * 	return np.array(ListRequire)             # <<<<<<<<<<<<<<
 * 
 * def generate_bagging_sample_array(X, sample_num, sample_size, random_split, begin_index):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_7);
  __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_array); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 130, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_9);
  __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
  __pyx_t_7 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_9))) {
    __pyx_t_7 = PyMethod_GET_SELF(__pyx_t_9);
    if (likely(__pyx_t_7)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_9);
      __Pyx_INCREF(__pyx_t_7);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_9, function);
    }
  }
  if (!__pyx_t_7) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_9, __pyx_v_ListRequire); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
  } else {
    __pyx_t_2 = PyTuple_New(1+1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 130, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_7); __pyx_t_7 = NULL;
    __Pyx_INCREF(__pyx_v_ListRequire);
    __Pyx_GIVEREF(__pyx_v_ListRequire);
    PyTuple_SET_ITEM(__pyx_t_2, 0+1, __pyx_v_ListRequire);
    __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_9, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 130, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  }
  __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "redis/Learning.pyx":119
 * ##################################################################################################
 * 
 * def generate_bagging_sample_index(X, sample_num, sample_size, random_split, begin_index):             # <<<<<<<<<<<<<<
 * 	ListRequire = []
 * 	for i in range(sample_num):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_6);
  __Pyx_XDECREF(__pyx_t_7);
  __Pyx_XDECREF(__pyx_t_9);
  __Pyx_AddTraceback("redis.Learning.generate_bagging_sample_index", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_ListRequire);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XDECREF(__pyx_v_size);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}
static PyObject *__pyx_gb_5redis_8Learning_16generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */

/* "redis/Learning.pyx":132
 * 	return np.array(ListRequire)
 * 
 * def generate_bagging_sample_array(X, sample_num, sample_size, random_split, begin_index):             # <<<<<<<<<<<<<<
 * 	sample_indexs_array = generate_bagging_sample_index(X, sample_num, sample_size, random_split, begin_index)
 * 	for sample_indexs in sample_indexs_array:
 */

/* Python wrapper */
static PyObject *__pyx_pw_5redis_8Learning_15generate_bagging_sample_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5redis_8Learning_15generate_bagging_sample_array = {"generate_bagging_sample_array", (PyCFunction)__pyx_pw_5redis_8Learning_15generate_bagging_sample_array, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5redis_8Learning_15generate_bagging_sample_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_sample_num = 0;
  PyObject *__pyx_v_sample_size = 0;
  PyObject *__pyx_v_random_split = 0;
  PyObject *__pyx_v_begin_index = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate_bagging_sample_array (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_X,&__pyx_n_s_sample_num,&__pyx_n_s_sample_size,&__pyx_n_s_random_split,&__pyx_n_s_begin_index,0};
    PyObject* values[5] = {0,0,0,0,0};
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sample_num)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_bagging_sample_array", 1, 5, 5, 1); __PYX_ERR(0, 132, __pyx_L3_error)
        }
        case  2:
        if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sample_size)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_bagging_sample_array", 1, 5, 5, 2); __PYX_ERR(0, 132, __pyx_L3_error)
        }
        case  3:
        if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_random_split)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_bagging_sample_array", 1, 5, 5, 3); __PYX_ERR(0, 132, __pyx_L3_error)
        }
        case  4:
        if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_begin_index)) != 0)) kw_args--;
        else {
          __Pyx_RaiseArgtupleInvalid("generate_bagging_sample_array", 1, 5, 5, 4); __PYX_ERR(0, 132, __pyx_L3_error)
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "generate_bagging_sample_array") < 0)) __PYX_ERR(0, 132, __pyx_L3_error)
      }
    } else if (PyTuple_GET_SIZE(__pyx_args) != 5) {
      goto __pyx_L5_argtuple_error;
    } else {
      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
      values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
      values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
      values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
    }
    __pyx_v_X = values[0];
    __pyx_v_sample_num = values[1];
    __pyx_v_sample_size = values[2];
    __pyx_v_random_split = values[3];
    __pyx_v_begin_index = values[4];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("generate_bagging_sample_array", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 132, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("redis.Learning.generate_bagging_sample_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5redis_8Learning_14generate_bagging_sample_array(__pyx_self, __pyx_v_X, __pyx_v_sample_num, __pyx_v_sample_size, __pyx_v_random_split, __pyx_v_begin_index);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5redis_8Learning_14generate_bagging_sample_array(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_X, PyObject *__pyx_v_sample_num, PyObject *__pyx_v_sample_size, PyObject *__pyx_v_random_split, PyObject *__pyx_v_begin_index) {
  struct __pyx_obj_5redis_8Learning___pyx_scope_struct__generate_bagging_sample_array *__pyx_cur_scope;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate_bagging_sample_array", 0);
  __pyx_cur_scope = (struct __pyx_obj_5redis_8Learning___pyx_scope_struct__generate_bagging_sample_array *)__pyx_tp_new_5redis_8Learning___pyx_scope_struct__generate_bagging_sample_array(__pyx_ptype_5redis_8Learning___pyx_scope_struct__generate_bagging_sample_array, __pyx_empty_tuple, NULL);
  if (unlikely(!__pyx_cur_scope)) {
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __Pyx_GOTREF(__pyx_cur_scope);
  __pyx_cur_scope->__pyx_v_X = __pyx_v_X;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_X);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_X);
  __pyx_cur_scope->__pyx_v_sample_num = __pyx_v_sample_num;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_sample_num);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_sample_num);
  __pyx_cur_scope->__pyx_v_sample_size = __pyx_v_sample_size;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_sample_size);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_sample_size);
  __pyx_cur_scope->__pyx_v_random_split = __pyx_v_random_split;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_random_split);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_random_split);
  __pyx_cur_scope->__pyx_v_begin_index = __pyx_v_begin_index;
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_begin_index);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_begin_index);
  {
    __pyx_CoroutineObject *gen = __Pyx_Generator_New((__pyx_coroutine_body_t) __pyx_gb_5redis_8Learning_16generator, (PyObject *) __pyx_cur_scope, __pyx_n_s_generate_bagging_sample_array, __pyx_n_s_generate_bagging_sample_array, __pyx_n_s_redis_Learning); if (unlikely(!gen)) __PYX_ERR(0, 132, __pyx_L1_error)
    __Pyx_DECREF(__pyx_cur_scope);
    __Pyx_RefNannyFinishContext();
    return (PyObject *) gen;
  }

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_AddTraceback("redis.Learning.generate_bagging_sample_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_gb_5redis_8Learning_16generator(__pyx_CoroutineObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */
{
  struct __pyx_obj_5redis_8Learning___pyx_scope_struct__generate_bagging_sample_array *__pyx_cur_scope = ((struct __pyx_obj_5redis_8Learning___pyx_scope_struct__generate_bagging_sample_array *)__pyx_generator->closure);
  PyObject *__pyx_r = NULL;
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  Py_ssize_t __pyx_t_4;
  PyObject *__pyx_t_5 = NULL;
  PyObject *(*__pyx_t_6)(PyObject *);
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("None", 0);
  switch (__pyx_generator->resume_label) {
    case 0: goto __pyx_L3_first_run;
    case 1: goto __pyx_L6_resume_from_yield;
    default: /* CPython raises the right error here */
    __Pyx_RefNannyFinishContext();
    return NULL;
  }
  __pyx_L3_first_run:;
  if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 132, __pyx_L1_error)

  /* "redis/Learning.pyx":133
 * 
 * def generate_bagging_sample_array(X, sample_num, sample_size, random_split, begin_index):
 * 	sample_indexs_array = generate_bagging_sample_index(X, sample_num, sample_size, random_split, begin_index)             # <<<<<<<<<<<<<<
 * 	for sample_indexs in sample_indexs_array:
 * 		yield X[sample_indexs].copy()
 */
  __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s_generate_bagging_sample_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __pyx_t_3 = NULL;
  __pyx_t_4 = 0;
  if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_3)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_3);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
      __pyx_t_4 = 1;
    }
  }
  __pyx_t_5 = PyTuple_New(5+__pyx_t_4); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_5);
  if (__pyx_t_3) {
    __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = NULL;
  }
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_X);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_X);
  PyTuple_SET_ITEM(__pyx_t_5, 0+__pyx_t_4, __pyx_cur_scope->__pyx_v_X);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_sample_num);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_sample_num);
  PyTuple_SET_ITEM(__pyx_t_5, 1+__pyx_t_4, __pyx_cur_scope->__pyx_v_sample_num);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_sample_size);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_sample_size);
  PyTuple_SET_ITEM(__pyx_t_5, 2+__pyx_t_4, __pyx_cur_scope->__pyx_v_sample_size);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_random_split);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_random_split);
  PyTuple_SET_ITEM(__pyx_t_5, 3+__pyx_t_4, __pyx_cur_scope->__pyx_v_random_split);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_begin_index);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_begin_index);
  PyTuple_SET_ITEM(__pyx_t_5, 4+__pyx_t_4, __pyx_cur_scope->__pyx_v_begin_index);
  __pyx_t_1 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 133, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_GIVEREF(__pyx_t_1);
  __pyx_cur_scope->__pyx_v_sample_indexs_array = __pyx_t_1;
  __pyx_t_1 = 0;

  /* "redis/Learning.pyx":134
 * def generate_bagging_sample_array(X, sample_num, sample_size, random_split, begin_index):
 * 	sample_indexs_array = generate_bagging_sample_index(X, sample_num, sample_size, random_split, begin_index)
 * 	for sample_indexs in sample_indexs_array:             # <<<<<<<<<<<<<<
 * 		yield X[sample_indexs].copy()
 * 
 */
  if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_sample_indexs_array)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_sample_indexs_array)) {
    __pyx_t_1 = __pyx_cur_scope->__pyx_v_sample_indexs_array; __Pyx_INCREF(__pyx_t_1); __pyx_t_4 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_4 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_sample_indexs_array); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 134, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 134, __pyx_L1_error)
  }
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_4 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 134, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_4 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_4); __Pyx_INCREF(__pyx_t_2); __pyx_t_4++; if (unlikely(0 < 0)) __PYX_ERR(0, 134, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_4); __pyx_t_4++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 134, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_6(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 134, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_sample_indexs);
    __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_sample_indexs, __pyx_t_2);
    __Pyx_GIVEREF(__pyx_t_2);
    __pyx_t_2 = 0;

    /* "redis/Learning.pyx":135
 * 	sample_indexs_array = generate_bagging_sample_index(X, sample_num, sample_size, random_split, begin_index)
 * 	for sample_indexs in sample_indexs_array:
 * 		yield X[sample_indexs].copy()             # <<<<<<<<<<<<<<
 * 
 * def Bagging_Test_Simple_Func(X, factor_max_bound = 20, sample_num = 10, sample_size = 100, disp = False, Type = "forward_stepwise", itertimes = None, random_split = False, begin_index = None, skip_size = 1, alpha = 0.5):
 */
    __pyx_t_5 = PyObject_GetItem(__pyx_cur_scope->__pyx_v_X, __pyx_cur_scope->__pyx_v_sample_indexs); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_copy); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 135, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_3);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_5 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_3))) {
      __pyx_t_5 = PyMethod_GET_SELF(__pyx_t_3);
      if (likely(__pyx_t_5)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_3);
        __Pyx_INCREF(__pyx_t_5);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_3, function);
      }
    }
    if (__pyx_t_5) {
      __pyx_t_2 = __Pyx_PyObject_CallOneArg(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    } else {
      __pyx_t_2 = __Pyx_PyObject_CallNoArg(__pyx_t_3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 135, __pyx_L1_error)
    }
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
    __pyx_r = __pyx_t_2;
    __pyx_t_2 = 0;
    __Pyx_XGIVEREF(__pyx_t_1);
    __pyx_cur_scope->__pyx_t_0 = __pyx_t_1;
    __pyx_cur_scope->__pyx_t_1 = __pyx_t_4;
    __pyx_cur_scope->__pyx_t_2 = __pyx_t_6;
    __Pyx_XGIVEREF(__pyx_r);
    __Pyx_RefNannyFinishContext();
    /* return from generator, yielding value */
    __pyx_generator->resume_label = 1;
    return __pyx_r;
    __pyx_L6_resume_from_yield:;
    __pyx_t_1 = __pyx_cur_scope->__pyx_t_0;
    __pyx_cur_scope->__pyx_t_0 = 0;
    __Pyx_XGOTREF(__pyx_t_1);
    __pyx_t_4 = __pyx_cur_scope->__pyx_t_1;
    __pyx_t_6 = __pyx_cur_scope->__pyx_t_2;
    if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 135, __pyx_L1_error)

    /* "redis/Learning.pyx":134
 * def generate_bagging_sample_array(X, sample_num, sample_size, random_split, begin_index):
 * 	sample_indexs_array = generate_bagging_sample_index(X, sample_num, sample_size, random_split, begin_index)
 * 	for sample_indexs in sample_indexs_array:             # <<<<<<<<<<<<<<
 * 		yield X[sample_indexs].copy()
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "redis/Learning.pyx":132
 * 	return np.array(ListRequire)
 * 
 * def generate_bagging_sample_array(X, sample_num, sample_size, random_split, begin_index):             # <<<<<<<<<<<<<<
 * 	sample_indexs_array = generate_bagging_sample_index(X, sample_num, sample_size, random_split, begin_index)
 * 	for sample_indexs in sample_indexs_array:
 */

  /* function exit code */
  PyErr_SetNone(PyExc_StopIteration);
  goto __pyx_L0;
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_5);
  __Pyx_AddTraceback("generate_bagging_sample_array", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_r); __pyx_r = 0;
  __pyx_generator->resume_label = -1;
  __Pyx_Coroutine_clear((PyObject*)__pyx_generator);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "redis/Learning.pyx":137
 * 		yield X[sample_indexs].copy()
 * 
 * def Bagging_Test_Simple_Func(X, factor_max_bound = 20, sample_num = 10, sample_size = 100, disp = False, Type = "forward_stepwise", itertimes = None, random_split = False, begin_index = None, skip_size = 1, alpha = 0.5):             # <<<<<<<<<<<<<<
 * 	factor_dict = dict()
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5redis_8Learning_18Bagging_Test_Simple_Func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyMethodDef __pyx_mdef_5redis_8Learning_18Bagging_Test_Simple_Func = {"Bagging_Test_Simple_Func", (PyCFunction)__pyx_pw_5redis_8Learning_18Bagging_Test_Simple_Func, METH_VARARGS|METH_KEYWORDS, 0};
static PyObject *__pyx_pw_5redis_8Learning_18Bagging_Test_Simple_Func(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_X = 0;
  PyObject *__pyx_v_factor_max_bound = 0;
  PyObject *__pyx_v_sample_num = 0;
  PyObject *__pyx_v_sample_size = 0;
  PyObject *__pyx_v_disp = 0;
  PyObject *__pyx_v_Type = 0;
  PyObject *__pyx_v_itertimes = 0;
  PyObject *__pyx_v_random_split = 0;
  PyObject *__pyx_v_begin_index = 0;
  PyObject *__pyx_v_skip_size = 0;
  PyObject *__pyx_v_alpha = 0;
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("Bagging_Test_Simple_Func (wrapper)", 0);
  {
    static PyObject **__pyx_pyargnames[] = {&__pyx_n_s_X,&__pyx_n_s_factor_max_bound,&__pyx_n_s_sample_num,&__pyx_n_s_sample_size,&__pyx_n_s_disp,&__pyx_n_s_Type,&__pyx_n_s_itertimes,&__pyx_n_s_random_split,&__pyx_n_s_begin_index,&__pyx_n_s_skip_size,&__pyx_n_s_alpha,0};
    PyObject* values[11] = {0,0,0,0,0,0,0,0,0,0,0};
    values[1] = ((PyObject *)__pyx_int_20);
    values[2] = ((PyObject *)__pyx_int_10);
    values[3] = ((PyObject *)__pyx_int_100);
    values[4] = ((PyObject *)Py_False);
    values[5] = ((PyObject *)__pyx_n_s_forward_stepwise);
    values[6] = ((PyObject *)Py_None);
    values[7] = ((PyObject *)Py_False);
    values[8] = ((PyObject *)Py_None);
    values[9] = ((PyObject *)__pyx_int_1);
    values[10] = ((PyObject *)__pyx_float_0_5);
    if (unlikely(__pyx_kwds)) {
      Py_ssize_t kw_args;
      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
      switch (pos_args) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        case  0: break;
        default: goto __pyx_L5_argtuple_error;
      }
      kw_args = PyDict_Size(__pyx_kwds);
      switch (pos_args) {
        case  0:
        if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s_X)) != 0)) kw_args--;
        else goto __pyx_L5_argtuple_error;
        case  1:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_factor_max_bound);
          if (value) { values[1] = value; kw_args--; }
        }
        case  2:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sample_num);
          if (value) { values[2] = value; kw_args--; }
        }
        case  3:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_sample_size);
          if (value) { values[3] = value; kw_args--; }
        }
        case  4:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_disp);
          if (value) { values[4] = value; kw_args--; }
        }
        case  5:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_Type);
          if (value) { values[5] = value; kw_args--; }
        }
        case  6:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_itertimes);
          if (value) { values[6] = value; kw_args--; }
        }
        case  7:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_random_split);
          if (value) { values[7] = value; kw_args--; }
        }
        case  8:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_begin_index);
          if (value) { values[8] = value; kw_args--; }
        }
        case  9:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_skip_size);
          if (value) { values[9] = value; kw_args--; }
        }
        case 10:
        if (kw_args > 0) {
          PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_alpha);
          if (value) { values[10] = value; kw_args--; }
        }
      }
      if (unlikely(kw_args > 0)) {
        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "Bagging_Test_Simple_Func") < 0)) __PYX_ERR(0, 137, __pyx_L3_error)
      }
    } else {
      switch (PyTuple_GET_SIZE(__pyx_args)) {
        case 11: values[10] = PyTuple_GET_ITEM(__pyx_args, 10);
        case 10: values[9] = PyTuple_GET_ITEM(__pyx_args, 9);
        case  9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8);
        case  8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7);
        case  7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6);
        case  6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5);
        case  5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4);
        case  4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3);
        case  3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2);
        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
        break;
        default: goto __pyx_L5_argtuple_error;
      }
    }
    __pyx_v_X = values[0];
    __pyx_v_factor_max_bound = values[1];
    __pyx_v_sample_num = values[2];
    __pyx_v_sample_size = values[3];
    __pyx_v_disp = values[4];
    __pyx_v_Type = values[5];
    __pyx_v_itertimes = values[6];
    __pyx_v_random_split = values[7];
    __pyx_v_begin_index = values[8];
    __pyx_v_skip_size = values[9];
    __pyx_v_alpha = values[10];
  }
  goto __pyx_L4_argument_unpacking_done;
  __pyx_L5_argtuple_error:;
  __Pyx_RaiseArgtupleInvalid("Bagging_Test_Simple_Func", 0, 1, 11, PyTuple_GET_SIZE(__pyx_args)); __PYX_ERR(0, 137, __pyx_L3_error)
  __pyx_L3_error:;
  __Pyx_AddTraceback("redis.Learning.Bagging_Test_Simple_Func", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __Pyx_RefNannyFinishContext();
  return NULL;
  __pyx_L4_argument_unpacking_done:;
  __pyx_r = __pyx_pf_5redis_8Learning_17Bagging_Test_Simple_Func(__pyx_self, __pyx_v_X, __pyx_v_factor_max_bound, __pyx_v_sample_num, __pyx_v_sample_size, __pyx_v_disp, __pyx_v_Type, __pyx_v_itertimes, __pyx_v_random_split, __pyx_v_begin_index, __pyx_v_skip_size, __pyx_v_alpha);

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "redis/Learning.pyx":140
 * 	factor_dict = dict()
 * 
 * 	def change_eigen_ratio_sample_order(eigen_ratio_sample):             # <<<<<<<<<<<<<<
 * 		array_require_T = np.empty(shape = eigen_ratio_sample.T.shape)
 * 		for i in range(eigen_ratio_sample.T.shape[0]):
 */

/* Python wrapper */
static PyObject *__pyx_pw_5redis_8Learning_24Bagging_Test_Simple_Func_1change_eigen_ratio_sample_order(PyObject *__pyx_self, PyObject *__pyx_v_eigen_ratio_sample); /*proto*/
static PyMethodDef __pyx_mdef_5redis_8Learning_24Bagging_Test_Simple_Func_1change_eigen_ratio_sample_order = {"change_eigen_ratio_sample_order", (PyCFunction)__pyx_pw_5redis_8Learning_24Bagging_Test_Simple_Func_1change_eigen_ratio_sample_order, METH_O, 0};
static PyObject *__pyx_pw_5redis_8Learning_24Bagging_Test_Simple_Func_1change_eigen_ratio_sample_order(PyObject *__pyx_self, PyObject *__pyx_v_eigen_ratio_sample) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("change_eigen_ratio_sample_order (wrapper)", 0);
  __pyx_r = __pyx_pf_5redis_8Learning_24Bagging_Test_Simple_Func_change_eigen_ratio_sample_order(__pyx_self, ((PyObject *)__pyx_v_eigen_ratio_sample));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5redis_8Learning_24Bagging_Test_Simple_Func_change_eigen_ratio_sample_order(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_eigen_ratio_sample) {
  PyObject *__pyx_v_array_require_T = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  PyObject *__pyx_t_3 = NULL;
  PyObject *__pyx_t_4 = NULL;
  Py_ssize_t __pyx_t_5;
  PyObject *(*__pyx_t_6)(PyObject *);
  __Pyx_RefNannySetupContext("change_eigen_ratio_sample_order", 0);

  /* "redis/Learning.pyx":141
 * 
 * 	def change_eigen_ratio_sample_order(eigen_ratio_sample):
 * 		array_require_T = np.empty(shape = eigen_ratio_sample.T.shape)             # <<<<<<<<<<<<<<
 * 		for i in range(eigen_ratio_sample.T.shape[0]):
 * 			array_require_T[i] = eigen_ratio_sample.T[i][::-1]
 */
  __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s_empty); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_v_eigen_ratio_sample, __pyx_n_s_T); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_3);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_shape); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
  if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_shape, __pyx_t_4) < 0) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 141, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_v_array_require_T = __pyx_t_4;
  __pyx_t_4 = 0;

  /* "redis/Learning.pyx":142
 * 	def change_eigen_ratio_sample_order(eigen_ratio_sample):
 * 		array_require_T = np.empty(shape = eigen_ratio_sample.T.shape)
 * 		for i in range(eigen_ratio_sample.T.shape[0]):             # <<<<<<<<<<<<<<
 * 			array_require_T[i] = eigen_ratio_sample.T[i][::-1]
 * 
 */
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_eigen_ratio_sample, __pyx_n_s_T); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_shape); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_GetItemInt(__pyx_t_1, 0, long, 1, __Pyx_PyInt_From_long, 0, 0, 1); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_GIVEREF(__pyx_t_4);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4);
  __pyx_t_4 = 0;
  __pyx_t_4 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_4)) || PyTuple_CheckExact(__pyx_t_4)) {
    __pyx_t_1 = __pyx_t_4; __Pyx_INCREF(__pyx_t_1); __pyx_t_5 = 0;
    __pyx_t_6 = NULL;
  } else {
    __pyx_t_5 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 142, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_6 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 142, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  for (;;) {
    if (likely(!__pyx_t_6)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_5 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 142, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      } else {
        if (__pyx_t_5 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_5); __Pyx_INCREF(__pyx_t_4); __pyx_t_5++; if (unlikely(0 < 0)) __PYX_ERR(0, 142, __pyx_L1_error)
        #else
        __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_5); __pyx_t_5++; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 142, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_4);
        #endif
      }
    } else {
      __pyx_t_4 = __pyx_t_6(__pyx_t_1);
      if (unlikely(!__pyx_t_4)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 142, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_4);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_4);
    __pyx_t_4 = 0;

    /* "redis/Learning.pyx":143
 * 		array_require_T = np.empty(shape = eigen_ratio_sample.T.shape)
 * 		for i in range(eigen_ratio_sample.T.shape[0]):
 * 			array_require_T[i] = eigen_ratio_sample.T[i][::-1]             # <<<<<<<<<<<<<<
 * 
 * 		return (array_require_T.T).copy()
 */
    __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_eigen_ratio_sample, __pyx_n_s_T); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 143, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __pyx_t_2 = PyObject_GetItem(__pyx_t_4, __pyx_v_i); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 143, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_2);
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
    __pyx_t_4 = PyObject_GetItem(__pyx_t_2, __pyx_slice__5); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 143, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_4);
    __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
    if (unlikely(PyObject_SetItem(__pyx_v_array_require_T, __pyx_v_i, __pyx_t_4) < 0)) __PYX_ERR(0, 143, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;

    /* "redis/Learning.pyx":142
 * 	def change_eigen_ratio_sample_order(eigen_ratio_sample):
 * 		array_require_T = np.empty(shape = eigen_ratio_sample.T.shape)
 * 		for i in range(eigen_ratio_sample.T.shape[0]):             # <<<<<<<<<<<<<<
 * 			array_require_T[i] = eigen_ratio_sample.T[i][::-1]
 * 
 */
  }
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;

  /* "redis/Learning.pyx":145
 * 			array_require_T[i] = eigen_ratio_sample.T[i][::-1]
 * 
 * 		return (array_require_T.T).copy()             # <<<<<<<<<<<<<<
 * 
 * 	def generate_forward_stepwise_eigen_ratio_sample(X_bagging_sample):
 */
  __Pyx_XDECREF(__pyx_r);
  __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_array_require_T, __pyx_n_s_T); if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_4);
  __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s_copy); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 145, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  __pyx_t_4 = NULL;
  if (CYTHON_COMPILING_IN_CPYTHON && likely(PyMethod_Check(__pyx_t_2))) {
    __pyx_t_4 = PyMethod_GET_SELF(__pyx_t_2);
    if (likely(__pyx_t_4)) {
      PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2);
      __Pyx_INCREF(__pyx_t_4);
      __Pyx_INCREF(function);
      __Pyx_DECREF_SET(__pyx_t_2, function);
    }
  }
  if (__pyx_t_4) {
    __pyx_t_1 = __Pyx_PyObject_CallOneArg(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error)
    __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
  } else {
    __pyx_t_1 = __Pyx_PyObject_CallNoArg(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 145, __pyx_L1_error)
  }
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  __pyx_r = __pyx_t_1;
  __pyx_t_1 = 0;
  goto __pyx_L0;

  /* "redis/Learning.pyx":140
 * 	factor_dict = dict()
 * 
 * 	def change_eigen_ratio_sample_order(eigen_ratio_sample):             # <<<<<<<<<<<<<<
 * 		array_require_T = np.empty(shape = eigen_ratio_sample.T.shape)
 * 		for i in range(eigen_ratio_sample.T.shape[0]):
 */

  /* function exit code */
  __pyx_L1_error:;
  __Pyx_XDECREF(__pyx_t_1);
  __Pyx_XDECREF(__pyx_t_2);
  __Pyx_XDECREF(__pyx_t_3);
  __Pyx_XDECREF(__pyx_t_4);
  __Pyx_AddTraceback("redis.Learning.Bagging_Test_Simple_Func.change_eigen_ratio_sample_order", __pyx_clineno, __pyx_lineno, __pyx_filename);
  __pyx_r = NULL;
  __pyx_L0:;
  __Pyx_XDECREF(__pyx_v_array_require_T);
  __Pyx_XDECREF(__pyx_v_i);
  __Pyx_XGIVEREF(__pyx_r);
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

/* "redis/Learning.pyx":147
 * 		return (array_require_T.T).copy()
 * 
 * 	def generate_forward_stepwise_eigen_ratio_sample(X_bagging_sample):             # <<<<<<<<<<<<<<
 * 		eigen_ratio_sample = None
 * 
 */

/* Python wrapper */
static PyObject *__pyx_pw_5redis_8Learning_24Bagging_Test_Simple_Func_3generate_forward_stepwise_eigen_ratio_sample(PyObject *__pyx_self, PyObject *__pyx_v_X_bagging_sample); /*proto*/
static PyMethodDef __pyx_mdef_5redis_8Learning_24Bagging_Test_Simple_Func_3generate_forward_stepwise_eigen_ratio_sample = {"generate_forward_stepwise_eigen_ratio_sample", (PyCFunction)__pyx_pw_5redis_8Learning_24Bagging_Test_Simple_Func_3generate_forward_stepwise_eigen_ratio_sample, METH_O, 0};
static PyObject *__pyx_pw_5redis_8Learning_24Bagging_Test_Simple_Func_3generate_forward_stepwise_eigen_ratio_sample(PyObject *__pyx_self, PyObject *__pyx_v_X_bagging_sample) {
  PyObject *__pyx_r = 0;
  __Pyx_RefNannyDeclarations
  __Pyx_RefNannySetupContext("generate_forward_stepwise_eigen_ratio_sample (wrapper)", 0);
  __pyx_r = __pyx_pf_5redis_8Learning_24Bagging_Test_Simple_Func_2generate_forward_stepwise_eigen_ratio_sample(__pyx_self, ((PyObject *)__pyx_v_X_bagging_sample));

  /* function exit code */
  __Pyx_RefNannyFinishContext();
  return __pyx_r;
}

static PyObject *__pyx_pf_5redis_8Learning_24Bagging_Test_Simple_Func_2generate_forward_stepwise_eigen_ratio_sample(PyObject *__pyx_self, PyObject *__pyx_v_X_bagging_sample) {
  struct __pyx_obj_5redis_8Learning___pyx_scope_struct_1_Bagging_Test_Simple_Func *__pyx_cur_scope;
  struct __pyx_obj_5redis_8Learning___pyx_scope_struct_1_Bagging_Test_Simple_Func *__pyx_outer_scope;
  PyObject *__pyx_v_eigen_ratio_sample = NULL;
  PyObject *__pyx_v_i = NULL;
  PyObject *__pyx_v_eigen_v = NULL;
  PyObject *__pyx_v_will_append = NULL;
  PyObject *__pyx_r = NULL;
  __Pyx_RefNannyDeclarations
  PyObject *__pyx_t_1 = NULL;
  PyObject *__pyx_t_2 = NULL;
  Py_ssize_t __pyx_t_3;
  PyObject *(*__pyx_t_4)(PyObject *);
  PyObject *__pyx_t_5 = NULL;
  PyObject *__pyx_t_6 = NULL;
  PyObject *__pyx_t_7 = NULL;
  PyObject *__pyx_t_8 = NULL;
  PyObject *__pyx_t_9 = NULL;
  PyObject *__pyx_t_10 = NULL;
  PyObject *__pyx_t_11 = NULL;
  PyObject *__pyx_t_12 = NULL;
  Py_ssize_t __pyx_t_13;
  PyObject *__pyx_t_14 = NULL;
  int __pyx_t_15;
  __Pyx_RefNannySetupContext("generate_forward_stepwise_eigen_ratio_sample", 0);
  __pyx_outer_scope = (struct __pyx_obj_5redis_8Learning___pyx_scope_struct_1_Bagging_Test_Simple_Func *) __Pyx_CyFunction_GetClosure(__pyx_self);
  __pyx_cur_scope = __pyx_outer_scope;

  /* "redis/Learning.pyx":148
 * 
 * 	def generate_forward_stepwise_eigen_ratio_sample(X_bagging_sample):
 * 		eigen_ratio_sample = None             # <<<<<<<<<<<<<<
 * 
 * 		for i in range(factor_max_bound ,sample_size, skip_size):
 */
  __Pyx_INCREF(Py_None);
  __pyx_v_eigen_ratio_sample = Py_None;

  /* "redis/Learning.pyx":150
 * 		eigen_ratio_sample = None
 * 
 * 		for i in range(factor_max_bound ,sample_size, skip_size):             # <<<<<<<<<<<<<<
 * 			eigen_v = np.abs(eigvalsh(np.dot(X_bagging_sample[ :i + 1], X_bagging_sample[ :i + 1].T))[::-1])
 * 
 */
  if (unlikely(!__pyx_cur_scope->__pyx_v_factor_max_bound)) { __Pyx_RaiseClosureNameError("factor_max_bound"); __PYX_ERR(0, 150, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_sample_size)) { __Pyx_RaiseClosureNameError("sample_size"); __PYX_ERR(0, 150, __pyx_L1_error) }
  if (unlikely(!__pyx_cur_scope->__pyx_v_skip_size)) { __Pyx_RaiseClosureNameError("skip_size"); __PYX_ERR(0, 150, __pyx_L1_error) }
  __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_1);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_factor_max_bound);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_factor_max_bound);
  PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_cur_scope->__pyx_v_factor_max_bound);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_sample_size);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_sample_size);
  PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_cur_scope->__pyx_v_sample_size);
  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_skip_size);
  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_skip_size);
  PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_cur_scope->__pyx_v_skip_size);
  __pyx_t_2 = __Pyx_PyObject_Call(__pyx_builtin_range, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
  __Pyx_GOTREF(__pyx_t_2);
  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
  if (likely(PyList_CheckExact(__pyx_t_2)) || PyTuple_CheckExact(__pyx_t_2)) {
    __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0;
    __pyx_t_4 = NULL;
  } else {
    __pyx_t_3 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 150, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_1);
    __pyx_t_4 = Py_TYPE(__pyx_t_1)->tp_iternext; if (unlikely(!__pyx_t_4)) __PYX_ERR(0, 150, __pyx_L1_error)
  }
  __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  for (;;) {
    if (likely(!__pyx_t_4)) {
      if (likely(PyList_CheckExact(__pyx_t_1))) {
        if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 150, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      } else {
        if (__pyx_t_3 >= PyTuple_GET_SIZE(__pyx_t_1)) break;
        #if CYTHON_COMPILING_IN_CPYTHON
        __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_2); __pyx_t_3++; if (unlikely(0 < 0)) __PYX_ERR(0, 150, __pyx_L1_error)
        #else
        __pyx_t_2 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 150, __pyx_L1_error)
        __Pyx_GOTREF(__pyx_t_2);
        #endif
      }
    } else {
      __pyx_t_2 = __pyx_t_4(__pyx_t_1);
      if (unlikely(!__pyx_t_2)) {
        PyObject* exc_type = PyErr_Occurred();
        if (exc_type) {
          if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear();
          else __PYX_ERR(0, 150, __pyx_L1_error)
        }
        break;
      }
      __Pyx_GOTREF(__pyx_t_2);
    }
    __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2);
    __pyx_t_2 = 0;

    /* "redis/Learning.pyx":151
 * 
 * 		for i in range(factor_max_bound ,sample_size, skip_size):
 * 			eigen_v = np.abs(eigvalsh(np.dot(X_bagging_sample[ :i + 1], X_bagging_sample[ :i + 1].T))[::-1])             # <<<<<<<<<<<<<<
 * 
 * 			if disp:
 */
    __pyx_t_5 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_5);
    __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s_abs); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_6);
    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
    __pyx_t_7 = __Pyx_GetModuleGlobalName(__pyx_n_s_eigvalsh); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_7);
    __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s_np); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s_dot); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_10);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_11 = __Pyx_PyObject_GetSlice(__pyx_v_X_bagging_sample, 0, 0, NULL, &__pyx_t_9, NULL, 0, 0, 1); if (unlikely(!__pyx_t_11)) __PYX_ERR(0, 151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_11);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyInt_AddObjC(__pyx_v_i, __pyx_int_1, 1, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __pyx_t_12 = __Pyx_PyObject_GetSlice(__pyx_v_X_bagging_sample, 0, 0, NULL, &__pyx_t_9, NULL, 0, 0, 1); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_12);
    __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0;
    __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s_T); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_9);
    __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0;
    __pyx_t_12 = NULL;
    __pyx_t_13 = 0;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_10))) {
      __pyx_t_12 = PyMethod_GET_SELF(__pyx_t_10);
      if (likely(__pyx_t_12)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_10);
        __Pyx_INCREF(__pyx_t_12);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_10, function);
        __pyx_t_13 = 1;
      }
    }
    __pyx_t_14 = PyTuple_New(2+__pyx_t_13); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_14);
    if (__pyx_t_12) {
      __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_12); __pyx_t_12 = NULL;
    }
    __Pyx_GIVEREF(__pyx_t_11);
    PyTuple_SET_ITEM(__pyx_t_14, 0+__pyx_t_13, __pyx_t_11);
    __Pyx_GIVEREF(__pyx_t_9);
    PyTuple_SET_ITEM(__pyx_t_14, 1+__pyx_t_13, __pyx_t_9);
    __pyx_t_11 = 0;
    __pyx_t_9 = 0;
    __pyx_t_8 = __Pyx_PyObject_Call(__pyx_t_10, __pyx_t_14, NULL); if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 151, __pyx_L1_error)
    __Pyx_GOTREF(__pyx_t_8);
    __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0;
    __pyx_t_10 = NULL;
    if (CYTHON_COMPILING_IN_CPYTHON && unlikely(PyMethod_Check(__pyx_t_7))) {
      __pyx_t_10 = PyMethod_GET_SELF(__pyx_t_7);
      if (likely(__pyx_t_10)) {
        PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7);
        __Pyx_INCREF(__pyx_t_10);
        __Pyx_INCREF(function);
        __Pyx_DECREF_SET(__pyx_t_7, function);
      }
    }
    if (!__pyx_t_10) {
      __pyx_t_5 = __Pyx_PyObject_CallOneArg(__pyx_t_7, __pyx_t_8); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
      __Pyx_GOTREF(__pyx_t_5);
    } else {
      __pyx_t_14 = PyTuple_New(1+1); if (unlikely(!__pyx_t_14)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_14);
      __Pyx_GIVEREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_10); __pyx_t_10 = NULL;
      __Pyx_GIVEREF(__pyx_t_8);
      PyTuple_SET_ITEM(__pyx_t_14, 0+1, __pyx_t_8);
      __pyx_t_8 = 0;
      __pyx_t_5 = __Pyx_PyObject_Call(__pyx_t_7, __pyx_t_14, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 151, __pyx_L1_error)
      __Pyx_GOTREF(__pyx_t_5);
      __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0;
    }
    __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
    __pyx_t_7 = PyObject_GetItem(__pyx_t_5, __pyx_slice_
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值