diff --git "a/restful/cutils/utilities.c" "b/restful/cutils/utilities.c" --- "a/restful/cutils/utilities.c" +++ "b/restful/cutils/utilities.c" @@ -1496,23 +1496,23 @@ static const char *__pyx_f[] = { struct __pyx_obj_9utilities_Utilities; struct __pyx_obj_9utilities___pyx_scope_struct__forecasting_utils; -/* "utilities.pyx":8 - * import cython +/* "utilities.pyx":9 + * * * cdef class Utilities: # <<<<<<<<<<<<<< * async def forecasting_utils(self, int sequence_length, - * int days, str model_name, str algorithm) -> tuple: + * int days, str model_name, str algorithm, bint with_pred) -> tuple: */ struct __pyx_obj_9utilities_Utilities { PyObject_HEAD }; -/* "utilities.pyx":9 +/* "utilities.pyx":10 * * cdef class Utilities: * async def forecasting_utils(self, int sequence_length, # <<<<<<<<<<<<<< - * int days, str model_name, str algorithm) -> tuple: + * int days, str model_name, str algorithm, bint with_pred) -> tuple: * cdef str model_path = os.path.join(f'./resources/algorithms/{algorithm}/models', */ struct __pyx_obj_9utilities___pyx_scope_struct__forecasting_utils { @@ -1542,6 +1542,7 @@ struct __pyx_obj_9utilities___pyx_scope_struct__forecasting_utils { struct __pyx_obj_9utilities_Utilities *__pyx_v_self; int __pyx_v_sequence_length; PyObject *__pyx_v_standard_scaler; + int __pyx_v_with_pred; }; /* #### Code section: utility_code_proto ### */ @@ -2709,6 +2710,7 @@ static const char __pyx_k_read_json[] = "read_json"; static const char __pyx_k_reduce_ex[] = "__reduce_ex__"; static const char __pyx_k_set_index[] = "set_index"; static const char __pyx_k_utilities[] = "utilities"; +static const char __pyx_k_with_pred[] = "with_pred"; static const char __pyx_k_load_model[] = "load_model"; static const char __pyx_k_model_name[] = "model_name"; static const char __pyx_k_model_path[] = "model_path"; @@ -2749,7 +2751,7 @@ static const char __pyx_k_Utilities___setstate_cython[] = "Utilities.__setstate_ static const char __pyx_k_Utilities_forecasting_utils[] = "Utilities.forecasting_utils"; static const char __pyx_k_Incompatible_checksums_0x_x_vs_0[] = "Incompatible checksums (0x%x vs (0xe3b0c44, 0xda39a3e, 0xd41d8cd) = ())"; /* #### Code section: decls ### */ -static PyObject *__pyx_pf_9utilities_9Utilities_forecasting_utils(CYTHON_UNUSED struct __pyx_obj_9utilities_Utilities *__pyx_v_self, int __pyx_v_sequence_length, int __pyx_v_days, PyObject *__pyx_v_model_name, PyObject *__pyx_v_algorithm); /* proto */ +static PyObject *__pyx_pf_9utilities_9Utilities_forecasting_utils(CYTHON_UNUSED struct __pyx_obj_9utilities_Utilities *__pyx_v_self, int __pyx_v_sequence_length, int __pyx_v_days, PyObject *__pyx_v_model_name, PyObject *__pyx_v_algorithm, int __pyx_v_with_pred); /* proto */ static PyObject *__pyx_pf_9utilities_9Utilities_3__reduce_cython__(struct __pyx_obj_9utilities_Utilities *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_9utilities_9Utilities_5__setstate_cython__(struct __pyx_obj_9utilities_Utilities *__pyx_v_self, PyObject *__pyx_v___pyx_state); /* proto */ static PyObject *__pyx_pf_9utilities___pyx_unpickle_Utilities(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v___pyx_type, long __pyx_v___pyx_checksum, PyObject *__pyx_v___pyx_state); /* proto */ @@ -2900,6 +2902,7 @@ typedef struct { PyObject *__pyx_n_s_utilities; PyObject *__pyx_kp_s_utilities_pyx; PyObject *__pyx_n_s_values; + PyObject *__pyx_n_s_with_pred; PyObject *__pyx_n_s_zip; PyObject *__pyx_int_0; PyObject *__pyx_int_1; @@ -3075,6 +3078,7 @@ static int __pyx_m_clear(PyObject *m) { Py_CLEAR(clear_module_state->__pyx_n_s_utilities); Py_CLEAR(clear_module_state->__pyx_kp_s_utilities_pyx); Py_CLEAR(clear_module_state->__pyx_n_s_values); + Py_CLEAR(clear_module_state->__pyx_n_s_with_pred); Py_CLEAR(clear_module_state->__pyx_n_s_zip); Py_CLEAR(clear_module_state->__pyx_int_0); Py_CLEAR(clear_module_state->__pyx_int_1); @@ -3228,6 +3232,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { Py_VISIT(traverse_module_state->__pyx_n_s_utilities); Py_VISIT(traverse_module_state->__pyx_kp_s_utilities_pyx); Py_VISIT(traverse_module_state->__pyx_n_s_values); + Py_VISIT(traverse_module_state->__pyx_n_s_with_pred); Py_VISIT(traverse_module_state->__pyx_n_s_zip); Py_VISIT(traverse_module_state->__pyx_int_0); Py_VISIT(traverse_module_state->__pyx_int_1); @@ -3393,6 +3398,7 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { #define __pyx_n_s_utilities __pyx_mstate_global->__pyx_n_s_utilities #define __pyx_kp_s_utilities_pyx __pyx_mstate_global->__pyx_kp_s_utilities_pyx #define __pyx_n_s_values __pyx_mstate_global->__pyx_n_s_values +#define __pyx_n_s_with_pred __pyx_mstate_global->__pyx_n_s_with_pred #define __pyx_n_s_zip __pyx_mstate_global->__pyx_n_s_zip #define __pyx_int_0 __pyx_mstate_global->__pyx_int_0 #define __pyx_int_1 __pyx_mstate_global->__pyx_int_1 @@ -3415,11 +3421,11 @@ static int __pyx_m_traverse(PyObject *m, visitproc visit, void *arg) { /* #### Code section: module_code ### */ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject *__pyx_generator, CYTHON_UNUSED PyThreadState *__pyx_tstate, PyObject *__pyx_sent_value); /* proto */ -/* "utilities.pyx":9 +/* "utilities.pyx":10 * * cdef class Utilities: * async def forecasting_utils(self, int sequence_length, # <<<<<<<<<<<<<< - * int days, str model_name, str algorithm) -> tuple: + * int days, str model_name, str algorithm, bint with_pred) -> tuple: * cdef str model_path = os.path.join(f'./resources/algorithms/{algorithm}/models', */ @@ -3443,11 +3449,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds int __pyx_v_days; PyObject *__pyx_v_model_name = 0; PyObject *__pyx_v_algorithm = 0; + int __pyx_v_with_pred; #if !CYTHON_METH_FASTCALL CYTHON_UNUSED Py_ssize_t __pyx_nargs; #endif CYTHON_UNUSED PyObject *const *__pyx_kwvalues; - PyObject* values[4] = {0,0,0,0}; + PyObject* values[5] = {0,0,0,0,0}; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3463,10 +3470,12 @@ PyObject *__pyx_args, PyObject *__pyx_kwds #endif __pyx_kwvalues = __Pyx_KwValues_FASTCALL(__pyx_args, __pyx_nargs); { - PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sequence_length,&__pyx_n_s_days,&__pyx_n_s_model_name,&__pyx_n_s_algorithm,0}; + PyObject **__pyx_pyargnames[] = {&__pyx_n_s_sequence_length,&__pyx_n_s_days,&__pyx_n_s_model_name,&__pyx_n_s_algorithm,&__pyx_n_s_with_pred,0}; if (__pyx_kwds) { Py_ssize_t kw_args; switch (__pyx_nargs) { + case 5: values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); + CYTHON_FALLTHROUGH; case 4: values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); CYTHON_FALLTHROUGH; case 3: values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); @@ -3485,7 +3494,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[0]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 9, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 10, __pyx_L3_error) else goto __pyx_L5_argtuple_error; CYTHON_FALLTHROUGH; case 1: @@ -3493,9 +3502,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[1]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 9, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 10, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("forecasting_utils", 1, 4, 4, 1); __PYX_ERR(0, 9, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forecasting_utils", 1, 5, 5, 1); __PYX_ERR(0, 10, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 2: @@ -3503,9 +3512,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[2]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 9, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 10, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("forecasting_utils", 1, 4, 4, 2); __PYX_ERR(0, 9, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forecasting_utils", 1, 5, 5, 2); __PYX_ERR(0, 10, __pyx_L3_error) } CYTHON_FALLTHROUGH; case 3: @@ -3513,31 +3522,43 @@ PyObject *__pyx_args, PyObject *__pyx_kwds (void)__Pyx_Arg_NewRef_FASTCALL(values[3]); kw_args--; } - else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 9, __pyx_L3_error) + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 10, __pyx_L3_error) else { - __Pyx_RaiseArgtupleInvalid("forecasting_utils", 1, 4, 4, 3); __PYX_ERR(0, 9, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forecasting_utils", 1, 5, 5, 3); __PYX_ERR(0, 10, __pyx_L3_error) + } + CYTHON_FALLTHROUGH; + case 4: + if (likely((values[4] = __Pyx_GetKwValue_FASTCALL(__pyx_kwds, __pyx_kwvalues, __pyx_n_s_with_pred)) != 0)) { + (void)__Pyx_Arg_NewRef_FASTCALL(values[4]); + kw_args--; + } + else if (unlikely(PyErr_Occurred())) __PYX_ERR(0, 10, __pyx_L3_error) + else { + __Pyx_RaiseArgtupleInvalid("forecasting_utils", 1, 5, 5, 4); __PYX_ERR(0, 10, __pyx_L3_error) } } if (unlikely(kw_args > 0)) { const Py_ssize_t kwd_pos_args = __pyx_nargs; - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "forecasting_utils") < 0)) __PYX_ERR(0, 9, __pyx_L3_error) + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_kwvalues, __pyx_pyargnames, 0, values + 0, kwd_pos_args, "forecasting_utils") < 0)) __PYX_ERR(0, 10, __pyx_L3_error) } - } else if (unlikely(__pyx_nargs != 4)) { + } else if (unlikely(__pyx_nargs != 5)) { goto __pyx_L5_argtuple_error; } else { values[0] = __Pyx_Arg_FASTCALL(__pyx_args, 0); values[1] = __Pyx_Arg_FASTCALL(__pyx_args, 1); values[2] = __Pyx_Arg_FASTCALL(__pyx_args, 2); values[3] = __Pyx_Arg_FASTCALL(__pyx_args, 3); + values[4] = __Pyx_Arg_FASTCALL(__pyx_args, 4); } - __pyx_v_sequence_length = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_sequence_length == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 9, __pyx_L3_error) - __pyx_v_days = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_days == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 10, __pyx_L3_error) + __pyx_v_sequence_length = __Pyx_PyInt_As_int(values[0]); if (unlikely((__pyx_v_sequence_length == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 10, __pyx_L3_error) + __pyx_v_days = __Pyx_PyInt_As_int(values[1]); if (unlikely((__pyx_v_days == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 11, __pyx_L3_error) __pyx_v_model_name = ((PyObject*)values[2]); __pyx_v_algorithm = ((PyObject*)values[3]); + __pyx_v_with_pred = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_with_pred == (int)-1) && PyErr_Occurred())) __PYX_ERR(0, 11, __pyx_L3_error) } goto __pyx_L6_skip; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("forecasting_utils", 1, 4, 4, __pyx_nargs); __PYX_ERR(0, 9, __pyx_L3_error) + __Pyx_RaiseArgtupleInvalid("forecasting_utils", 1, 5, 5, __pyx_nargs); __PYX_ERR(0, 10, __pyx_L3_error) __pyx_L6_skip:; goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3551,9 +3572,9 @@ PyObject *__pyx_args, PyObject *__pyx_kwds __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_model_name), (&PyString_Type), 1, "model_name", 1))) __PYX_ERR(0, 10, __pyx_L1_error) - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_algorithm), (&PyString_Type), 1, "algorithm", 1))) __PYX_ERR(0, 10, __pyx_L1_error) - __pyx_r = __pyx_pf_9utilities_9Utilities_forecasting_utils(((struct __pyx_obj_9utilities_Utilities *)__pyx_v_self), __pyx_v_sequence_length, __pyx_v_days, __pyx_v_model_name, __pyx_v_algorithm); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_model_name), (&PyString_Type), 1, "model_name", 1))) __PYX_ERR(0, 11, __pyx_L1_error) + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_algorithm), (&PyString_Type), 1, "algorithm", 1))) __PYX_ERR(0, 11, __pyx_L1_error) + __pyx_r = __pyx_pf_9utilities_9Utilities_forecasting_utils(((struct __pyx_obj_9utilities_Utilities *)__pyx_v_self), __pyx_v_sequence_length, __pyx_v_days, __pyx_v_model_name, __pyx_v_algorithm, __pyx_v_with_pred); /* function exit code */ goto __pyx_L0; @@ -3570,7 +3591,7 @@ PyObject *__pyx_args, PyObject *__pyx_kwds return __pyx_r; } -static PyObject *__pyx_pf_9utilities_9Utilities_forecasting_utils(CYTHON_UNUSED struct __pyx_obj_9utilities_Utilities *__pyx_v_self, int __pyx_v_sequence_length, int __pyx_v_days, PyObject *__pyx_v_model_name, PyObject *__pyx_v_algorithm) { +static PyObject *__pyx_pf_9utilities_9Utilities_forecasting_utils(CYTHON_UNUSED struct __pyx_obj_9utilities_Utilities *__pyx_v_self, int __pyx_v_sequence_length, int __pyx_v_days, PyObject *__pyx_v_model_name, PyObject *__pyx_v_algorithm, int __pyx_v_with_pred) { struct __pyx_obj_9utilities___pyx_scope_struct__forecasting_utils *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3582,7 +3603,7 @@ static PyObject *__pyx_pf_9utilities_9Utilities_forecasting_utils(CYTHON_UNUSED if (unlikely(!__pyx_cur_scope)) { __pyx_cur_scope = ((struct __pyx_obj_9utilities___pyx_scope_struct__forecasting_utils *)Py_None); __Pyx_INCREF(Py_None); - __PYX_ERR(0, 9, __pyx_L1_error) + __PYX_ERR(0, 10, __pyx_L1_error) } else { __Pyx_GOTREF((PyObject *)__pyx_cur_scope); } @@ -3597,8 +3618,9 @@ static PyObject *__pyx_pf_9utilities_9Utilities_forecasting_utils(CYTHON_UNUSED __pyx_cur_scope->__pyx_v_algorithm = __pyx_v_algorithm; __Pyx_INCREF(__pyx_cur_scope->__pyx_v_algorithm); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_algorithm); + __pyx_cur_scope->__pyx_v_with_pred = __pyx_v_with_pred; { - __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_9utilities_9Utilities_2generator, __pyx_codeobj_, (PyObject *) __pyx_cur_scope, __pyx_n_s_forecasting_utils, __pyx_n_s_Utilities_forecasting_utils, __pyx_n_s_utilities); if (unlikely(!gen)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_CoroutineObject *gen = __Pyx_Coroutine_New((__pyx_coroutine_body_t) __pyx_gb_9utilities_9Utilities_2generator, __pyx_codeobj_, (PyObject *) __pyx_cur_scope, __pyx_n_s_forecasting_utils, __pyx_n_s_Utilities_forecasting_utils, __pyx_n_s_utilities); if (unlikely(!gen)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -3646,24 +3668,24 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 9, __pyx_L1_error) + if (unlikely(!__pyx_sent_value)) __PYX_ERR(0, 10, __pyx_L1_error) - /* "utilities.pyx":11 + /* "utilities.pyx":12 * async def forecasting_utils(self, int sequence_length, - * int days, str model_name, str algorithm) -> tuple: + * int days, str model_name, str algorithm, bint with_pred) -> tuple: * cdef str model_path = os.path.join(f'./resources/algorithms/{algorithm}/models', # <<<<<<<<<<<<<< * f'{model_name}.keras') * model = load_model(model_path) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 11, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 11, __pyx_L1_error) + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = 0; __pyx_t_5 = 127; @@ -3671,7 +3693,7 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_t_4 += 23; __Pyx_GIVEREF(__pyx_kp_u_resources_algorithms); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_u_resources_algorithms); - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_algorithm, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 11, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_algorithm, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); @@ -3682,20 +3704,20 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_t_4 += 7; __Pyx_GIVEREF(__pyx_kp_u_models); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_kp_u_models); - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 11, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_3, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "utilities.pyx":12 - * int days, str model_name, str algorithm) -> tuple: + /* "utilities.pyx":13 + * int days, str model_name, str algorithm, bint with_pred) -> tuple: * cdef str model_path = os.path.join(f'./resources/algorithms/{algorithm}/models', * f'{model_name}.keras') # <<<<<<<<<<<<<< * model = load_model(model_path) * */ - __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_model_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 12, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_model_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_3, __pyx_kp_u_keras); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 12, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_3, __pyx_kp_u_keras); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = NULL; @@ -3718,31 +3740,31 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 11, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "utilities.pyx":11 + /* "utilities.pyx":12 * async def forecasting_utils(self, int sequence_length, - * int days, str model_name, str algorithm) -> tuple: + * int days, str model_name, str algorithm, bint with_pred) -> tuple: * cdef str model_path = os.path.join(f'./resources/algorithms/{algorithm}/models', # <<<<<<<<<<<<<< * f'{model_name}.keras') * model = load_model(model_path) */ - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 11, __pyx_L1_error) + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_model_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "utilities.pyx":13 + /* "utilities.pyx":14 * cdef str model_path = os.path.join(f'./resources/algorithms/{algorithm}/models', * f'{model_name}.keras') * model = load_model(model_path) # <<<<<<<<<<<<<< * * cdef str dataframe_path = os.path.join(f'./resources/algorithms/{algorithm}/posttrained', */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_load_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 13, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_load_model); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_7 = NULL; __pyx_t_8 = 0; @@ -3762,7 +3784,7 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_cur_scope->__pyx_v_model_path}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } @@ -3770,22 +3792,22 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_cur_scope->__pyx_v_model = __pyx_t_1; __pyx_t_1 = 0; - /* "utilities.pyx":15 + /* "utilities.pyx":16 * model = load_model(model_path) * * cdef str dataframe_path = os.path.join(f'./resources/algorithms/{algorithm}/posttrained', # <<<<<<<<<<<<<< * f'{model_name}-posttrained.json') * dataframe = read_json(dataframe_path) */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_os); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_join); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = 0; __pyx_t_5 = 127; @@ -3793,7 +3815,7 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_t_4 += 23; __Pyx_GIVEREF(__pyx_kp_u_resources_algorithms); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_resources_algorithms); - __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_algorithm, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_algorithm, __pyx_empty_unicode); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_6) : __pyx_t_5; __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_6); @@ -3804,20 +3826,20 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_t_4 += 12; __Pyx_GIVEREF(__pyx_kp_u_posttrained); PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_kp_u_posttrained); - __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 15, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "utilities.pyx":16 + /* "utilities.pyx":17 * * cdef str dataframe_path = os.path.join(f'./resources/algorithms/{algorithm}/posttrained', * f'{model_name}-posttrained.json') # <<<<<<<<<<<<<< * dataframe = read_json(dataframe_path) * dataframe.set_index('Date', inplace=True) */ - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_model_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_model_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_7, __pyx_kp_u_posttrained_json); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 16, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_7, __pyx_kp_u_posttrained_json); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 17, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; @@ -3840,31 +3862,31 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 15, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "utilities.pyx":15 + /* "utilities.pyx":16 * model = load_model(model_path) * * cdef str dataframe_path = os.path.join(f'./resources/algorithms/{algorithm}/posttrained', # <<<<<<<<<<<<<< * f'{model_name}-posttrained.json') * dataframe = read_json(dataframe_path) */ - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 15, __pyx_L1_error) + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None) || __Pyx_RaiseUnexpectedTypeError("str", __pyx_t_1))) __PYX_ERR(0, 16, __pyx_L1_error) __Pyx_GIVEREF(__pyx_t_1); __pyx_cur_scope->__pyx_v_dataframe_path = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "utilities.pyx":17 + /* "utilities.pyx":18 * cdef str dataframe_path = os.path.join(f'./resources/algorithms/{algorithm}/posttrained', * f'{model_name}-posttrained.json') * dataframe = read_json(dataframe_path) # <<<<<<<<<<<<<< * dataframe.set_index('Date', inplace=True) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_read_json); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 17, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_read_json); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = NULL; __pyx_t_8 = 0; @@ -3884,7 +3906,7 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_cur_scope->__pyx_v_dataframe_path}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 17, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } @@ -3892,42 +3914,42 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_cur_scope->__pyx_v_dataframe = __pyx_t_1; __pyx_t_1 = 0; - /* "utilities.pyx":18 + /* "utilities.pyx":19 * f'{model_name}-posttrained.json') * dataframe = read_json(dataframe_path) * dataframe.set_index('Date', inplace=True) # <<<<<<<<<<<<<< * * minmax_scaler = load(os.path.join(f'./resources/algorithms/{algorithm}/pickles', */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_dataframe, __pyx_n_s_set_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_dataframe, __pyx_n_s_set_index); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_inplace, Py_True) < 0) __PYX_ERR(0, 18, __pyx_L1_error) - __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__2, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 18, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_inplace, Py_True) < 0) __PYX_ERR(0, 19, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_tuple__2, __pyx_t_2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __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; - /* "utilities.pyx":20 + /* "utilities.pyx":21 * dataframe.set_index('Date', inplace=True) * * minmax_scaler = load(os.path.join(f'./resources/algorithms/{algorithm}/pickles', # <<<<<<<<<<<<<< * f'{model_name}_minmax_scaler.pickle')) * standard_scaler = load(os.path.join(f'./resources/algorithms/{algorithm}/pickles', */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_os); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 20, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_os); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_path); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 21, __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_join); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_7, __pyx_n_s_join); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __pyx_t_4 = 0; __pyx_t_5 = 127; @@ -3935,7 +3957,7 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_t_4 += 23; __Pyx_GIVEREF(__pyx_kp_u_resources_algorithms); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_kp_u_resources_algorithms); - __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_algorithm, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_algorithm, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_5; __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); @@ -3946,20 +3968,20 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_t_4 += 8; __Pyx_GIVEREF(__pyx_kp_u_pickles); PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_kp_u_pickles); - __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 20, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_7, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - /* "utilities.pyx":21 + /* "utilities.pyx":22 * * minmax_scaler = load(os.path.join(f'./resources/algorithms/{algorithm}/pickles', * f'{model_name}_minmax_scaler.pickle')) # <<<<<<<<<<<<<< * standard_scaler = load(os.path.join(f'./resources/algorithms/{algorithm}/pickles', * f'{model_name}_standard_scaler.pickle')) */ - __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_model_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 21, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_model_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_7, __pyx_kp_u_minmax_scaler_pickle); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 21, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_7, __pyx_kp_u_minmax_scaler_pickle); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 22, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = NULL; @@ -3982,7 +4004,7 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 20, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } @@ -4005,7 +4027,7 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 20, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 21, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } @@ -4013,24 +4035,24 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_cur_scope->__pyx_v_minmax_scaler = __pyx_t_3; __pyx_t_3 = 0; - /* "utilities.pyx":22 + /* "utilities.pyx":23 * minmax_scaler = load(os.path.join(f'./resources/algorithms/{algorithm}/pickles', * f'{model_name}_minmax_scaler.pickle')) * standard_scaler = load(os.path.join(f'./resources/algorithms/{algorithm}/pickles', # <<<<<<<<<<<<<< * f'{model_name}_standard_scaler.pickle')) * */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_os); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_os); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_path); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_path); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_join); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s_join); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_10 = PyTuple_New(3); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); __pyx_t_4 = 0; __pyx_t_5 = 127; @@ -4038,7 +4060,7 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_t_4 += 23; __Pyx_GIVEREF(__pyx_kp_u_resources_algorithms); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_kp_u_resources_algorithms); - __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_algorithm, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_algorithm, __pyx_empty_unicode); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_5 = (__Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) > __pyx_t_5) ? __Pyx_PyUnicode_MAX_CHAR_VALUE(__pyx_t_9) : __pyx_t_5; __pyx_t_4 += __Pyx_PyUnicode_GET_LENGTH(__pyx_t_9); @@ -4049,20 +4071,20 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_t_4 += 8; __Pyx_GIVEREF(__pyx_kp_u_pickles); PyTuple_SET_ITEM(__pyx_t_10, 2, __pyx_kp_u_pickles); - __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_10, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 22, __pyx_L1_error) + __pyx_t_9 = __Pyx_PyUnicode_Join(__pyx_t_10, 3, __pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - /* "utilities.pyx":23 + /* "utilities.pyx":24 * f'{model_name}_minmax_scaler.pickle')) * standard_scaler = load(os.path.join(f'./resources/algorithms/{algorithm}/pickles', * f'{model_name}_standard_scaler.pickle')) # <<<<<<<<<<<<<< * - * # Prediction + * if with_pred: */ - __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_model_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_t_10 = __Pyx_PyObject_FormatSimple(__pyx_cur_scope->__pyx_v_model_name, __pyx_empty_unicode); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_10); - __pyx_t_7 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_10, __pyx_kp_u_standard_scaler_pickle); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 23, __pyx_L1_error) + __pyx_t_7 = __Pyx_PyUnicode_ConcatInPlace(__pyx_t_10, __pyx_kp_u_standard_scaler_pickle); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_10 = NULL; @@ -4085,7 +4107,7 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __Pyx_XDECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 22, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } @@ -4108,7 +4130,7 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 22, __pyx_L1_error) + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 23, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } @@ -4117,390 +4139,425 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_t_3 = 0; /* "utilities.pyx":26 + * f'{model_name}_standard_scaler.pickle')) * - * # Prediction - * lst_seq = dataframe[-sequence_length:].values # <<<<<<<<<<<<<< - * lst_seq = expand_dims(lst_seq, axis=0) - * - */ - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_dataframe, (-__pyx_cur_scope->__pyx_v_sequence_length), 0, NULL, NULL, NULL, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 26, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_lst_seq = __pyx_t_2; - __pyx_t_2 = 0; - - /* "utilities.pyx":27 - * # Prediction - * lst_seq = dataframe[-sequence_length:].values - * lst_seq = expand_dims(lst_seq, axis=0) # <<<<<<<<<<<<<< - * - * cdef dict predicted_prices = {} + * if with_pred: # <<<<<<<<<<<<<< + * # Prediction + * lst_seq = dataframe[-sequence_length:].values */ - __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_expand_dims); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_lst_seq); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_lst_seq); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_lst_seq)) __PYX_ERR(0, 27, __pyx_L1_error); - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 27, __pyx_L1_error) - __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 27, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_lst_seq); - __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_lst_seq, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; + if (__pyx_cur_scope->__pyx_v_with_pred) { - /* "utilities.pyx":29 - * lst_seq = expand_dims(lst_seq, axis=0) - * - * cdef dict predicted_prices = {} # <<<<<<<<<<<<<< - * last_date = to_datetime(dataframe.index[-1]) + /* "utilities.pyx":28 + * if with_pred: + * # Prediction + * lst_seq = dataframe[-sequence_length:].values # <<<<<<<<<<<<<< + * lst_seq = expand_dims(lst_seq, axis=0) * */ - __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 29, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_cur_scope->__pyx_v_predicted_prices = ((PyObject*)__pyx_t_6); - __pyx_t_6 = 0; + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_cur_scope->__pyx_v_dataframe, (-__pyx_cur_scope->__pyx_v_sequence_length), 0, NULL, NULL, NULL, 1, 0, 1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 28, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_lst_seq = __pyx_t_2; + __pyx_t_2 = 0; - /* "utilities.pyx":30 - * - * cdef dict predicted_prices = {} - * last_date = to_datetime(dataframe.index[-1]) # <<<<<<<<<<<<<< + /* "utilities.pyx":29 + * # Prediction + * lst_seq = dataframe[-sequence_length:].values + * lst_seq = expand_dims(lst_seq, axis=0) # <<<<<<<<<<<<<< * - * for _ in range(days): + * predicted_prices = {} */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_to_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_dataframe, __pyx_n_s_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 30, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = NULL; - __pyx_t_8 = 0; - #if CYTHON_UNPACK_METHODS - if (unlikely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_3)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_3); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_8 = 1; - } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_2}; - __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 30, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_2, __pyx_n_s_expand_dims); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_lst_seq); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_lst_seq); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_cur_scope->__pyx_v_lst_seq)) __PYX_ERR(0, 29, __pyx_L1_error); + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 29, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_axis, __pyx_int_0) < 0) __PYX_ERR(0, 29, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_Call(__pyx_t_2, __pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 29, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_GIVEREF(__pyx_t_6); - __pyx_cur_scope->__pyx_v_last_date = __pyx_t_6; - __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_lst_seq); + __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_lst_seq, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; - /* "utilities.pyx":32 - * last_date = to_datetime(dataframe.index[-1]) + /* "utilities.pyx":31 + * lst_seq = expand_dims(lst_seq, axis=0) + * + * predicted_prices = {} # <<<<<<<<<<<<<< + * last_date = to_datetime(dataframe.index[-1]) * - * for _ in range(days): # <<<<<<<<<<<<<< - * predicted_price = model.predict(lst_seq) - * last_date = last_date + Timedelta(days=1) */ - __pyx_t_8 = __pyx_cur_scope->__pyx_v_days; - __pyx_t_11 = __pyx_t_8; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_cur_scope->__pyx_v__ = __pyx_t_12; + __pyx_t_6 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 31, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_cur_scope->__pyx_v_predicted_prices = ((PyObject*)__pyx_t_6); + __pyx_t_6 = 0; - /* "utilities.pyx":33 + /* "utilities.pyx":32 * - * for _ in range(days): - * predicted_price = model.predict(lst_seq) # <<<<<<<<<<<<<< - * last_date = last_date + Timedelta(days=1) + * predicted_prices = {} + * last_date = to_datetime(dataframe.index[-1]) # <<<<<<<<<<<<<< * + * for _ in range(days): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_model, __pyx_n_s_predict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 33, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_to_datetime); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = NULL; - __pyx_t_13 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_dataframe, __pyx_n_s_index); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, -1L, long, 1, __Pyx_PyInt_From_long, 0, 1, 1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 32, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = NULL; + __pyx_t_8 = 0; #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_1))) { - __pyx_t_2 = PyMethod_GET_SELF(__pyx_t_1); - if (likely(__pyx_t_2)) { + if (unlikely(PyMethod_Check(__pyx_t_1))) { + __pyx_t_3 = PyMethod_GET_SELF(__pyx_t_1); + if (likely(__pyx_t_3)) { PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_1); - __Pyx_INCREF(__pyx_t_2); + __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(function); __Pyx_DECREF_SET(__pyx_t_1, function); - __pyx_t_13 = 1; + __pyx_t_8 = 1; } } #endif { - PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_lst_seq}; - __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13); - __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 33, __pyx_L1_error) + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_2}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 32, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_predicted_price); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_predicted_price, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); + __pyx_cur_scope->__pyx_v_last_date = __pyx_t_6; __pyx_t_6 = 0; /* "utilities.pyx":34 - * for _ in range(days): - * predicted_price = model.predict(lst_seq) - * last_date = last_date + Timedelta(days=1) # <<<<<<<<<<<<<< + * last_date = to_datetime(dataframe.index[-1]) * - * predicted_prices[last_date] = minmax_scaler.inverse_transform(predicted_price) + * for _ in range(days): # <<<<<<<<<<<<<< + * predicted_price = model.predict(lst_seq) + * last_date = last_date + Timedelta(days=1) */ - __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Timedelta); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_days, __pyx_int_1) < 0) __PYX_ERR(0, 34, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_cur_scope->__pyx_v_last_date, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 34, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_last_date); - __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_last_date, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_8 = __pyx_cur_scope->__pyx_v_days; + __pyx_t_11 = __pyx_t_8; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_cur_scope->__pyx_v__ = __pyx_t_12; - /* "utilities.pyx":36 - * last_date = last_date + Timedelta(days=1) + /* "utilities.pyx":35 * - * predicted_prices[last_date] = minmax_scaler.inverse_transform(predicted_price) # <<<<<<<<<<<<<< - * predicted_prices[last_date] = standard_scaler.inverse_transform(predicted_prices[last_date]) + * for _ in range(days): + * predicted_price = model.predict(lst_seq) # <<<<<<<<<<<<<< + * last_date = last_date + Timedelta(days=1) * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_minmax_scaler, __pyx_n_s_inverse_transform); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = NULL; - __pyx_t_13 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_2))) { - __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); - if (likely(__pyx_t_6)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); - __Pyx_INCREF(__pyx_t_6); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_2, function); - __pyx_t_13 = 1; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_model, __pyx_n_s_predict); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = NULL; + __pyx_t_13 = 0; + #if CYTHON_UNPACK_METHODS + if (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); + __pyx_t_13 = 1; + } } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_predicted_price}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13); - __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_2, __pyx_cur_scope->__pyx_v_lst_seq}; + __pyx_t_6 = __Pyx_PyObject_FastCall(__pyx_t_1, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13); + __Pyx_XDECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 35, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_predicted_price); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_predicted_price, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + + /* "utilities.pyx":36 + * for _ in range(days): + * predicted_price = model.predict(lst_seq) + * last_date = last_date + Timedelta(days=1) # <<<<<<<<<<<<<< + * + * predicted_prices[last_date] = minmax_scaler.inverse_transform(predicted_price) + */ + __Pyx_GetModuleGlobalName(__pyx_t_6, __pyx_n_s_Timedelta); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_days, __pyx_int_1) < 0) __PYX_ERR(0, 36, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_6, __pyx_empty_tuple, __pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 36, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_cur_scope->__pyx_v_last_date, __pyx_t_2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 36, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - if (unlikely((PyDict_SetItem(__pyx_cur_scope->__pyx_v_predicted_prices, __pyx_cur_scope->__pyx_v_last_date, __pyx_t_1) < 0))) __PYX_ERR(0, 36, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_last_date); + __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_last_date, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; - /* "utilities.pyx":37 + /* "utilities.pyx":38 + * last_date = last_date + Timedelta(days=1) * - * predicted_prices[last_date] = minmax_scaler.inverse_transform(predicted_price) - * predicted_prices[last_date] = standard_scaler.inverse_transform(predicted_prices[last_date]) # <<<<<<<<<<<<<< + * predicted_prices[last_date] = minmax_scaler.inverse_transform(predicted_price) # <<<<<<<<<<<<<< + * predicted_prices[last_date] = standard_scaler.inverse_transform(predicted_prices[last_date]) * - * lst_seq = append(lst_seq[:, 1:, :], [predicted_price], axis=1) */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_standard_scaler, __pyx_n_s_inverse_transform); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_predicted_prices, __pyx_cur_scope->__pyx_v_last_date); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = NULL; - __pyx_t_13 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(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_13 = 1; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_minmax_scaler, __pyx_n_s_inverse_transform); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = NULL; + __pyx_t_13 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_2))) { + __pyx_t_6 = PyMethod_GET_SELF(__pyx_t_2); + if (likely(__pyx_t_6)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_2); + __Pyx_INCREF(__pyx_t_6); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_2, function); + __pyx_t_13 = 1; + } } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6}; - __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13); - __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - } - if (unlikely((PyDict_SetItem(__pyx_cur_scope->__pyx_v_predicted_prices, __pyx_cur_scope->__pyx_v_last_date, __pyx_t_1) < 0))) __PYX_ERR(0, 37, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_6, __pyx_cur_scope->__pyx_v_predicted_price}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13); + __Pyx_XDECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + if (unlikely((PyDict_SetItem(__pyx_cur_scope->__pyx_v_predicted_prices, __pyx_cur_scope->__pyx_v_last_date, __pyx_t_1) < 0))) __PYX_ERR(0, 38, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "utilities.pyx":39 - * predicted_prices[last_date] = standard_scaler.inverse_transform(predicted_prices[last_date]) + /* "utilities.pyx":39 * - * lst_seq = append(lst_seq[:, 1:, :], [predicted_price], axis=1) # <<<<<<<<<<<<<< + * predicted_prices[last_date] = minmax_scaler.inverse_transform(predicted_price) + * predicted_prices[last_date] = standard_scaler.inverse_transform(predicted_prices[last_date]) # <<<<<<<<<<<<<< * - * predictions = [ + * lst_seq = append(lst_seq[:, 1:, :], [predicted_price], axis=1) */ - __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_append); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_lst_seq, __pyx_tuple__5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - __Pyx_INCREF(__pyx_cur_scope->__pyx_v_predicted_price); - __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_predicted_price); - if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_predicted_price)) __PYX_ERR(0, 39, __pyx_L1_error); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_2); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error); - __Pyx_GIVEREF(__pyx_t_6); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error); - __pyx_t_2 = 0; - __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_6); - if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 39, __pyx_L1_error) - __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __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_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_lst_seq); - __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_lst_seq, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - } + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_standard_scaler, __pyx_n_s_inverse_transform); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = __Pyx_PyDict_GetItem(__pyx_cur_scope->__pyx_v_predicted_prices, __pyx_cur_scope->__pyx_v_last_date); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = NULL; + __pyx_t_13 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(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_13 = 1; + } + } + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_3, __pyx_t_6}; + __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_2, __pyx_callargs+1-__pyx_t_13, 1+__pyx_t_13); + __Pyx_XDECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + if (unlikely((PyDict_SetItem(__pyx_cur_scope->__pyx_v_predicted_prices, __pyx_cur_scope->__pyx_v_last_date, __pyx_t_1) < 0))) __PYX_ERR(0, 39, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "utilities.pyx":41 - * lst_seq = append(lst_seq[:, 1:, :], [predicted_price], axis=1) + /* "utilities.pyx":41 + * predicted_prices[last_date] = standard_scaler.inverse_transform(predicted_prices[last_date]) + * + * lst_seq = append(lst_seq[:, 1:, :], [predicted_price], axis=1) # <<<<<<<<<<<<<< * - * predictions = [ # <<<<<<<<<<<<<< - * {'date': date.strftime('%Y-%m-%d'), 'price': float(price)} \ - * for date, price in predicted_prices.items() + * predictions = [ */ - { /* enter inner scope */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_2); + __Pyx_GetModuleGlobalName(__pyx_t_1, __pyx_n_s_append); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetItem(__pyx_cur_scope->__pyx_v_lst_seq, __pyx_tuple__5); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_predicted_price); + __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_predicted_price); + if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_predicted_price)) __PYX_ERR(0, 41, __pyx_L1_error); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GIVEREF(__pyx_t_2); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2)) __PYX_ERR(0, 41, __pyx_L1_error); + __Pyx_GIVEREF(__pyx_t_6); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_6)) __PYX_ERR(0, 41, __pyx_L1_error); + __pyx_t_2 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 41, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_6); + if (PyDict_SetItem(__pyx_t_6, __pyx_n_s_axis, __pyx_int_1) < 0) __PYX_ERR(0, 41, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Call(__pyx_t_1, __pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 41, __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_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_cur_scope->__pyx_v_lst_seq); + __Pyx_DECREF_SET(__pyx_cur_scope->__pyx_v_lst_seq, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + } /* "utilities.pyx":43 - * predictions = [ - * {'date': date.strftime('%Y-%m-%d'), 'price': float(price)} \ - * for date, price in predicted_prices.items() # <<<<<<<<<<<<<< - * ] + * lst_seq = append(lst_seq[:, 1:, :], [predicted_price], axis=1) * + * predictions = [ # <<<<<<<<<<<<<< + * {'date': date.strftime('%Y-%m-%d'), 'price': float(price)} \ + * for date, price in predicted_prices.items() */ - __pyx_t_4 = 0; - __pyx_t_3 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_predicted_prices, 1, __pyx_n_s_items, (&__pyx_t_14), (&__pyx_t_8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 43, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_6); - __pyx_t_6 = __pyx_t_3; - __pyx_t_3 = 0; - while (1) { - __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_14, &__pyx_t_4, &__pyx_t_3, &__pyx_t_1, NULL, __pyx_t_8); - if (unlikely(__pyx_t_11 == 0)) break; - if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 43, __pyx_L1_error) + { /* enter inner scope */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + + /* "utilities.pyx":45 + * predictions = [ + * {'date': date.strftime('%Y-%m-%d'), 'price': float(price)} \ + * for date, price in predicted_prices.items() # <<<<<<<<<<<<<< + * ] + * + */ + __pyx_t_4 = 0; + __pyx_t_3 = __Pyx_dict_iterator(__pyx_cur_scope->__pyx_v_predicted_prices, 1, __pyx_n_s_items, (&__pyx_t_14), (&__pyx_t_8)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 45, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_GOTREF(__pyx_t_1); - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_7genexpr__pyx_v_date); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_7genexpr__pyx_v_date, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_6); + __pyx_t_6 = __pyx_t_3; __pyx_t_3 = 0; - __Pyx_XGOTREF(__pyx_cur_scope->__pyx_7genexpr__pyx_v_price); - __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_7genexpr__pyx_v_price, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - - /* "utilities.pyx":42 + while (1) { + __pyx_t_11 = __Pyx_dict_iter_next(__pyx_t_6, __pyx_t_14, &__pyx_t_4, &__pyx_t_3, &__pyx_t_1, NULL, __pyx_t_8); + if (unlikely(__pyx_t_11 == 0)) break; + if (unlikely(__pyx_t_11 == -1)) __PYX_ERR(0, 45, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_7genexpr__pyx_v_date); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_7genexpr__pyx_v_date, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_7genexpr__pyx_v_price); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_7genexpr__pyx_v_price, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + + /* "utilities.pyx":44 * - * predictions = [ - * {'date': date.strftime('%Y-%m-%d'), 'price': float(price)} \ # <<<<<<<<<<<<<< - * for date, price in predicted_prices.items() - * ] + * predictions = [ + * {'date': date.strftime('%Y-%m-%d'), 'price': float(price)} \ # <<<<<<<<<<<<<< + * for date, price in predicted_prices.items() + * ] */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_7genexpr__pyx_v_date, __pyx_n_s_strftime); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_9 = NULL; - __pyx_t_11 = 0; - #if CYTHON_UNPACK_METHODS - if (likely(PyMethod_Check(__pyx_t_7))) { - __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); - if (likely(__pyx_t_9)) { - PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); - __Pyx_INCREF(__pyx_t_9); - __Pyx_INCREF(function); - __Pyx_DECREF_SET(__pyx_t_7, function); - __pyx_t_11 = 1; + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_7genexpr__pyx_v_date, __pyx_n_s_strftime); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_9 = NULL; + __pyx_t_11 = 0; + #if CYTHON_UNPACK_METHODS + if (likely(PyMethod_Check(__pyx_t_7))) { + __pyx_t_9 = PyMethod_GET_SELF(__pyx_t_7); + if (likely(__pyx_t_9)) { + PyObject* function = PyMethod_GET_FUNCTION(__pyx_t_7); + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(function); + __Pyx_DECREF_SET(__pyx_t_7, function); + __pyx_t_11 = 1; + } } - } - #endif - { - PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_kp_s_Y_m_d}; - __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11); - __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) + #endif + { + PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_kp_s_Y_m_d}; + __pyx_t_3 = __Pyx_PyObject_FastCall(__pyx_t_7, __pyx_callargs+1-__pyx_t_11, 1+__pyx_t_11); + __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; + if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + } + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_date, __pyx_t_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyNumber_Float(__pyx_cur_scope->__pyx_7genexpr__pyx_v_price); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_price, __pyx_t_3) < 0) __PYX_ERR(0, 44, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 43, __pyx_L1_error) + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_date, __pyx_t_3) < 0) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_Float(__pyx_cur_scope->__pyx_7genexpr__pyx_v_price); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_price, __pyx_t_3) < 0) __PYX_ERR(0, 42, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 41, __pyx_L1_error) - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - } /* exit inner scope */ - __Pyx_GIVEREF(__pyx_t_2); - __pyx_cur_scope->__pyx_v_predictions = ((PyObject*)__pyx_t_2); - __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + } /* exit inner scope */ + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_predictions = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; - /* "utilities.pyx":47 + /* "utilities.pyx":26 + * f'{model_name}_standard_scaler.pickle')) + * + * if with_pred: # <<<<<<<<<<<<<< + * # Prediction + * lst_seq = dataframe[-sequence_length:].values + */ + goto __pyx_L4; + } + + /* "utilities.pyx":48 + * ] + * + * else: predictions = [] # <<<<<<<<<<<<<< + * + * # Actual + */ + /*else*/ { + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GOTREF(__pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_cur_scope->__pyx_v_predictions = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + } + __pyx_L4:; + + /* "utilities.pyx":51 * * # Actual * df_date = dataframe.index[-sequence_length:].values # <<<<<<<<<<<<<< * df_date = [to_datetime(date) for date in df_date] * */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_dataframe, __pyx_n_s_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_dataframe, __pyx_n_s_index); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_t_2, (-__pyx_cur_scope->__pyx_v_sequence_length), 0, NULL, NULL, NULL, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_t_2, (-__pyx_cur_scope->__pyx_v_sequence_length), 0, NULL, NULL, NULL, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 47, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s_values); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_GIVEREF(__pyx_t_2); __pyx_cur_scope->__pyx_v_df_date = __pyx_t_2; __pyx_t_2 = 0; - /* "utilities.pyx":48 + /* "utilities.pyx":52 * # Actual * df_date = dataframe.index[-sequence_length:].values * df_date = [to_datetime(date) for date in df_date] # <<<<<<<<<<<<<< @@ -4508,16 +4565,16 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject * dataframe[['Close']] = minmax_scaler.inverse_transform(dataframe) */ { /* enter inner scope */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (likely(PyList_CheckExact(__pyx_cur_scope->__pyx_v_df_date)) || PyTuple_CheckExact(__pyx_cur_scope->__pyx_v_df_date)) { __pyx_t_6 = __pyx_cur_scope->__pyx_v_df_date; __Pyx_INCREF(__pyx_t_6); __pyx_t_14 = 0; __pyx_t_15 = NULL; } else { - __pyx_t_14 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_df_date); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_14 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_cur_scope->__pyx_v_df_date); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_6); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 52, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_15)) { @@ -4525,28 +4582,28 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_6); #if !CYTHON_ASSUME_SAFE_MACROS - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 48, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 52, __pyx_L1_error) #endif if (__pyx_t_14 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 52, __pyx_L1_error) #else - __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_6); #if !CYTHON_ASSUME_SAFE_MACROS - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 48, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 52, __pyx_L1_error) #endif if (__pyx_t_14 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 52, __pyx_L1_error) #else - __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_6, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } @@ -4556,7 +4613,7 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 48, __pyx_L1_error) + else __PYX_ERR(0, 52, __pyx_L1_error) } break; } @@ -4566,7 +4623,7 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_8genexpr1__pyx_v_date, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_to_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 48, __pyx_L1_error) + __Pyx_GetModuleGlobalName(__pyx_t_3, __pyx_n_s_to_datetime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = NULL; __pyx_t_8 = 0; @@ -4586,11 +4643,11 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject PyObject *__pyx_callargs[2] = {__pyx_t_7, __pyx_cur_scope->__pyx_8genexpr1__pyx_v_date}; __pyx_t_1 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_7); __pyx_t_7 = 0; - if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 48, __pyx_L1_error) + if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 48, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 52, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -4600,14 +4657,14 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - /* "utilities.pyx":50 + /* "utilities.pyx":54 * df_date = [to_datetime(date) for date in df_date] * * dataframe[['Close']] = minmax_scaler.inverse_transform(dataframe) # <<<<<<<<<<<<<< * dataframe[['Close']] = standard_scaler.inverse_transform(dataframe) * df_close = dataframe.iloc[-sequence_length:]['Close'].values */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_minmax_scaler, __pyx_n_s_inverse_transform); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_minmax_scaler, __pyx_n_s_inverse_transform); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = NULL; __pyx_t_8 = 0; @@ -4627,27 +4684,27 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_cur_scope->__pyx_v_dataframe}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 50, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 50, __pyx_L1_error) + __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_n_s_Close); __Pyx_GIVEREF(__pyx_n_s_Close); - if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_Close)) __PYX_ERR(0, 50, __pyx_L1_error); - if (unlikely((PyObject_SetItem(__pyx_cur_scope->__pyx_v_dataframe, __pyx_t_6, __pyx_t_2) < 0))) __PYX_ERR(0, 50, __pyx_L1_error) + if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_Close)) __PYX_ERR(0, 54, __pyx_L1_error); + if (unlikely((PyObject_SetItem(__pyx_cur_scope->__pyx_v_dataframe, __pyx_t_6, __pyx_t_2) < 0))) __PYX_ERR(0, 54, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "utilities.pyx":51 + /* "utilities.pyx":55 * * dataframe[['Close']] = minmax_scaler.inverse_transform(dataframe) * dataframe[['Close']] = standard_scaler.inverse_transform(dataframe) # <<<<<<<<<<<<<< * df_close = dataframe.iloc[-sequence_length:]['Close'].values * */ - __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_standard_scaler, __pyx_n_s_inverse_transform); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_standard_scaler, __pyx_n_s_inverse_transform); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __pyx_t_1 = NULL; __pyx_t_8 = 0; @@ -4667,42 +4724,42 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject PyObject *__pyx_callargs[2] = {__pyx_t_1, __pyx_cur_scope->__pyx_v_dataframe}; __pyx_t_2 = __Pyx_PyObject_FastCall(__pyx_t_6, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 51, __pyx_L1_error) + if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 51, __pyx_L1_error) + __pyx_t_6 = PyList_New(1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_n_s_Close); __Pyx_GIVEREF(__pyx_n_s_Close); - if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_Close)) __PYX_ERR(0, 51, __pyx_L1_error); - if (unlikely((PyObject_SetItem(__pyx_cur_scope->__pyx_v_dataframe, __pyx_t_6, __pyx_t_2) < 0))) __PYX_ERR(0, 51, __pyx_L1_error) + if (__Pyx_PyList_SET_ITEM(__pyx_t_6, 0, __pyx_n_s_Close)) __PYX_ERR(0, 55, __pyx_L1_error); + if (unlikely((PyObject_SetItem(__pyx_cur_scope->__pyx_v_dataframe, __pyx_t_6, __pyx_t_2) < 0))) __PYX_ERR(0, 55, __pyx_L1_error) __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "utilities.pyx":52 + /* "utilities.pyx":56 * dataframe[['Close']] = minmax_scaler.inverse_transform(dataframe) * dataframe[['Close']] = standard_scaler.inverse_transform(dataframe) * df_close = dataframe.iloc[-sequence_length:]['Close'].values # <<<<<<<<<<<<<< * * actuals = [ */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_dataframe, __pyx_n_s_iloc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_dataframe, __pyx_n_s_iloc); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_t_2, (-__pyx_cur_scope->__pyx_v_sequence_length), 0, NULL, NULL, NULL, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetSlice(__pyx_t_2, (-__pyx_cur_scope->__pyx_v_sequence_length), 0, NULL, NULL, NULL, 1, 0, 1); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_6, __pyx_n_s_Close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyObject_Dict_GetItem(__pyx_t_6, __pyx_n_s_Close); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __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_values); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 52, __pyx_L1_error) + __pyx_t_6 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_values); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 56, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_6); __pyx_cur_scope->__pyx_v_df_close = __pyx_t_6; __pyx_t_6 = 0; - /* "utilities.pyx":54 + /* "utilities.pyx":58 * df_close = dataframe.iloc[-sequence_length:]['Close'].values * * actuals = [ # <<<<<<<<<<<<<< @@ -4710,25 +4767,25 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject * for date, close in zip(df_date, df_close) */ { /* enter inner scope */ - __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 54, __pyx_L1_error) + __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); - /* "utilities.pyx":56 + /* "utilities.pyx":60 * actuals = [ * {'date': date.strftime('%Y-%m-%d'), 'price': close} \ * for date, close in zip(df_date, df_close) # <<<<<<<<<<<<<< * ] * */ - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_df_date); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_df_date); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_df_date)) __PYX_ERR(0, 56, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_cur_scope->__pyx_v_df_date)) __PYX_ERR(0, 60, __pyx_L1_error); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_df_close); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_df_close); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_cur_scope->__pyx_v_df_close)) __PYX_ERR(0, 56, __pyx_L1_error); - __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_cur_scope->__pyx_v_df_close)) __PYX_ERR(0, 60, __pyx_L1_error); + __pyx_t_1 = __Pyx_PyObject_Call(__pyx_builtin_zip, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (likely(PyList_CheckExact(__pyx_t_1)) || PyTuple_CheckExact(__pyx_t_1)) { @@ -4736,9 +4793,9 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_t_14 = 0; __pyx_t_15 = NULL; } else { - __pyx_t_14 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_14 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_15 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_2); if (unlikely(!__pyx_t_15)) __PYX_ERR(0, 60, __pyx_L1_error) } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { @@ -4747,28 +4804,28 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject { Py_ssize_t __pyx_temp = __Pyx_PyList_GET_SIZE(__pyx_t_2); #if !CYTHON_ASSUME_SAFE_MACROS - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 56, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 60, __pyx_L1_error) #endif if (__pyx_t_14 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 60, __pyx_L1_error) #else - __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } else { { Py_ssize_t __pyx_temp = __Pyx_PyTuple_GET_SIZE(__pyx_t_2); #if !CYTHON_ASSUME_SAFE_MACROS - if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 56, __pyx_L1_error) + if (unlikely((__pyx_temp < 0))) __PYX_ERR(0, 60, __pyx_L1_error) #endif if (__pyx_t_14 >= __pyx_temp) break; } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely((0 < 0))) __PYX_ERR(0, 60, __pyx_L1_error) #else - __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_1 = __Pyx_PySequence_ITEM(__pyx_t_2, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); #endif } @@ -4778,7 +4835,7 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(__Pyx_PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); - else __PYX_ERR(0, 56, __pyx_L1_error) + else __PYX_ERR(0, 60, __pyx_L1_error) } break; } @@ -4790,7 +4847,7 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - __PYX_ERR(0, 56, __pyx_L1_error) + __PYX_ERR(0, 60, __pyx_L1_error) } #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS if (likely(PyTuple_CheckExact(sequence))) { @@ -4803,32 +4860,32 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_7); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_7 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 60, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_16 = __Pyx_PyObject_GetIterNextFunc(__pyx_t_9); - index = 0; __pyx_t_3 = __pyx_t_16(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L13_unpacking_failed; + index = 0; __pyx_t_3 = __pyx_t_16(__pyx_t_9); if (unlikely(!__pyx_t_3)) goto __pyx_L14_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); - index = 1; __pyx_t_7 = __pyx_t_16(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L13_unpacking_failed; + index = 1; __pyx_t_7 = __pyx_t_16(__pyx_t_9); if (unlikely(!__pyx_t_7)) goto __pyx_L14_unpacking_failed; __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_9), 2) < 0) __PYX_ERR(0, 56, __pyx_L1_error) + if (__Pyx_IternextUnpackEndCheck(__pyx_t_16(__pyx_t_9), 2) < 0) __PYX_ERR(0, 60, __pyx_L1_error) __pyx_t_16 = NULL; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - goto __pyx_L14_unpacking_done; - __pyx_L13_unpacking_failed:; + goto __pyx_L15_unpacking_done; + __pyx_L14_unpacking_failed:; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_16 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - __PYX_ERR(0, 56, __pyx_L1_error) - __pyx_L14_unpacking_done:; + __PYX_ERR(0, 60, __pyx_L1_error) + __pyx_L15_unpacking_done:; } __Pyx_XGOTREF(__pyx_cur_scope->__pyx_8genexpr2__pyx_v_date); __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_8genexpr2__pyx_v_date, __pyx_t_3); @@ -4839,16 +4896,16 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - /* "utilities.pyx":55 + /* "utilities.pyx":59 * * actuals = [ * {'date': date.strftime('%Y-%m-%d'), 'price': close} \ # <<<<<<<<<<<<<< * for date, close in zip(df_date, df_close) * ] */ - __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_1 = __Pyx_PyDict_NewPresized(2); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_8genexpr2__pyx_v_date, __pyx_n_s_strftime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 55, __pyx_L1_error) + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_8genexpr2__pyx_v_date, __pyx_n_s_strftime); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_9 = NULL; __pyx_t_8 = 0; @@ -4868,17 +4925,17 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject PyObject *__pyx_callargs[2] = {__pyx_t_9, __pyx_kp_s_Y_m_d}; __pyx_t_7 = __Pyx_PyObject_FastCall(__pyx_t_3, __pyx_callargs+1-__pyx_t_8, 1+__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = 0; - if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 55, __pyx_L1_error) + if (unlikely(!__pyx_t_7)) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_date, __pyx_t_7) < 0) __PYX_ERR(0, 55, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_date, __pyx_t_7) < 0) __PYX_ERR(0, 59, __pyx_L1_error) __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_price, __pyx_cur_scope->__pyx_8genexpr2__pyx_v_close) < 0) __PYX_ERR(0, 55, __pyx_L1_error) - if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 54, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_1, __pyx_n_s_price, __pyx_cur_scope->__pyx_8genexpr2__pyx_v_close) < 0) __PYX_ERR(0, 59, __pyx_L1_error) + if (unlikely(__Pyx_ListComp_Append(__pyx_t_6, (PyObject*)__pyx_t_1))) __PYX_ERR(0, 58, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "utilities.pyx":56 + /* "utilities.pyx":60 * actuals = [ * {'date': date.strftime('%Y-%m-%d'), 'price': close} \ * for date, close in zip(df_date, df_close) # <<<<<<<<<<<<<< @@ -4892,31 +4949,31 @@ static PyObject *__pyx_gb_9utilities_9Utilities_2generator(__pyx_CoroutineObject __pyx_cur_scope->__pyx_v_actuals = ((PyObject*)__pyx_t_6); __pyx_t_6 = 0; - /* "utilities.pyx":59 + /* "utilities.pyx":63 * ] * * return actuals, predictions # <<<<<<<<<<<<<< * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 59, __pyx_L1_error) + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) __PYX_ERR(0, 63, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_actuals); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_actuals); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_actuals)) __PYX_ERR(0, 59, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_cur_scope->__pyx_v_actuals)) __PYX_ERR(0, 63, __pyx_L1_error); __Pyx_INCREF(__pyx_cur_scope->__pyx_v_predictions); __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_predictions); - if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_cur_scope->__pyx_v_predictions)) __PYX_ERR(0, 59, __pyx_L1_error); + if (__Pyx_PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_cur_scope->__pyx_v_predictions)) __PYX_ERR(0, 63, __pyx_L1_error); __pyx_r = NULL; __Pyx_ReturnWithStopIteration(__pyx_t_6); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L0; CYTHON_MAYBE_UNUSED_VAR(__pyx_cur_scope); - /* "utilities.pyx":9 + /* "utilities.pyx":10 * * cdef class Utilities: * async def forecasting_utils(self, int sequence_length, # <<<<<<<<<<<<<< - * int days, str model_name, str algorithm) -> tuple: + * int days, str model_name, str algorithm, bint with_pred) -> tuple: * cdef str model_path = os.path.join(f'./resources/algorithms/{algorithm}/models', */ @@ -6258,6 +6315,7 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { {&__pyx_n_s_utilities, __pyx_k_utilities, sizeof(__pyx_k_utilities), 0, 0, 1, 1}, {&__pyx_kp_s_utilities_pyx, __pyx_k_utilities_pyx, sizeof(__pyx_k_utilities_pyx), 0, 0, 1, 0}, {&__pyx_n_s_values, __pyx_k_values, sizeof(__pyx_k_values), 0, 0, 1, 1}, + {&__pyx_n_s_with_pred, __pyx_k_with_pred, sizeof(__pyx_k_with_pred), 0, 0, 1, 1}, {&__pyx_n_s_zip, __pyx_k_zip, sizeof(__pyx_k_zip), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; @@ -6265,8 +6323,8 @@ static int __Pyx_CreateStringTabAndInitStrings(void) { } /* #### Code section: cached_builtins ### */ static CYTHON_SMALL_CODE int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 32, __pyx_L1_error) - __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 56, __pyx_L1_error) + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s_range); if (!__pyx_builtin_range) __PYX_ERR(0, 34, __pyx_L1_error) + __pyx_builtin_zip = __Pyx_GetBuiltinName(__pyx_n_s_zip); if (!__pyx_builtin_zip) __PYX_ERR(0, 60, __pyx_L1_error) return 0; __pyx_L1_error:; return -1; @@ -6277,31 +6335,31 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "utilities.pyx":18 + /* "utilities.pyx":19 * f'{model_name}-posttrained.json') * dataframe = read_json(dataframe_path) * dataframe.set_index('Date', inplace=True) # <<<<<<<<<<<<<< * * minmax_scaler = load(os.path.join(f'./resources/algorithms/{algorithm}/pickles', */ - __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_Date); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 18, __pyx_L1_error) + __pyx_tuple__2 = PyTuple_Pack(1, __pyx_n_s_Date); if (unlikely(!__pyx_tuple__2)) __PYX_ERR(0, 19, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__2); __Pyx_GIVEREF(__pyx_tuple__2); - /* "utilities.pyx":39 - * predicted_prices[last_date] = standard_scaler.inverse_transform(predicted_prices[last_date]) + /* "utilities.pyx":41 + * predicted_prices[last_date] = standard_scaler.inverse_transform(predicted_prices[last_date]) * - * lst_seq = append(lst_seq[:, 1:, :], [predicted_price], axis=1) # <<<<<<<<<<<<<< + * lst_seq = append(lst_seq[:, 1:, :], [predicted_price], axis=1) # <<<<<<<<<<<<<< * - * predictions = [ + * predictions = [ */ - __pyx_slice__3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_slice__3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_slice__3)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice__3); __Pyx_GIVEREF(__pyx_slice__3); - __pyx_slice__4 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__4)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_slice__4 = PySlice_New(__pyx_int_1, Py_None, Py_None); if (unlikely(!__pyx_slice__4)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_slice__4); __Pyx_GIVEREF(__pyx_slice__4); - __pyx_tuple__5 = PyTuple_Pack(3, __pyx_slice__3, __pyx_slice__4, __pyx_slice__3); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 39, __pyx_L1_error) + __pyx_tuple__5 = PyTuple_Pack(3, __pyx_slice__3, __pyx_slice__4, __pyx_slice__3); if (unlikely(!__pyx_tuple__5)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__5); __Pyx_GIVEREF(__pyx_tuple__5); @@ -6316,17 +6374,17 @@ static CYTHON_SMALL_CODE int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_tuple__6); __Pyx_GIVEREF(__pyx_tuple__6); - /* "utilities.pyx":9 + /* "utilities.pyx":10 * * cdef class Utilities: * async def forecasting_utils(self, int sequence_length, # <<<<<<<<<<<<<< - * int days, str model_name, str algorithm) -> tuple: + * int days, str model_name, str algorithm, bint with_pred) -> tuple: * cdef str model_path = os.path.join(f'./resources/algorithms/{algorithm}/models', */ - __pyx_tuple__10 = PyTuple_Pack(25, __pyx_n_s_self, __pyx_n_s_sequence_length, __pyx_n_s_days, __pyx_n_s_model_name, __pyx_n_s_algorithm, __pyx_n_s_model_path, __pyx_n_s_model, __pyx_n_s_dataframe_path, __pyx_n_s_dataframe, __pyx_n_s_minmax_scaler, __pyx_n_s_standard_scaler, __pyx_n_s_lst_seq, __pyx_n_s_predicted_prices, __pyx_n_s_last_date, __pyx_n_s__9, __pyx_n_s_predicted_price, __pyx_n_s_predictions, __pyx_n_s_df_date, __pyx_n_s_df_close, __pyx_n_s_actuals, __pyx_n_s_date, __pyx_n_s_price, __pyx_n_s_date, __pyx_n_s_date, __pyx_n_s_close); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_tuple__10 = PyTuple_Pack(26, __pyx_n_s_self, __pyx_n_s_sequence_length, __pyx_n_s_days, __pyx_n_s_model_name, __pyx_n_s_algorithm, __pyx_n_s_with_pred, __pyx_n_s_model_path, __pyx_n_s_model, __pyx_n_s_dataframe_path, __pyx_n_s_dataframe, __pyx_n_s_minmax_scaler, __pyx_n_s_standard_scaler, __pyx_n_s_lst_seq, __pyx_n_s_predicted_prices, __pyx_n_s_last_date, __pyx_n_s__9, __pyx_n_s_predicted_price, __pyx_n_s_predictions, __pyx_n_s_df_date, __pyx_n_s_df_close, __pyx_n_s_actuals, __pyx_n_s_date, __pyx_n_s_price, __pyx_n_s_date, __pyx_n_s_date, __pyx_n_s_close); if (unlikely(!__pyx_tuple__10)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_tuple__10); __Pyx_GIVEREF(__pyx_tuple__10); - __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(5, 0, 0, 25, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utilities_pyx, __pyx_n_s_forecasting_utils, 9, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_codeobj_ = (PyObject*)__Pyx_PyCode_New(6, 0, 0, 26, 0, CO_OPTIMIZED|CO_NEWLOCALS|CO_COROUTINE, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_tuple__10, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_utilities_pyx, __pyx_n_s_forecasting_utils, 10, __pyx_empty_bytes); if (unlikely(!__pyx_codeobj_)) __PYX_ERR(0, 10, __pyx_L1_error) /* "(tree fragment)":1 * def __reduce_cython__(self): # <<<<<<<<<<<<<< @@ -6424,15 +6482,15 @@ static int __Pyx_modinit_type_init_code(void) { __Pyx_RefNannySetupContext("__Pyx_modinit_type_init_code", 0); /*--- Type init code ---*/ #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_9utilities_Utilities = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9utilities_Utilities_spec, NULL); if (unlikely(!__pyx_ptype_9utilities_Utilities)) __PYX_ERR(0, 8, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9utilities_Utilities_spec, __pyx_ptype_9utilities_Utilities) < 0) __PYX_ERR(0, 8, __pyx_L1_error) + __pyx_ptype_9utilities_Utilities = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9utilities_Utilities_spec, NULL); if (unlikely(!__pyx_ptype_9utilities_Utilities)) __PYX_ERR(0, 9, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9utilities_Utilities_spec, __pyx_ptype_9utilities_Utilities) < 0) __PYX_ERR(0, 9, __pyx_L1_error) #else __pyx_ptype_9utilities_Utilities = &__pyx_type_9utilities_Utilities; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_9utilities_Utilities) < 0) __PYX_ERR(0, 8, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_ptype_9utilities_Utilities) < 0) __PYX_ERR(0, 9, __pyx_L1_error) #endif #if PY_MAJOR_VERSION < 3 __pyx_ptype_9utilities_Utilities->tp_print = 0; @@ -6442,20 +6500,20 @@ static int __Pyx_modinit_type_init_code(void) { __pyx_ptype_9utilities_Utilities->tp_getattro = __Pyx_PyObject_GenericGetAttr; } #endif - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Utilities, (PyObject *) __pyx_ptype_9utilities_Utilities) < 0) __PYX_ERR(0, 8, __pyx_L1_error) + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_Utilities, (PyObject *) __pyx_ptype_9utilities_Utilities) < 0) __PYX_ERR(0, 9, __pyx_L1_error) #if !CYTHON_COMPILING_IN_LIMITED_API - if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_9utilities_Utilities) < 0) __PYX_ERR(0, 8, __pyx_L1_error) + if (__Pyx_setup_reduce((PyObject *) __pyx_ptype_9utilities_Utilities) < 0) __PYX_ERR(0, 9, __pyx_L1_error) #endif #if CYTHON_USE_TYPE_SPECS - __pyx_ptype_9utilities___pyx_scope_struct__forecasting_utils = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9utilities___pyx_scope_struct__forecasting_utils_spec, NULL); if (unlikely(!__pyx_ptype_9utilities___pyx_scope_struct__forecasting_utils)) __PYX_ERR(0, 9, __pyx_L1_error) - if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9utilities___pyx_scope_struct__forecasting_utils_spec, __pyx_ptype_9utilities___pyx_scope_struct__forecasting_utils) < 0) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_ptype_9utilities___pyx_scope_struct__forecasting_utils = (PyTypeObject *) __Pyx_PyType_FromModuleAndSpec(__pyx_m, &__pyx_type_9utilities___pyx_scope_struct__forecasting_utils_spec, NULL); if (unlikely(!__pyx_ptype_9utilities___pyx_scope_struct__forecasting_utils)) __PYX_ERR(0, 10, __pyx_L1_error) + if (__Pyx_fix_up_extension_type_from_spec(&__pyx_type_9utilities___pyx_scope_struct__forecasting_utils_spec, __pyx_ptype_9utilities___pyx_scope_struct__forecasting_utils) < 0) __PYX_ERR(0, 10, __pyx_L1_error) #else __pyx_ptype_9utilities___pyx_scope_struct__forecasting_utils = &__pyx_type_9utilities___pyx_scope_struct__forecasting_utils; #endif #if !CYTHON_COMPILING_IN_LIMITED_API #endif #if !CYTHON_USE_TYPE_SPECS - if (__Pyx_PyType_Ready(__pyx_ptype_9utilities___pyx_scope_struct__forecasting_utils) < 0) __PYX_ERR(0, 9, __pyx_L1_error) + if (__Pyx_PyType_Ready(__pyx_ptype_9utilities___pyx_scope_struct__forecasting_utils) < 0) __PYX_ERR(0, 10, __pyx_L1_error) #endif #if PY_MAJOR_VERSION < 3 __pyx_ptype_9utilities___pyx_scope_struct__forecasting_utils->tp_print = 0; @@ -6777,133 +6835,134 @@ if (!__Pyx_RefNanny) { /* "utilities.pyx":1 * import os # <<<<<<<<<<<<<< + * import cython * from joblib import load - * from numpy import append, expand_dims */ __pyx_t_2 = __Pyx_ImportDottedModule(__pyx_n_s_os, NULL); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s_os, __pyx_t_2) < 0) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "utilities.pyx":2 + /* "utilities.pyx":3 * import os + * import cython * from joblib import load # <<<<<<<<<<<<<< * from numpy import append, expand_dims * from pandas import read_json, to_datetime, Timedelta */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_load); __Pyx_GIVEREF(__pyx_n_s_load); - if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_load)) __PYX_ERR(0, 2, __pyx_L1_error); - __pyx_t_3 = __Pyx_Import(__pyx_n_s_joblib, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 2, __pyx_L1_error) + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_load)) __PYX_ERR(0, 3, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_joblib, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 2, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_load); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_load, __pyx_t_2) < 0) __PYX_ERR(0, 2, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_load, __pyx_t_2) < 0) __PYX_ERR(0, 3, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "utilities.pyx":3 - * import os + /* "utilities.pyx":4 + * import cython * from joblib import load * from numpy import append, expand_dims # <<<<<<<<<<<<<< * from pandas import read_json, to_datetime, Timedelta * from tensorflow.keras.models import load_model */ - __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3, __pyx_L1_error) + __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_append); __Pyx_GIVEREF(__pyx_n_s_append); - if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_append)) __PYX_ERR(0, 3, __pyx_L1_error); + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_append)) __PYX_ERR(0, 4, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_expand_dims); __Pyx_GIVEREF(__pyx_n_s_expand_dims); - if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_expand_dims)) __PYX_ERR(0, 3, __pyx_L1_error); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 3, __pyx_L1_error) + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 1, __pyx_n_s_expand_dims)) __PYX_ERR(0, 4, __pyx_L1_error); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_numpy, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_append); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3, __pyx_L1_error) + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_append); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_append, __pyx_t_3) < 0) __PYX_ERR(0, 3, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_append, __pyx_t_3) < 0) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_expand_dims); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 3, __pyx_L1_error) + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_expand_dims); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_expand_dims, __pyx_t_3) < 0) __PYX_ERR(0, 3, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_expand_dims, __pyx_t_3) < 0) __PYX_ERR(0, 4, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "utilities.pyx":4 + /* "utilities.pyx":5 * from joblib import load * from numpy import append, expand_dims * from pandas import read_json, to_datetime, Timedelta # <<<<<<<<<<<<<< * from tensorflow.keras.models import load_model - * import cython + * */ - __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __pyx_t_2 = PyList_New(3); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_n_s_read_json); __Pyx_GIVEREF(__pyx_n_s_read_json); - if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_read_json)) __PYX_ERR(0, 4, __pyx_L1_error); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 0, __pyx_n_s_read_json)) __PYX_ERR(0, 5, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_to_datetime); __Pyx_GIVEREF(__pyx_n_s_to_datetime); - if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_to_datetime)) __PYX_ERR(0, 4, __pyx_L1_error); + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 1, __pyx_n_s_to_datetime)) __PYX_ERR(0, 5, __pyx_L1_error); __Pyx_INCREF(__pyx_n_s_Timedelta); __Pyx_GIVEREF(__pyx_n_s_Timedelta); - if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_Timedelta)) __PYX_ERR(0, 4, __pyx_L1_error); - __pyx_t_3 = __Pyx_Import(__pyx_n_s_pandas, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 4, __pyx_L1_error) + if (__Pyx_PyList_SET_ITEM(__pyx_t_2, 2, __pyx_n_s_Timedelta)) __PYX_ERR(0, 5, __pyx_L1_error); + __pyx_t_3 = __Pyx_Import(__pyx_n_s_pandas, __pyx_t_2, 0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_read_json); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_read_json); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_json, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_read_json, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_to_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_to_datetime); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_to_datetime, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_to_datetime, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Timedelta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 4, __pyx_L1_error) + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s_Timedelta); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_Timedelta, __pyx_t_2) < 0) __PYX_ERR(0, 4, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_Timedelta, __pyx_t_2) < 0) __PYX_ERR(0, 5, __pyx_L1_error) __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "utilities.pyx":5 + /* "utilities.pyx":6 * from numpy import append, expand_dims * from pandas import read_json, to_datetime, Timedelta * from tensorflow.keras.models import load_model # <<<<<<<<<<<<<< - * import cython + * * */ - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5, __pyx_L1_error) + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_n_s_load_model); __Pyx_GIVEREF(__pyx_n_s_load_model); - if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_load_model)) __PYX_ERR(0, 5, __pyx_L1_error); - __pyx_t_2 = __Pyx_Import(__pyx_n_s_tensorflow_keras_models, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 5, __pyx_L1_error) + if (__Pyx_PyList_SET_ITEM(__pyx_t_3, 0, __pyx_n_s_load_model)) __PYX_ERR(0, 6, __pyx_L1_error); + __pyx_t_2 = __Pyx_Import(__pyx_n_s_tensorflow_keras_models, __pyx_t_3, 0); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_load_model); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 5, __pyx_L1_error) + __pyx_t_3 = __Pyx_ImportFrom(__pyx_t_2, __pyx_n_s_load_model); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_d, __pyx_n_s_load_model, __pyx_t_3) < 0) __PYX_ERR(0, 5, __pyx_L1_error) + if (PyDict_SetItem(__pyx_d, __pyx_n_s_load_model, __pyx_t_3) < 0) __PYX_ERR(0, 6, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "utilities.pyx":9 + /* "utilities.pyx":10 * * cdef class Utilities: * async def forecasting_utils(self, int sequence_length, # <<<<<<<<<<<<<< - * int days, str model_name, str algorithm) -> tuple: + * int days, str model_name, str algorithm, bint with_pred) -> tuple: * cdef str model_path = os.path.join(f'./resources/algorithms/{algorithm}/models', */ - __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 9, __pyx_L1_error) + __pyx_t_2 = __Pyx_PyDict_NewPresized(1); if (unlikely(!__pyx_t_2)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_tuple) < 0) __PYX_ERR(0, 9, __pyx_L1_error) - __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9utilities_9Utilities_1forecasting_utils, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_Utilities_forecasting_utils, NULL, __pyx_n_s_utilities, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 9, __pyx_L1_error) + if (PyDict_SetItem(__pyx_t_2, __pyx_n_s_return, __pyx_n_s_tuple) < 0) __PYX_ERR(0, 10, __pyx_L1_error) + __pyx_t_3 = __Pyx_CyFunction_New(&__pyx_mdef_9utilities_9Utilities_1forecasting_utils, __Pyx_CYFUNCTION_CCLASS | __Pyx_CYFUNCTION_COROUTINE, __pyx_n_s_Utilities_forecasting_utils, NULL, __pyx_n_s_utilities, __pyx_d, ((PyObject *)__pyx_codeobj_)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_CyFunction_SetAnnotationsDict(__pyx_t_3, __pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_9utilities_Utilities, __pyx_n_s_forecasting_utils, __pyx_t_3) < 0) __PYX_ERR(0, 9, __pyx_L1_error) + if (__Pyx_SetItemOnTypeDict((PyObject *)__pyx_ptype_9utilities_Utilities, __pyx_n_s_forecasting_utils, __pyx_t_3) < 0) __PYX_ERR(0, 10, __pyx_L1_error) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; PyType_Modified(__pyx_ptype_9utilities_Utilities); @@ -6942,8 +7001,8 @@ if (!__Pyx_RefNanny) { /* "utilities.pyx":1 * import os # <<<<<<<<<<<<<< + * import cython * from joblib import load - * from numpy import append, expand_dims */ __pyx_t_3 = __Pyx_PyDict_NewPresized(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 1, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3);