diff --git a/sklearn/linear_model/cd_fast.c b/sklearn/linear_model/cd_fast.c index de716e4f118ee..3fa710e8fa7fc 100644 --- a/sklearn/linear_model/cd_fast.c +++ b/sklearn/linear_model/cd_fast.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.15.1 on Thu Jun 28 14:05:02 2012 */ +/* Generated by Cython 0.15.1 on Thu Jun 28 17:21:03 2012 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -1177,19 +1177,20 @@ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; static char __pyx_k_2[] = "Coordinate descent with alpha=0 may lead to unexpected results and is discouraged."; -static char __pyx_k_11[] = "ndarray is not C contiguous"; -static char __pyx_k_13[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_15[] = "Non-native byte order not supported"; -static char __pyx_k_17[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_18[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_21[] = "Format string allocated too short."; -static char __pyx_k_23[] = "numpy.linalg"; -static char __pyx_k_24[] = "*"; -static char __pyx_k_25[] = "sklearn.linear_model.cd_fast"; -static char __pyx_k_26[] = "enet_coordinate_descent"; -static char __pyx_k_27[] = "sparse_enet_coordinate_descent"; -static char __pyx_k_28[] = "enet_coordinate_descent_gram"; -static char __pyx_k_29[] = "enet_coordinate_descent_old"; +static char __pyx_k_4[] = "Allowed memory is not sufficient some values need to be recalculated."; +static char __pyx_k_15[] = "ndarray is not C contiguous"; +static char __pyx_k_17[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_19[] = "Non-native byte order not supported"; +static char __pyx_k_21[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_22[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_25[] = "Format string allocated too short."; +static char __pyx_k_27[] = "numpy.linalg"; +static char __pyx_k_28[] = "*"; +static char __pyx_k_29[] = "sklearn.linear_model.cd_fast"; +static char __pyx_k_30[] = "enet_coordinate_descent"; +static char __pyx_k_31[] = "sparse_enet_coordinate_descent"; +static char __pyx_k_32[] = "enet_coordinate_descent_gram"; +static char __pyx_k_33[] = "enet_coordinate_descent_old"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; @@ -1249,21 +1250,23 @@ static char __pyx_k__active_set[] = "active_set"; static char __pyx_k__n_features[] = "n_features"; static char __pyx_k__sparse_std[] = "sparse_std"; static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__memory_limit[] = "memory_limit"; static char __pyx_k__update_active_set[] = "update_active_set"; -static PyObject *__pyx_kp_u_11; -static PyObject *__pyx_kp_u_13; static PyObject *__pyx_kp_u_15; static PyObject *__pyx_kp_u_17; -static PyObject *__pyx_kp_u_18; +static PyObject *__pyx_kp_u_19; static PyObject *__pyx_kp_s_2; static PyObject *__pyx_kp_u_21; -static PyObject *__pyx_n_s_23; -static PyObject *__pyx_n_s_24; -static PyObject *__pyx_n_s_25; -static PyObject *__pyx_n_s_26; +static PyObject *__pyx_kp_u_22; +static PyObject *__pyx_kp_u_25; static PyObject *__pyx_n_s_27; static PyObject *__pyx_n_s_28; static PyObject *__pyx_n_s_29; +static PyObject *__pyx_n_s_30; +static PyObject *__pyx_n_s_31; +static PyObject *__pyx_n_s_32; +static PyObject *__pyx_n_s_33; +static PyObject *__pyx_kp_s_4; static PyObject *__pyx_n_s__Q; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__T; @@ -1287,6 +1290,7 @@ static PyObject *__pyx_n_s__inf; static PyObject *__pyx_n_s__linalg; static PyObject *__pyx_n_s__max; static PyObject *__pyx_n_s__max_iter; +static PyObject *__pyx_n_s__memory_limit; static PyObject *__pyx_n_s__n_features; static PyObject *__pyx_n_s__n_iter; static PyObject *__pyx_n_s__n_samples; @@ -1314,20 +1318,23 @@ static PyObject *__pyx_int_1; static PyObject *__pyx_int_2; static PyObject *__pyx_int_15; static PyBoolObject *__pyx_k_1; -static PyBoolObject *__pyx_k_7; -static PyBoolObject *__pyx_k_9; -static PyObject *__pyx_k_slice_4; -static PyObject *__pyx_k_slice_5; +static PyBoolObject *__pyx_k_11; +static PyBoolObject *__pyx_k_13; static PyObject *__pyx_k_slice_6; +static PyObject *__pyx_k_slice_7; +static PyObject *__pyx_k_slice_8; +static PyObject *__pyx_k_slice_9; static PyObject *__pyx_k_tuple_3; -static PyObject *__pyx_k_tuple_8; -static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_5; +static PyObject *__pyx_k_slice_10; static PyObject *__pyx_k_tuple_12; static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_16; -static PyObject *__pyx_k_tuple_19; +static PyObject *__pyx_k_tuple_18; static PyObject *__pyx_k_tuple_20; -static PyObject *__pyx_k_tuple_22; +static PyObject *__pyx_k_tuple_23; +static PyObject *__pyx_k_tuple_24; +static PyObject *__pyx_k_tuple_26; /* "sklearn/linear_model/cd_fast.pyx":19 * double sqrt(double f) @@ -2752,6 +2759,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc int __pyx_v_max_iter; double __pyx_v_tol; PyBoolObject *__pyx_v_positive = 0; + int __pyx_v_memory_limit; unsigned int __pyx_v_n_samples; unsigned int __pyx_v_n_features; PyArrayObject *__pyx_v_norm_cols_X = 0; @@ -2764,10 +2772,12 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc double __pyx_v_d_w_tol; unsigned int __pyx_v_ii; unsigned int __pyx_v_n_iter; + PyBoolObject *__pyx_v_store_feature_inner_product = 0; PyObject *__pyx_v_Xy = NULL; PyObject *__pyx_v_feature_inner_product = NULL; PyObject *__pyx_v_gradient = NULL; PyObject *__pyx_v_active_set = NULL; + PyObject *__pyx_v_tmp_feature_inner_product = NULL; PyObject *__pyx_v_j = NULL; Py_buffer __pyx_bstruct_norm_cols_X; Py_ssize_t __pyx_bstride_0_norm_cols_X = 0; @@ -2799,9 +2809,9 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc PyObject *(*__pyx_t_12)(PyObject *); unsigned int __pyx_t_13; unsigned int __pyx_t_14; - unsigned int __pyx_t_15; + int __pyx_t_15; int __pyx_t_16; - int __pyx_t_17; + unsigned int __pyx_t_17; unsigned int __pyx_t_18; unsigned int __pyx_t_19; unsigned int __pyx_t_20; @@ -2814,19 +2824,21 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc unsigned int __pyx_t_27; unsigned int __pyx_t_28; unsigned int __pyx_t_29; - int __pyx_t_30; + unsigned int __pyx_t_30; + int __pyx_t_31; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__w,&__pyx_n_s__alpha,&__pyx_n_s__beta,&__pyx_n_s__X,&__pyx_n_s__y,&__pyx_n_s__max_iter,&__pyx_n_s__tol,&__pyx_n_s__positive,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__w,&__pyx_n_s__alpha,&__pyx_n_s__beta,&__pyx_n_s__X,&__pyx_n_s__y,&__pyx_n_s__max_iter,&__pyx_n_s__tol,&__pyx_n_s__positive,&__pyx_n_s__memory_limit,0}; __Pyx_RefNannySetupContext("enet_coordinate_descent"); __pyx_self = __pyx_self; { - PyObject* values[8] = {0,0,0,0,0,0,0,0}; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; values[7] = (PyObject *)__pyx_k_1; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -2848,49 +2860,55 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); if (likely(values[3])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); if (likely(values[4])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_iter); if (likely(values[5])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tol); if (likely(values[6])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__positive); if (value) { values[7] = value; kw_args--; } } + case 8: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__memory_limit); + if (value) { values[8] = value; kw_args--; } + } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "enet_coordinate_descent") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); @@ -2911,10 +2929,15 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_tol = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_positive = ((PyBoolObject *)values[7]); + if (values[8]) { + __pyx_v_memory_limit = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_memory_limit == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_memory_limit = ((int)500); + } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent", 0, 7, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.cd_fast.enet_coordinate_descent", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -2947,7 +2970,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_bstride_0_y = __pyx_bstruct_y.strides[0]; __pyx_bshape_0_y = __pyx_bstruct_y.shape[0]; - /* "sklearn/linear_model/cd_fast.pyx":152 + /* "sklearn/linear_model/cd_fast.pyx":153 * * # get the data information into easy vars * cdef unsigned int n_samples = X.shape[0] # <<<<<<<<<<<<<< @@ -2956,7 +2979,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_v_n_samples = (__pyx_v_X->dimensions[0]); - /* "sklearn/linear_model/cd_fast.pyx":153 + /* "sklearn/linear_model/cd_fast.pyx":154 * # get the data information into easy vars * cdef unsigned int n_samples = X.shape[0] * cdef unsigned int n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -2965,32 +2988,32 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_v_n_features = (__pyx_v_X->dimensions[1]); - /* "sklearn/linear_model/cd_fast.pyx":156 + /* "sklearn/linear_model/cd_fast.pyx":157 * * # compute norms of the columns of X * cdef np.ndarray[DOUBLE, ndim=1] norm_cols_X = (X**2).sum(axis=0) # <<<<<<<<<<<<<< * * cdef double tmp */ - __pyx_t_1 = PyNumber_Power(((PyObject *)__pyx_v_X), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Power(((PyObject *)__pyx_v_X), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_norm_cols_X, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_norm_cols_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_norm_cols_X.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_norm_cols_X = __pyx_bstruct_norm_cols_X.strides[0]; __pyx_bshape_0_norm_cols_X = __pyx_bstruct_norm_cols_X.shape[0]; } @@ -2999,7 +3022,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_v_norm_cols_X = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":163 + /* "sklearn/linear_model/cd_fast.pyx":164 * cdef double w_max * cdef double d_w_ii * cdef double gap = tol + 1.0 # <<<<<<<<<<<<<< @@ -3008,7 +3031,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_v_gap = (__pyx_v_tol + 1.0); - /* "sklearn/linear_model/cd_fast.pyx":164 + /* "sklearn/linear_model/cd_fast.pyx":165 * cdef double d_w_ii * cdef double gap = tol + 1.0 * cdef double d_w_tol = tol # <<<<<<<<<<<<<< @@ -3018,7 +3041,20 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_v_d_w_tol = __pyx_v_tol; /* "sklearn/linear_model/cd_fast.pyx":168 + * cdef unsigned int ii * cdef unsigned int n_iter + * cdef bool store_feature_inner_product = True # <<<<<<<<<<<<<< + * + * if alpha == 0: + */ + __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_store_feature_inner_product = ((PyBoolObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "sklearn/linear_model/cd_fast.pyx":170 + * cdef bool store_feature_inner_product = True * * if alpha == 0: # <<<<<<<<<<<<<< * warnings.warn("Coordinate descent with alpha=0 may lead to unexpected" @@ -3027,19 +3063,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_t_5 = (__pyx_v_alpha == 0.0); if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":169 + /* "sklearn/linear_model/cd_fast.pyx":171 * * if alpha == 0: * warnings.warn("Coordinate descent with alpha=0 may lead to unexpected" # <<<<<<<<<<<<<< * " results and is discouraged.") * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__warn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__warn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_3), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -3047,55 +3083,55 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc } __pyx_L6:; - /* "sklearn/linear_model/cd_fast.pyx":172 + /* "sklearn/linear_model/cd_fast.pyx":174 * " results and is discouraged.") * * tol = tol * linalg.norm(y) ** 2 # <<<<<<<<<<<<<< * * Xy = np.dot(X.T, y) */ - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_v_y)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); - __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Power(__pyx_t_6, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Power(__pyx_t_6, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_tol = __pyx_t_7; - /* "sklearn/linear_model/cd_fast.pyx":174 + /* "sklearn/linear_model/cd_fast.pyx":176 * tol = tol * linalg.norm(y) ** 2 * * Xy = np.dot(X.T, y) # <<<<<<<<<<<<<< * * # memory foodprint has to be reduced */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__T); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__T); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); @@ -3103,103 +3139,185 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_v_Xy = __pyx_t_6; __pyx_t_6 = 0; - /* "sklearn/linear_model/cd_fast.pyx":177 - * + /* "sklearn/linear_model/cd_fast.pyx":180 * # memory foodprint has to be reduced + * #memory_limit = 5000 + * if memory_limit > n_features * n_features: # <<<<<<<<<<<<<< + * feature_inner_product = np.zeros(shape=(n_features, n_features)) + * else: + */ + __pyx_t_5 = (__pyx_v_memory_limit > (__pyx_v_n_features * __pyx_v_n_features)); + if (__pyx_t_5) { + + /* "sklearn/linear_model/cd_fast.pyx":181 + * #memory_limit = 5000 + * if memory_limit > n_features * n_features: + * feature_inner_product = np.zeros(shape=(n_features, n_features)) # <<<<<<<<<<<<<< + * else: + * store_feature_inner_product = False + */ + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_v_feature_inner_product = __pyx_t_8; + __pyx_t_8 = 0; + goto __pyx_L7; + } + /*else*/ { + + /* "sklearn/linear_model/cd_fast.pyx":183 + * feature_inner_product = np.zeros(shape=(n_features, n_features)) + * else: + * store_feature_inner_product = False # <<<<<<<<<<<<<< + * warnings.warn("Allowed memory is not sufficient " + * " some values need to be recalculated.") + */ + __pyx_t_8 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (!(likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_store_feature_inner_product)); + __pyx_v_store_feature_inner_product = ((PyBoolObject *)__pyx_t_8); + __pyx_t_8 = 0; + + /* "sklearn/linear_model/cd_fast.pyx":184 + * else: + * store_feature_inner_product = False + * warnings.warn("Allowed memory is not sufficient " # <<<<<<<<<<<<<< + * " some values need to be recalculated.") + * + */ + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__warn); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __pyx_L7:; + + /* "sklearn/linear_model/cd_fast.pyx":187 + * " some values need to be recalculated.") + * * feature_inner_product = np.zeros(shape=(n_features, n_features)) # <<<<<<<<<<<<<< * gradient = np.zeros(n_features) * active_set = set(range(n_features)) */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; + __pyx_t_3 = 0; __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_8)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyEval_CallObjectWithKeywords(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_v_feature_inner_product = __pyx_t_8; - __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_v_feature_inner_product); + __pyx_v_feature_inner_product = __pyx_t_1; + __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":178 - * # memory foodprint has to be reduced + /* "sklearn/linear_model/cd_fast.pyx":188 + * * feature_inner_product = np.zeros(shape=(n_features, n_features)) * gradient = np.zeros(n_features) # <<<<<<<<<<<<<< * active_set = set(range(n_features)) * */ - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__zeros); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_gradient = __pyx_t_8; - __pyx_t_8 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_v_gradient = __pyx_t_1; + __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":179 + /* "sklearn/linear_model/cd_fast.pyx":189 * feature_inner_product = np.zeros(shape=(n_features, n_features)) * gradient = np.zeros(n_features) * active_set = set(range(n_features)) # <<<<<<<<<<<<<< * * for n_iter in range(max_iter): */ - __pyx_t_8 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_v_active_set = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PySet_Type))), ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_v_active_set = __pyx_t_1; + __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":181 + /* "sklearn/linear_model/cd_fast.pyx":191 * active_set = set(range(n_features)) * * for n_iter in range(max_iter): # <<<<<<<<<<<<<< @@ -3210,7 +3328,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_n_iter = __pyx_t_10; - /* "sklearn/linear_model/cd_fast.pyx":182 + /* "sklearn/linear_model/cd_fast.pyx":192 * * for n_iter in range(max_iter): * w_max = 0.0 # <<<<<<<<<<<<<< @@ -3219,7 +3337,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_v_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":183 + /* "sklearn/linear_model/cd_fast.pyx":193 * for n_iter in range(max_iter): * w_max = 0.0 * d_w_max = 0.0 # <<<<<<<<<<<<<< @@ -3228,37 +3346,37 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_v_d_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":185 + /* "sklearn/linear_model/cd_fast.pyx":195 * d_w_max = 0.0 * * active_set = update_active_set(active_set, w, n_iter) # <<<<<<<<<<<<<< * * for ii in active_set: # Loop over coordinates */ - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__update_active_set); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_n_iter); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__update_active_set); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyLong_FromUnsignedLong(__pyx_v_n_iter); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_8 = PyTuple_New(3); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_INCREF(__pyx_v_active_set); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_active_set); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_active_set); __Pyx_GIVEREF(__pyx_v_active_set); __Pyx_INCREF(((PyObject *)__pyx_v_w)); - PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_w)); + PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_v_w)); __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); - PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_6), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_v_active_set); - __pyx_v_active_set = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_active_set = __pyx_t_6; + __pyx_t_6 = 0; - /* "sklearn/linear_model/cd_fast.pyx":187 + /* "sklearn/linear_model/cd_fast.pyx":197 * active_set = update_active_set(active_set, w, n_iter) * * for ii in active_set: # Loop over coordinates # <<<<<<<<<<<<<< @@ -3266,36 +3384,36 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc * if norm_cols_X[ii] == 0.0: */ if (PyList_CheckExact(__pyx_v_active_set) || PyTuple_CheckExact(__pyx_v_active_set)) { - __pyx_t_3 = __pyx_v_active_set; __Pyx_INCREF(__pyx_t_3); __pyx_t_11 = 0; + __pyx_t_6 = __pyx_v_active_set; __Pyx_INCREF(__pyx_t_6); __pyx_t_11 = 0; __pyx_t_12 = NULL; } else { - __pyx_t_11 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_active_set); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = Py_TYPE(__pyx_t_3)->tp_iternext; + __pyx_t_11 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_active_set); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_12 = Py_TYPE(__pyx_t_6)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_3)) { - if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_3)) break; - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; - } else if (PyTuple_CheckExact(__pyx_t_3)) { - if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_3)) break; - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_11); __Pyx_INCREF(__pyx_t_6); __pyx_t_11++; + if (PyList_CheckExact(__pyx_t_6)) { + if (__pyx_t_11 >= PyList_GET_SIZE(__pyx_t_6)) break; + __pyx_t_8 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_8); __pyx_t_11++; + } else if (PyTuple_CheckExact(__pyx_t_6)) { + if (__pyx_t_11 >= PyTuple_GET_SIZE(__pyx_t_6)) break; + __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_11); __Pyx_INCREF(__pyx_t_8); __pyx_t_11++; } else { - __pyx_t_6 = __pyx_t_12(__pyx_t_3); - if (unlikely(!__pyx_t_6)) { + __pyx_t_8 = __pyx_t_12(__pyx_t_6); + if (unlikely(!__pyx_t_8)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_6); + __Pyx_GOTREF(__pyx_t_8); } - __pyx_t_13 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_6); if (unlikely((__pyx_t_13 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_13 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_8); if (unlikely((__pyx_t_13 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __pyx_v_ii = __pyx_t_13; - /* "sklearn/linear_model/cd_fast.pyx":189 + /* "sklearn/linear_model/cd_fast.pyx":199 * for ii in active_set: # Loop over coordinates * * if norm_cols_X[ii] == 0.0: # <<<<<<<<<<<<<< @@ -3306,19 +3424,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_t_5 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_norm_cols_X.buf, __pyx_t_13, __pyx_bstride_0_norm_cols_X)) == 0.0); if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":190 + /* "sklearn/linear_model/cd_fast.pyx":200 * * if norm_cols_X[ii] == 0.0: * continue # <<<<<<<<<<<<<< * * w_ii = w[ii] # Store previous value */ - goto __pyx_L9_continue; - goto __pyx_L11; + goto __pyx_L10_continue; + goto __pyx_L12; } - __pyx_L11:; + __pyx_L12:; - /* "sklearn/linear_model/cd_fast.pyx":192 + /* "sklearn/linear_model/cd_fast.pyx":202 * continue * * w_ii = w[ii] # Store previous value # <<<<<<<<<<<<<< @@ -3328,153 +3446,279 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_t_14 = __pyx_v_ii; __pyx_v_w_ii = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_14, __pyx_bstride_0_w)); - /* "sklearn/linear_model/cd_fast.pyx":195 + /* "sklearn/linear_model/cd_fast.pyx":205 * * # initial calculation - * if n_iter == 0: # <<<<<<<<<<<<<< + * if n_iter == 0 and store_feature_inner_product: # <<<<<<<<<<<<<< * feature_inner_product[:, ii] = np.dot(X[:, ii], X) - * gradient[ii] = Xy[ii] - np.dot(feature_inner_product[:, ii], w) + * gradient[ii] = Xy[ii] - \ */ __pyx_t_5 = (__pyx_v_n_iter == 0); if (__pyx_t_5) { + __pyx_t_15 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_store_feature_inner_product)); if (unlikely(__pyx_t_15 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = __pyx_t_15; + } else { + __pyx_t_16 = __pyx_t_5; + } + if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":196 + /* "sklearn/linear_model/cd_fast.pyx":206 * # initial calculation - * if n_iter == 0: + * if n_iter == 0 and store_feature_inner_product: * feature_inner_product[:, ii] = np.dot(X[:, ii], X) # <<<<<<<<<<<<<< - * gradient[ii] = Xy[ii] - np.dot(feature_inner_product[:, ii], w) - * + * gradient[ii] = Xy[ii] - \ + * np.dot(feature_inner_product[:, ii], w) */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__dot); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyLong_FromUnsignedLong(__pyx_v_ii); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyLong_FromUnsignedLong(__pyx_v_ii); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_k_slice_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_k_slice_4); - __Pyx_GIVEREF(__pyx_k_slice_4); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_2)); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_k_slice_6); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_k_slice_6); + __Pyx_GIVEREF(__pyx_k_slice_6); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_2)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_6); - __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_X)); __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); - __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_ii); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_ii); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __Pyx_INCREF(__pyx_k_slice_5); - PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_k_slice_5); - __Pyx_GIVEREF(__pyx_k_slice_5); - PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(__pyx_k_slice_7); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_7); + __Pyx_GIVEREF(__pyx_k_slice_7); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyObject_SetItem(__pyx_v_feature_inner_product, ((PyObject *)__pyx_t_8), __pyx_t_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyObject_SetItem(__pyx_v_feature_inner_product, ((PyObject *)__pyx_t_1), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - /* "sklearn/linear_model/cd_fast.pyx":197 - * if n_iter == 0: + /* "sklearn/linear_model/cd_fast.pyx":207 + * if n_iter == 0 and store_feature_inner_product: * feature_inner_product[:, ii] = np.dot(X[:, ii], X) - * gradient[ii] = Xy[ii] - np.dot(feature_inner_product[:, ii], w) # <<<<<<<<<<<<<< + * gradient[ii] = Xy[ii] - \ # <<<<<<<<<<<<<< + * np.dot(feature_inner_product[:, ii], w) * - * tmp = gradient[ii] + w_ii * norm_cols_X[ii] */ - __pyx_t_6 = __Pyx_GetItemInt(__pyx_v_Xy, __pyx_v_ii, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_Xy, __pyx_v_ii, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/linear_model/cd_fast.pyx":208 + * feature_inner_product[:, ii] = np.dot(X[:, ii], X) + * gradient[ii] = Xy[ii] - \ + * np.dot(feature_inner_product[:, ii], w) # <<<<<<<<<<<<<< + * + * if not store_feature_inner_product: + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_ii); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_INCREF(__pyx_k_slice_8); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_k_slice_8); + __Pyx_GIVEREF(__pyx_k_slice_8); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(__pyx_v_feature_inner_product, ((PyObject *)__pyx_t_3)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_w)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_w)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyLong_FromUnsignedLong(__pyx_v_ii); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_k_slice_6); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_6); - __Pyx_GIVEREF(__pyx_k_slice_6); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_GetItem(__pyx_v_feature_inner_product, ((PyObject *)__pyx_t_1)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "sklearn/linear_model/cd_fast.pyx":207 + * if n_iter == 0 and store_feature_inner_product: + * feature_inner_product[:, ii] = np.dot(X[:, ii], X) + * gradient[ii] = Xy[ii] - \ # <<<<<<<<<<<<<< + * np.dot(feature_inner_product[:, ii], w) + * + */ + if (__Pyx_SetItemInt(__pyx_v_gradient, __pyx_v_ii, __pyx_t_3, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L13; + } + __pyx_L13:; + + /* "sklearn/linear_model/cd_fast.pyx":210 + * np.dot(feature_inner_product[:, ii], w) + * + * if not store_feature_inner_product: # <<<<<<<<<<<<<< + * tmp_feature_inner_product = np.dot(X[:, ii], X) + * gradient[ii] = Xy[ii] - \ + */ + __pyx_t_16 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_store_feature_inner_product)); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (!__pyx_t_16); + if (__pyx_t_5) { + + /* "sklearn/linear_model/cd_fast.pyx":211 + * + * if not store_feature_inner_product: + * tmp_feature_inner_product = np.dot(X[:, ii], X) # <<<<<<<<<<<<<< + * gradient[ii] = Xy[ii] - \ + * np.dot(tmp_feature_inner_product, w) + */ + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyLong_FromUnsignedLong(__pyx_v_ii); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_INCREF(__pyx_k_slice_9); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_k_slice_9); + __Pyx_GIVEREF(__pyx_k_slice_9); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_8)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_X)); + PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_v_X)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_v_tmp_feature_inner_product); + __pyx_v_tmp_feature_inner_product = __pyx_t_3; + __pyx_t_3 = 0; + + /* "sklearn/linear_model/cd_fast.pyx":212 + * if not store_feature_inner_product: + * tmp_feature_inner_product = np.dot(X[:, ii], X) + * gradient[ii] = Xy[ii] - \ # <<<<<<<<<<<<<< + * np.dot(tmp_feature_inner_product, w) + * + */ + __pyx_t_3 = __Pyx_GetItemInt(__pyx_v_Xy, __pyx_v_ii, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + + /* "sklearn/linear_model/cd_fast.pyx":213 + * tmp_feature_inner_product = np.dot(X[:, ii], X) + * gradient[ii] = Xy[ii] - \ + * np.dot(tmp_feature_inner_product, w) # <<<<<<<<<<<<<< + * + * tmp = gradient[ii] + w_ii * norm_cols_X[ii] + */ + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_8); - __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_INCREF(__pyx_v_tmp_feature_inner_product); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_v_tmp_feature_inner_product); + __Pyx_GIVEREF(__pyx_v_tmp_feature_inner_product); __Pyx_INCREF(((PyObject *)__pyx_v_w)); - PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_w)); + PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_v_w)); __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); - __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_Subtract(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_t_6, __pyx_t_8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + /* "sklearn/linear_model/cd_fast.pyx":212 + * if not store_feature_inner_product: + * tmp_feature_inner_product = np.dot(X[:, ii], X) + * gradient[ii] = Xy[ii] - \ # <<<<<<<<<<<<<< + * np.dot(tmp_feature_inner_product, w) + * + */ + if (__Pyx_SetItemInt(__pyx_v_gradient, __pyx_v_ii, __pyx_t_8, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (__Pyx_SetItemInt(__pyx_v_gradient, __pyx_v_ii, __pyx_t_1, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L12; + goto __pyx_L14; } - __pyx_L12:; + __pyx_L14:; - /* "sklearn/linear_model/cd_fast.pyx":199 - * gradient[ii] = Xy[ii] - np.dot(feature_inner_product[:, ii], w) + /* "sklearn/linear_model/cd_fast.pyx":215 + * np.dot(tmp_feature_inner_product, w) * * tmp = gradient[ii] + w_ii * norm_cols_X[ii] # <<<<<<<<<<<<<< * * if positive and tmp < 0: */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_gradient, __pyx_v_ii, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_15 = __pyx_v_ii; - __pyx_t_8 = PyFloat_FromDouble((__pyx_v_w_ii * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_norm_cols_X.buf, __pyx_t_15, __pyx_bstride_0_norm_cols_X)))); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_v_gradient, __pyx_v_ii, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_6 = PyNumber_Add(__pyx_t_1, __pyx_t_8); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_17 = __pyx_v_ii; + __pyx_t_2 = PyFloat_FromDouble((__pyx_v_w_ii * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_norm_cols_X.buf, __pyx_t_17, __pyx_bstride_0_norm_cols_X)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Add(__pyx_t_8, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_6); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_tmp = __pyx_t_7; - /* "sklearn/linear_model/cd_fast.pyx":201 + /* "sklearn/linear_model/cd_fast.pyx":217 * tmp = gradient[ii] + w_ii * norm_cols_X[ii] * * if positive and tmp < 0: # <<<<<<<<<<<<<< * w[ii] = 0.0 * else: */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_5) { __pyx_t_16 = (__pyx_v_tmp < 0.0); - __pyx_t_17 = __pyx_t_16; + __pyx_t_15 = __pyx_t_16; } else { - __pyx_t_17 = __pyx_t_5; + __pyx_t_15 = __pyx_t_5; } - if (__pyx_t_17) { + if (__pyx_t_15) { - /* "sklearn/linear_model/cd_fast.pyx":202 + /* "sklearn/linear_model/cd_fast.pyx":218 * * if positive and tmp < 0: * w[ii] = 0.0 # <<<<<<<<<<<<<< @@ -3483,11 +3727,11 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_t_18 = __pyx_v_ii; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_18, __pyx_bstride_0_w) = 0.0; - goto __pyx_L13; + goto __pyx_L15; } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":205 + /* "sklearn/linear_model/cd_fast.pyx":221 * else: * w[ii] = fsign(tmp) * fmax(fabs(tmp) - alpha, 0) \ * / (norm_cols_X[ii] + beta) # <<<<<<<<<<<<<< @@ -3496,7 +3740,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_t_19 = __pyx_v_ii; - /* "sklearn/linear_model/cd_fast.pyx":204 + /* "sklearn/linear_model/cd_fast.pyx":220 * w[ii] = 0.0 * else: * w[ii] = fsign(tmp) * fmax(fabs(tmp) - alpha, 0) \ # <<<<<<<<<<<<<< @@ -3506,9 +3750,9 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_t_20 = __pyx_v_ii; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_20, __pyx_bstride_0_w) = ((__pyx_f_7sklearn_12linear_model_7cd_fast_fsign(__pyx_v_tmp) * __pyx_f_7sklearn_12linear_model_7cd_fast_fmax((fabs(__pyx_v_tmp) - __pyx_v_alpha), 0.0)) / ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_norm_cols_X.buf, __pyx_t_19, __pyx_bstride_0_norm_cols_X)) + __pyx_v_beta)); } - __pyx_L13:; + __pyx_L15:; - /* "sklearn/linear_model/cd_fast.pyx":208 + /* "sklearn/linear_model/cd_fast.pyx":224 * * # update gradients, if coef changed * if w_ii != w[ii]: # <<<<<<<<<<<<<< @@ -3516,142 +3760,240 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc * if n_iter >= 1 or j <= ii: */ __pyx_t_21 = __pyx_v_ii; - __pyx_t_17 = (__pyx_v_w_ii != (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_21, __pyx_bstride_0_w))); - if (__pyx_t_17) { + __pyx_t_15 = (__pyx_v_w_ii != (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_21, __pyx_bstride_0_w))); + if (__pyx_t_15) { - /* "sklearn/linear_model/cd_fast.pyx":209 + /* "sklearn/linear_model/cd_fast.pyx":225 * # update gradients, if coef changed * if w_ii != w[ii]: * for j in active_set: # <<<<<<<<<<<<<< * if n_iter >= 1 or j <= ii: - * gradient[j] -= feature_inner_product[ii, j] * \ + * if store_feature_inner_product: */ if (PyList_CheckExact(__pyx_v_active_set) || PyTuple_CheckExact(__pyx_v_active_set)) { - __pyx_t_6 = __pyx_v_active_set; __Pyx_INCREF(__pyx_t_6); __pyx_t_22 = 0; + __pyx_t_3 = __pyx_v_active_set; __Pyx_INCREF(__pyx_t_3); __pyx_t_22 = 0; __pyx_t_23 = NULL; } else { - __pyx_t_22 = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_active_set); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_6); - __pyx_t_23 = Py_TYPE(__pyx_t_6)->tp_iternext; + __pyx_t_22 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_active_set); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_23 = Py_TYPE(__pyx_t_3)->tp_iternext; } for (;;) { - if (PyList_CheckExact(__pyx_t_6)) { - if (__pyx_t_22 >= PyList_GET_SIZE(__pyx_t_6)) break; - __pyx_t_8 = PyList_GET_ITEM(__pyx_t_6, __pyx_t_22); __Pyx_INCREF(__pyx_t_8); __pyx_t_22++; - } else if (PyTuple_CheckExact(__pyx_t_6)) { - if (__pyx_t_22 >= PyTuple_GET_SIZE(__pyx_t_6)) break; - __pyx_t_8 = PyTuple_GET_ITEM(__pyx_t_6, __pyx_t_22); __Pyx_INCREF(__pyx_t_8); __pyx_t_22++; + if (PyList_CheckExact(__pyx_t_3)) { + if (__pyx_t_22 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_22); __Pyx_INCREF(__pyx_t_2); __pyx_t_22++; + } else if (PyTuple_CheckExact(__pyx_t_3)) { + if (__pyx_t_22 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_22); __Pyx_INCREF(__pyx_t_2); __pyx_t_22++; } else { - __pyx_t_8 = __pyx_t_23(__pyx_t_6); - if (unlikely(!__pyx_t_8)) { + __pyx_t_2 = __pyx_t_23(__pyx_t_3); + if (unlikely(!__pyx_t_2)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_8); + __Pyx_GOTREF(__pyx_t_2); } __Pyx_XDECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_8; - __pyx_t_8 = 0; + __pyx_v_j = __pyx_t_2; + __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":210 + /* "sklearn/linear_model/cd_fast.pyx":226 * if w_ii != w[ii]: * for j in active_set: * if n_iter >= 1 or j <= ii: # <<<<<<<<<<<<<< - * gradient[j] -= feature_inner_product[ii, j] * \ - * (w[ii] - w_ii) + * if store_feature_inner_product: + * gradient[j] -= feature_inner_product[ii, j] * \ */ - __pyx_t_17 = (__pyx_v_n_iter >= 1); - if (!__pyx_t_17) { - __pyx_t_8 = PyLong_FromUnsignedLong(__pyx_v_ii); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = (__pyx_v_n_iter >= 1); + if (!__pyx_t_15) { + __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_ii); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = PyObject_RichCompare(__pyx_v_j, __pyx_t_2, Py_LE); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_j, __pyx_t_8, Py_LE); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_8); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_16 = __pyx_t_5; } else { - __pyx_t_16 = __pyx_t_17; + __pyx_t_16 = __pyx_t_15; } if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":211 + /* "sklearn/linear_model/cd_fast.pyx":227 * for j in active_set: * if n_iter >= 1 or j <= ii: - * gradient[j] -= feature_inner_product[ii, j] * \ # <<<<<<<<<<<<<< + * if store_feature_inner_product: # <<<<<<<<<<<<<< + * gradient[j] -= feature_inner_product[ii, j] * \ * (w[ii] - w_ii) - * */ - __Pyx_INCREF(__pyx_v_j); - __pyx_t_1 = __pyx_v_j; - __pyx_t_8 = PyObject_GetItem(__pyx_v_gradient, __pyx_t_1); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __pyx_t_2 = PyLong_FromUnsignedLong(__pyx_v_ii); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_24)); - PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_j); - PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_v_j); - __Pyx_GIVEREF(__pyx_v_j); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetItem(__pyx_v_feature_inner_product, ((PyObject *)__pyx_t_24)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_24)); __pyx_t_24 = 0; + __pyx_t_16 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_store_feature_inner_product)); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":212 + /* "sklearn/linear_model/cd_fast.pyx":228 * if n_iter >= 1 or j <= ii: - * gradient[j] -= feature_inner_product[ii, j] * \ + * if store_feature_inner_product: + * gradient[j] -= feature_inner_product[ii, j] * \ # <<<<<<<<<<<<<< + * (w[ii] - w_ii) + * else: + */ + __Pyx_INCREF(__pyx_v_j); + __pyx_t_8 = __pyx_v_j; + __pyx_t_2 = PyObject_GetItem(__pyx_v_gradient, __pyx_t_8); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_ii); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_24 = PyTuple_New(2); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_24)); + PyTuple_SET_ITEM(__pyx_t_24, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_j); + PyTuple_SET_ITEM(__pyx_t_24, 1, __pyx_v_j); + __Pyx_GIVEREF(__pyx_v_j); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(__pyx_v_feature_inner_product, ((PyObject *)__pyx_t_24)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_24)); __pyx_t_24 = 0; + + /* "sklearn/linear_model/cd_fast.pyx":229 + * if store_feature_inner_product: + * gradient[j] -= feature_inner_product[ii, j] * \ * (w[ii] - w_ii) # <<<<<<<<<<<<<< - * + * else: + * tmp_feature_inner_product = np.dot(X[:, j], X) + */ + __pyx_t_25 = __pyx_v_ii; + __pyx_t_24 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_25, __pyx_bstride_0_w)) - __pyx_v_w_ii)); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_24); + __pyx_t_26 = PyNumber_Multiply(__pyx_t_1, __pyx_t_24); if (unlikely(!__pyx_t_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_26); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __pyx_t_24 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_t_26); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_24); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; + + /* "sklearn/linear_model/cd_fast.pyx":228 + * if n_iter >= 1 or j <= ii: + * if store_feature_inner_product: + * gradient[j] -= feature_inner_product[ii, j] * \ # <<<<<<<<<<<<<< + * (w[ii] - w_ii) + * else: + */ + if (PyObject_SetItem(__pyx_v_gradient, __pyx_t_8, __pyx_t_24) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + goto __pyx_L20; + } + /*else*/ { + + /* "sklearn/linear_model/cd_fast.pyx":231 + * (w[ii] - w_ii) + * else: + * tmp_feature_inner_product = np.dot(X[:, j], X) # <<<<<<<<<<<<<< + * gradient[j] -= tmp_feature_inner_product[j] * \ + * (w[ii] - w_ii) + */ + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_24 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__dot); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_24); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_INCREF(__pyx_k_slice_10); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_k_slice_10); + __Pyx_GIVEREF(__pyx_k_slice_10); + __Pyx_INCREF(__pyx_v_j); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_j); + __Pyx_GIVEREF(__pyx_v_j); + __pyx_t_26 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_8)); if (!__pyx_t_26) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_26); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_26); + __Pyx_GIVEREF(__pyx_t_26); + __Pyx_INCREF(((PyObject *)__pyx_v_X)); + PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_v_X)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); + __pyx_t_26 = 0; + __pyx_t_26 = PyObject_Call(__pyx_t_24, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_26); + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_v_tmp_feature_inner_product); + __pyx_v_tmp_feature_inner_product = __pyx_t_26; + __pyx_t_26 = 0; + + /* "sklearn/linear_model/cd_fast.pyx":232 + * else: + * tmp_feature_inner_product = np.dot(X[:, j], X) + * gradient[j] -= tmp_feature_inner_product[j] * \ # <<<<<<<<<<<<<< + * (w[ii] - w_ii) * # update the maximum absolute coefficient update */ - __pyx_t_25 = __pyx_v_ii; - __pyx_t_24 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_25, __pyx_bstride_0_w)) - __pyx_v_w_ii)); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_24); - __pyx_t_26 = PyNumber_Multiply(__pyx_t_2, __pyx_t_24); if (unlikely(!__pyx_t_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_26); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - __pyx_t_24 = PyNumber_InPlaceSubtract(__pyx_t_8, __pyx_t_26); if (unlikely(!__pyx_t_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_24); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; + __Pyx_INCREF(__pyx_v_j); + __pyx_t_26 = __pyx_v_j; + __pyx_t_8 = PyObject_GetItem(__pyx_v_gradient, __pyx_t_26); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_24 = PyObject_GetItem(__pyx_v_tmp_feature_inner_product, __pyx_v_j); if (!__pyx_t_24) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_24); - /* "sklearn/linear_model/cd_fast.pyx":211 - * for j in active_set: - * if n_iter >= 1 or j <= ii: - * gradient[j] -= feature_inner_product[ii, j] * \ # <<<<<<<<<<<<<< + /* "sklearn/linear_model/cd_fast.pyx":233 + * tmp_feature_inner_product = np.dot(X[:, j], X) + * gradient[j] -= tmp_feature_inner_product[j] * \ + * (w[ii] - w_ii) # <<<<<<<<<<<<<< + * # update the maximum absolute coefficient update + * d_w_ii = fabs(w[ii] - w_ii) + */ + __pyx_t_27 = __pyx_v_ii; + __pyx_t_2 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_27, __pyx_bstride_0_w)) - __pyx_v_w_ii)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_Multiply(__pyx_t_24, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_t_8, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "sklearn/linear_model/cd_fast.pyx":232 + * else: + * tmp_feature_inner_product = np.dot(X[:, j], X) + * gradient[j] -= tmp_feature_inner_product[j] * \ # <<<<<<<<<<<<<< * (w[ii] - w_ii) - * + * # update the maximum absolute coefficient update */ - if (PyObject_SetItem(__pyx_v_gradient, __pyx_t_1, __pyx_t_24) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_24); __pyx_t_24 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L17; + if (PyObject_SetItem(__pyx_v_gradient, __pyx_t_26, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_26); __pyx_t_26 = 0; + } + __pyx_L20:; + goto __pyx_L19; } - __pyx_L17:; + __pyx_L19:; } - __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - goto __pyx_L14; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L16; } - __pyx_L14:; + __pyx_L16:; - /* "sklearn/linear_model/cd_fast.pyx":215 - * + /* "sklearn/linear_model/cd_fast.pyx":235 + * (w[ii] - w_ii) * # update the maximum absolute coefficient update * d_w_ii = fabs(w[ii] - w_ii) # <<<<<<<<<<<<<< * if d_w_ii > d_w_max: * d_w_max = d_w_ii */ - __pyx_t_27 = __pyx_v_ii; - __pyx_v_d_w_ii = fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_27, __pyx_bstride_0_w)) - __pyx_v_w_ii)); + __pyx_t_28 = __pyx_v_ii; + __pyx_v_d_w_ii = fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_28, __pyx_bstride_0_w)) - __pyx_v_w_ii)); - /* "sklearn/linear_model/cd_fast.pyx":216 + /* "sklearn/linear_model/cd_fast.pyx":236 * # update the maximum absolute coefficient update * d_w_ii = fabs(w[ii] - w_ii) * if d_w_ii > d_w_max: # <<<<<<<<<<<<<< @@ -3661,7 +4003,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __pyx_t_16 = (__pyx_v_d_w_ii > __pyx_v_d_w_max); if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":217 + /* "sklearn/linear_model/cd_fast.pyx":237 * d_w_ii = fabs(w[ii] - w_ii) * if d_w_ii > d_w_max: * d_w_max = d_w_ii # <<<<<<<<<<<<<< @@ -3669,38 +4011,38 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc * if fabs(w[ii]) > w_max: */ __pyx_v_d_w_max = __pyx_v_d_w_ii; - goto __pyx_L18; + goto __pyx_L21; } - __pyx_L18:; + __pyx_L21:; - /* "sklearn/linear_model/cd_fast.pyx":219 + /* "sklearn/linear_model/cd_fast.pyx":239 * d_w_max = d_w_ii * * if fabs(w[ii]) > w_max: # <<<<<<<<<<<<<< * w_max = fabs(w[ii]) * */ - __pyx_t_28 = __pyx_v_ii; - __pyx_t_16 = (fabs((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_28, __pyx_bstride_0_w))) > __pyx_v_w_max); + __pyx_t_29 = __pyx_v_ii; + __pyx_t_16 = (fabs((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_29, __pyx_bstride_0_w))) > __pyx_v_w_max); if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":220 + /* "sklearn/linear_model/cd_fast.pyx":240 * * if fabs(w[ii]) > w_max: * w_max = fabs(w[ii]) # <<<<<<<<<<<<<< * * if w_max == 0.0 or d_w_max / w_max < d_w_tol or n_iter == max_iter - 1: */ - __pyx_t_29 = __pyx_v_ii; - __pyx_v_w_max = fabs((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_29, __pyx_bstride_0_w))); - goto __pyx_L19; + __pyx_t_30 = __pyx_v_ii; + __pyx_v_w_max = fabs((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_30, __pyx_bstride_0_w))); + goto __pyx_L22; } - __pyx_L19:; - __pyx_L9_continue:; + __pyx_L22:; + __pyx_L10_continue:; } - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "sklearn/linear_model/cd_fast.pyx":222 + /* "sklearn/linear_model/cd_fast.pyx":242 * w_max = fabs(w[ii]) * * if w_max == 0.0 or d_w_max / w_max < d_w_tol or n_iter == max_iter - 1: # <<<<<<<<<<<<<< @@ -3709,20 +4051,20 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_t_16 = (__pyx_v_w_max == 0.0); if (!__pyx_t_16) { - __pyx_t_17 = ((__pyx_v_d_w_max / __pyx_v_w_max) < __pyx_v_d_w_tol); - if (!__pyx_t_17) { + __pyx_t_15 = ((__pyx_v_d_w_max / __pyx_v_w_max) < __pyx_v_d_w_tol); + if (!__pyx_t_15) { __pyx_t_5 = (__pyx_v_n_iter == (__pyx_v_max_iter - 1)); - __pyx_t_30 = __pyx_t_5; + __pyx_t_31 = __pyx_t_5; } else { - __pyx_t_30 = __pyx_t_17; + __pyx_t_31 = __pyx_t_15; } - __pyx_t_17 = __pyx_t_30; + __pyx_t_15 = __pyx_t_31; } else { - __pyx_t_17 = __pyx_t_16; + __pyx_t_15 = __pyx_t_16; } - if (__pyx_t_17) { + if (__pyx_t_15) { - /* "sklearn/linear_model/cd_fast.pyx":227 + /* "sklearn/linear_model/cd_fast.pyx":247 * # criterion * * gap = calculate_gap(w, alpha, beta, X, y, positive) # <<<<<<<<<<<<<< @@ -3731,34 +4073,34 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc */ __pyx_v_gap = __pyx_f_7sklearn_12linear_model_7cd_fast_calculate_gap(((PyArrayObject *)__pyx_v_w), __pyx_v_alpha, __pyx_v_beta, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_y), __pyx_v_positive); - /* "sklearn/linear_model/cd_fast.pyx":229 + /* "sklearn/linear_model/cd_fast.pyx":249 * gap = calculate_gap(w, alpha, beta, X, y, positive) * * if gap < tol: # <<<<<<<<<<<<<< * # return if we reached desired tolerance * break */ - __pyx_t_17 = (__pyx_v_gap < __pyx_v_tol); - if (__pyx_t_17) { + __pyx_t_15 = (__pyx_v_gap < __pyx_v_tol); + if (__pyx_t_15) { - /* "sklearn/linear_model/cd_fast.pyx":231 + /* "sklearn/linear_model/cd_fast.pyx":251 * if gap < tol: * # return if we reached desired tolerance * break # <<<<<<<<<<<<<< * * return w, gap, tol */ - goto __pyx_L8_break; - goto __pyx_L21; + goto __pyx_L9_break; + goto __pyx_L24; } - __pyx_L21:; - goto __pyx_L20; + __pyx_L24:; + goto __pyx_L23; } - __pyx_L20:; + __pyx_L23:; } - __pyx_L8_break:; + __pyx_L9_break:; - /* "sklearn/linear_model/cd_fast.pyx":233 + /* "sklearn/linear_model/cd_fast.pyx":253 * break * * return w, gap, tol # <<<<<<<<<<<<<< @@ -3766,23 +4108,23 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_26 = PyTuple_New(3); if (unlikely(!__pyx_t_26)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_26)); __Pyx_INCREF(((PyObject *)__pyx_v_w)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_w)); + PyTuple_SET_ITEM(__pyx_t_26, 0, ((PyObject *)__pyx_v_w)); __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_26, 1, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); - __pyx_t_3 = 0; + PyTuple_SET_ITEM(__pyx_t_26, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_6 = 0; - __pyx_r = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_26); + __pyx_t_26 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -3812,17 +4154,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_2enet_coordinate_desc __Pyx_SafeReleaseBuffer(&__pyx_bstruct_y); __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_norm_cols_X); + __Pyx_XDECREF((PyObject *)__pyx_v_store_feature_inner_product); __Pyx_XDECREF(__pyx_v_Xy); __Pyx_XDECREF(__pyx_v_feature_inner_product); __Pyx_XDECREF(__pyx_v_gradient); __Pyx_XDECREF(__pyx_v_active_set); + __Pyx_XDECREF(__pyx_v_tmp_feature_inner_product); __Pyx_XDECREF(__pyx_v_j); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/linear_model/cd_fast.pyx":239 +/* "sklearn/linear_model/cd_fast.pyx":259 * @cython.wraparound(False) * @cython.cdivision(True) * def sparse_enet_coordinate_descent(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< @@ -4004,55 +4348,55 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_data); if (likely(values[3])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_indices); if (likely(values[4])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_indptr); if (likely(values[5])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); if (likely(values[6])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X_mean); if (likely(values[7])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_iter); if (likely(values[8])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 9: values[9] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tol); if (likely(values[9])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, 9); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 10: if (kw_args > 0) { @@ -4061,7 +4405,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_enet_coordinate_descent") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "sparse_enet_coordinate_descent") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -4081,20 +4425,20 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } } __pyx_v_w = ((PyArrayObject *)values[0]); - __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_beta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_beta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_X_data = ((PyArrayObject *)values[3]); __pyx_v_X_indices = ((PyArrayObject *)values[4]); __pyx_v_X_indptr = ((PyArrayObject *)values[5]); __pyx_v_y = ((PyArrayObject *)values[6]); __pyx_v_X_mean = ((PyArrayObject *)values[7]); - __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_tol = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[8]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_tol = __pyx_PyFloat_AsDouble(values[9]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L3_error;} if (values[10]) { - __pyx_v_positive = __Pyx_PyObject_IsTrue(values[10]); if (unlikely((__pyx_v_positive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_positive = __Pyx_PyObject_IsTrue(values[10]); if (unlikely((__pyx_v_positive == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/linear_model/cd_fast.pyx":246 + /* "sklearn/linear_model/cd_fast.pyx":266 * np.ndarray[DOUBLE, ndim=1] y, * np.ndarray[DOUBLE, ndim=1] X_mean, * int max_iter, double tol, bint positive=False): # <<<<<<<<<<<<<< @@ -4106,7 +4450,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("sparse_enet_coordinate_descent", 0, 10, 11, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.cd_fast.sparse_enet_coordinate_descent", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -4120,50 +4464,50 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_bstruct_X_indptr.buf = NULL; __pyx_bstruct_y.buf = NULL; __pyx_bstruct_X_mean.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_data), __pyx_ptype_5numpy_ndarray, 1, "X_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indices), __pyx_ptype_5numpy_ndarray, 1, "X_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indptr), __pyx_ptype_5numpy_ndarray, 1, "X_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_mean), __pyx_ptype_5numpy_ndarray, 1, "X_mean", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_data), __pyx_ptype_5numpy_ndarray, 1, "X_data", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indices), __pyx_ptype_5numpy_ndarray, 1, "X_indices", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_indptr), __pyx_ptype_5numpy_ndarray, 1, "X_indptr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X_mean), __pyx_ptype_5numpy_ndarray, 1, "X_mean", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_w, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_w, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_w = __pyx_bstruct_w.strides[0]; __pyx_bshape_0_w = __pyx_bstruct_w.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_data, (PyObject*)__pyx_v_X_data, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_data, (PyObject*)__pyx_v_X_data, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_X_data = __pyx_bstruct_X_data.strides[0]; __pyx_bshape_0_X_data = __pyx_bstruct_X_data.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indices, (PyObject*)__pyx_v_X_indices, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indices, (PyObject*)__pyx_v_X_indices, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_X_indices = __pyx_bstruct_X_indices.strides[0]; __pyx_bshape_0_X_indices = __pyx_bstruct_X_indices.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indptr, (PyObject*)__pyx_v_X_indptr, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_indptr, (PyObject*)__pyx_v_X_indptr, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_X_indptr = __pyx_bstruct_X_indptr.strides[0]; __pyx_bshape_0_X_indptr = __pyx_bstruct_X_indptr.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_y = __pyx_bstruct_y.strides[0]; __pyx_bshape_0_y = __pyx_bstruct_y.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_mean, (PyObject*)__pyx_v_X_mean, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X_mean, (PyObject*)__pyx_v_X_mean, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_X_mean = __pyx_bstruct_X_mean.strides[0]; __pyx_bshape_0_X_mean = __pyx_bstruct_X_mean.shape[0]; - /* "sklearn/linear_model/cd_fast.pyx":258 + /* "sklearn/linear_model/cd_fast.pyx":278 * * # get the data information into easy vars * cdef unsigned int n_samples = y.shape[0] # <<<<<<<<<<<<<< @@ -4172,7 +4516,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ __pyx_v_n_samples = (__pyx_v_y->dimensions[0]); - /* "sklearn/linear_model/cd_fast.pyx":259 + /* "sklearn/linear_model/cd_fast.pyx":279 * # get the data information into easy vars * cdef unsigned int n_samples = y.shape[0] * cdef unsigned int n_features = w.shape[0] # <<<<<<<<<<<<<< @@ -4181,34 +4525,34 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ __pyx_v_n_features = (__pyx_v_w->dimensions[0]); - /* "sklearn/linear_model/cd_fast.pyx":263 + /* "sklearn/linear_model/cd_fast.pyx":283 * # compute norms of the columns of X * cdef unsigned int ii * cdef np.ndarray[DOUBLE, ndim = 1] norm_cols_X = np.zeros(n_features, # <<<<<<<<<<<<<< * np.float64) * for ii in xrange(n_features): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - /* "sklearn/linear_model/cd_fast.pyx":264 + /* "sklearn/linear_model/cd_fast.pyx":284 * cdef unsigned int ii * cdef np.ndarray[DOUBLE, ndim = 1] norm_cols_X = np.zeros(n_features, * np.float64) # <<<<<<<<<<<<<< * for ii in xrange(n_features): * norm_cols_X[ii] = ((X_data[X_indptr[ii]:X_indptr[ii + 1]] - \ */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float64); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -4216,17 +4560,17 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __Pyx_GIVEREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_norm_cols_X, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_norm_cols_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_norm_cols_X.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_norm_cols_X = __pyx_bstruct_norm_cols_X.strides[0]; __pyx_bshape_0_norm_cols_X = __pyx_bstruct_norm_cols_X.shape[0]; } @@ -4235,7 +4579,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_v_norm_cols_X = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/linear_model/cd_fast.pyx":265 + /* "sklearn/linear_model/cd_fast.pyx":285 * cdef np.ndarray[DOUBLE, ndim = 1] norm_cols_X = np.zeros(n_features, * np.float64) * for ii in xrange(n_features): # <<<<<<<<<<<<<< @@ -4246,7 +4590,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_ii = __pyx_t_7; - /* "sklearn/linear_model/cd_fast.pyx":266 + /* "sklearn/linear_model/cd_fast.pyx":286 * np.float64) * for ii in xrange(n_features): * norm_cols_X[ii] = ((X_data[X_indptr[ii]:X_indptr[ii + 1]] - \ # <<<<<<<<<<<<<< @@ -4255,10 +4599,10 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ __pyx_t_8 = __pyx_v_ii; __pyx_t_9 = (__pyx_v_ii + 1); - __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_X_data), (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_bstruct_X_indptr.buf, __pyx_t_8, __pyx_bstride_0_X_indptr)), (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_bstruct_X_indptr.buf, __pyx_t_9, __pyx_bstride_0_X_indptr))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PySequence_GetSlice(((PyObject *)__pyx_v_X_data), (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_bstruct_X_indptr.buf, __pyx_t_8, __pyx_bstride_0_X_indptr)), (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_bstruct_X_indptr.buf, __pyx_t_9, __pyx_bstride_0_X_indptr))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - /* "sklearn/linear_model/cd_fast.pyx":267 + /* "sklearn/linear_model/cd_fast.pyx":287 * for ii in xrange(n_features): * norm_cols_X[ii] = ((X_data[X_indptr[ii]:X_indptr[ii + 1]] - \ * X_mean[ii]) ** 2).sum() + \ # <<<<<<<<<<<<<< @@ -4266,23 +4610,23 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina * */ __pyx_t_10 = __pyx_v_ii; - __pyx_t_3 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_mean.buf, __pyx_t_10, __pyx_bstride_0_X_mean))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_mean.buf, __pyx_t_10, __pyx_bstride_0_X_mean))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Subtract(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":268 + /* "sklearn/linear_model/cd_fast.pyx":288 * norm_cols_X[ii] = ((X_data[X_indptr[ii]:X_indptr[ii + 1]] - \ * X_mean[ii]) ** 2).sum() + \ * (n_samples - X_indptr[ii + 1] + X_indptr[ii]) * X_mean[ii] ** 2 # <<<<<<<<<<<<<< @@ -4292,16 +4636,16 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_t_11 = (__pyx_v_ii + 1); __pyx_t_12 = __pyx_v_ii; __pyx_t_13 = __pyx_v_ii; - __pyx_t_2 = PyFloat_FromDouble((((__pyx_v_n_samples - (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_bstruct_X_indptr.buf, __pyx_t_11, __pyx_bstride_0_X_indptr))) + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_bstruct_X_indptr.buf, __pyx_t_12, __pyx_bstride_0_X_indptr))) * pow((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_mean.buf, __pyx_t_13, __pyx_bstride_0_X_mean)), 2.0))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble((((__pyx_v_n_samples - (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_bstruct_X_indptr.buf, __pyx_t_11, __pyx_bstride_0_X_indptr))) + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_bstruct_X_indptr.buf, __pyx_t_12, __pyx_bstride_0_X_indptr))) * pow((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_mean.buf, __pyx_t_13, __pyx_bstride_0_X_mean)), 2.0))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_14 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_14 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "sklearn/linear_model/cd_fast.pyx":266 + /* "sklearn/linear_model/cd_fast.pyx":286 * np.float64) * for ii in xrange(n_features): * norm_cols_X[ii] = ((X_data[X_indptr[ii]:X_indptr[ii + 1]] - \ # <<<<<<<<<<<<<< @@ -4312,7 +4656,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_norm_cols_X.buf, __pyx_t_15, __pyx_bstride_0_norm_cols_X) = __pyx_t_14; } - /* "sklearn/linear_model/cd_fast.pyx":280 + /* "sklearn/linear_model/cd_fast.pyx":300 * cdef double X_mean_ii * cdef double R_sum * cdef double gap = tol + 1.0 # <<<<<<<<<<<<<< @@ -4321,7 +4665,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ __pyx_v_gap = (__pyx_v_tol + 1.0); - /* "sklearn/linear_model/cd_fast.pyx":281 + /* "sklearn/linear_model/cd_fast.pyx":301 * cdef double R_sum * cdef double gap = tol + 1.0 * cdef double d_w_tol = tol # <<<<<<<<<<<<<< @@ -4330,38 +4674,38 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ __pyx_v_d_w_tol = __pyx_v_tol; - /* "sklearn/linear_model/cd_fast.pyx":284 + /* "sklearn/linear_model/cd_fast.pyx":304 * cdef unsigned int jj * cdef unsigned int n_iter * cdef bint center = (X_mean != 0).any() # <<<<<<<<<<<<<< * * # initialize the residuals */ - __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_X_mean), __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(((PyObject *)__pyx_v_X_mean), __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__any); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely((__pyx_t_16 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_center = __pyx_t_16; - /* "sklearn/linear_model/cd_fast.pyx":287 + /* "sklearn/linear_model/cd_fast.pyx":307 * * # initialize the residuals * R = y.copy() # <<<<<<<<<<<<<< * * for ii in xrange(n_features): */ - __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_y), __pyx_n_s__copy); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -4378,13 +4722,13 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } __pyx_bstride_0_R = __pyx_bstruct_R.strides[0]; __pyx_bshape_0_R = __pyx_bstruct_R.shape[0]; - if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = 0; __pyx_v_R = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":289 + /* "sklearn/linear_model/cd_fast.pyx":309 * R = y.copy() * * for ii in xrange(n_features): # <<<<<<<<<<<<<< @@ -4395,7 +4739,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_ii = __pyx_t_7; - /* "sklearn/linear_model/cd_fast.pyx":291 + /* "sklearn/linear_model/cd_fast.pyx":311 * for ii in xrange(n_features): * # sparse X column / dense w dot product * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): # <<<<<<<<<<<<<< @@ -4408,7 +4752,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina for (__pyx_t_25 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_bstruct_X_indptr.buf, __pyx_t_24, __pyx_bstride_0_X_indptr)); __pyx_t_25 < __pyx_t_23; __pyx_t_25+=1) { __pyx_v_jj = __pyx_t_25; - /* "sklearn/linear_model/cd_fast.pyx":292 + /* "sklearn/linear_model/cd_fast.pyx":312 * # sparse X column / dense w dot product * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * R[X_indices[jj]] -= X_data[jj] * w[ii] # <<<<<<<<<<<<<< @@ -4422,7 +4766,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_R.buf, __pyx_t_29, __pyx_bstride_0_R) -= ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_26, __pyx_bstride_0_X_data)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_27, __pyx_bstride_0_w))); } - /* "sklearn/linear_model/cd_fast.pyx":293 + /* "sklearn/linear_model/cd_fast.pyx":313 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * R[X_indices[jj]] -= X_data[jj] * w[ii] * if center: # <<<<<<<<<<<<<< @@ -4431,7 +4775,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ if (__pyx_v_center) { - /* "sklearn/linear_model/cd_fast.pyx":294 + /* "sklearn/linear_model/cd_fast.pyx":314 * R[X_indices[jj]] -= X_data[jj] * w[ii] * if center: * R += X_mean[ii] * w[ii] # <<<<<<<<<<<<<< @@ -4440,12 +4784,12 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ __pyx_t_25 = __pyx_v_ii; __pyx_t_30 = __pyx_v_ii; - __pyx_t_2 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_mean.buf, __pyx_t_25, __pyx_bstride_0_X_mean)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_30, __pyx_bstride_0_w)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_mean.buf, __pyx_t_25, __pyx_bstride_0_X_mean)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_30, __pyx_bstride_0_w)))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_R), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_InPlaceAdd(((PyObject *)__pyx_v_R), __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_17 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -4462,7 +4806,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } __pyx_bstride_0_R = __pyx_bstruct_R.strides[0]; __pyx_bshape_0_R = __pyx_bstruct_R.shape[0]; - if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_18 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_17 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_R)); @@ -4473,41 +4817,41 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_L12:; } - /* "sklearn/linear_model/cd_fast.pyx":296 + /* "sklearn/linear_model/cd_fast.pyx":316 * R += X_mean[ii] * w[ii] * * tol = tol * linalg.norm(y) ** 2 # <<<<<<<<<<<<<< * * for n_iter in range(max_iter): */ - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(((PyObject *)__pyx_v_y)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Power(__pyx_t_1, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Power(__pyx_t_1, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 316; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_tol = __pyx_t_31; - /* "sklearn/linear_model/cd_fast.pyx":298 + /* "sklearn/linear_model/cd_fast.pyx":318 * tol = tol * linalg.norm(y) ** 2 * * for n_iter in range(max_iter): # <<<<<<<<<<<<<< @@ -4518,7 +4862,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_18; __pyx_t_6+=1) { __pyx_v_n_iter = __pyx_t_6; - /* "sklearn/linear_model/cd_fast.pyx":300 + /* "sklearn/linear_model/cd_fast.pyx":320 * for n_iter in range(max_iter): * * w_max = 0.0 # <<<<<<<<<<<<<< @@ -4527,7 +4871,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ __pyx_v_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":301 + /* "sklearn/linear_model/cd_fast.pyx":321 * * w_max = 0.0 * d_w_max = 0.0 # <<<<<<<<<<<<<< @@ -4536,7 +4880,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ __pyx_v_d_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":303 + /* "sklearn/linear_model/cd_fast.pyx":323 * d_w_max = 0.0 * * for ii in xrange(n_features): # Loop over coordinates # <<<<<<<<<<<<<< @@ -4547,7 +4891,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_7; __pyx_t_32+=1) { __pyx_v_ii = __pyx_t_32; - /* "sklearn/linear_model/cd_fast.pyx":305 + /* "sklearn/linear_model/cd_fast.pyx":325 * for ii in xrange(n_features): # Loop over coordinates * * if norm_cols_X[ii] == 0.0: # <<<<<<<<<<<<<< @@ -4558,7 +4902,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_t_16 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_norm_cols_X.buf, __pyx_t_33, __pyx_bstride_0_norm_cols_X)) == 0.0); if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":306 + /* "sklearn/linear_model/cd_fast.pyx":326 * * if norm_cols_X[ii] == 0.0: * continue # <<<<<<<<<<<<<< @@ -4570,7 +4914,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } __pyx_L17:; - /* "sklearn/linear_model/cd_fast.pyx":308 + /* "sklearn/linear_model/cd_fast.pyx":328 * continue * * w_ii = w[ii] # Store previous value # <<<<<<<<<<<<<< @@ -4580,7 +4924,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_t_34 = __pyx_v_ii; __pyx_v_w_ii = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_34, __pyx_bstride_0_w)); - /* "sklearn/linear_model/cd_fast.pyx":309 + /* "sklearn/linear_model/cd_fast.pyx":329 * * w_ii = w[ii] # Store previous value * X_mean_ii = X_mean[ii] # <<<<<<<<<<<<<< @@ -4590,7 +4934,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_t_35 = __pyx_v_ii; __pyx_v_X_mean_ii = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_mean.buf, __pyx_t_35, __pyx_bstride_0_X_mean)); - /* "sklearn/linear_model/cd_fast.pyx":311 + /* "sklearn/linear_model/cd_fast.pyx":331 * X_mean_ii = X_mean[ii] * * if w_ii != 0.0: # <<<<<<<<<<<<<< @@ -4600,7 +4944,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_t_16 = (__pyx_v_w_ii != 0.0); if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":313 + /* "sklearn/linear_model/cd_fast.pyx":333 * if w_ii != 0.0: * # R += w_ii * X[:,ii] * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): # <<<<<<<<<<<<<< @@ -4613,7 +4957,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina for (__pyx_t_38 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_bstruct_X_indptr.buf, __pyx_t_37, __pyx_bstride_0_X_indptr)); __pyx_t_38 < __pyx_t_23; __pyx_t_38+=1) { __pyx_v_jj = __pyx_t_38; - /* "sklearn/linear_model/cd_fast.pyx":314 + /* "sklearn/linear_model/cd_fast.pyx":334 * # R += w_ii * X[:,ii] * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * R[X_indices[jj]] += X_data[jj] * w_ii # <<<<<<<<<<<<<< @@ -4626,7 +4970,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_R.buf, __pyx_t_41, __pyx_bstride_0_R) += ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_39, __pyx_bstride_0_X_data)) * __pyx_v_w_ii); } - /* "sklearn/linear_model/cd_fast.pyx":315 + /* "sklearn/linear_model/cd_fast.pyx":335 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * R[X_indices[jj]] += X_data[jj] * w_ii * if center: # <<<<<<<<<<<<<< @@ -4635,7 +4979,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ if (__pyx_v_center) { - /* "sklearn/linear_model/cd_fast.pyx":316 + /* "sklearn/linear_model/cd_fast.pyx":336 * R[X_indices[jj]] += X_data[jj] * w_ii * if center: * for jj in xrange(n_samples): # <<<<<<<<<<<<<< @@ -4646,7 +4990,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina for (__pyx_t_42 = 0; __pyx_t_42 < __pyx_t_38; __pyx_t_42+=1) { __pyx_v_jj = __pyx_t_42; - /* "sklearn/linear_model/cd_fast.pyx":317 + /* "sklearn/linear_model/cd_fast.pyx":337 * if center: * for jj in xrange(n_samples): * R[jj] -= X_mean_ii * w[ii] # <<<<<<<<<<<<<< @@ -4664,7 +5008,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } __pyx_L18:; - /* "sklearn/linear_model/cd_fast.pyx":320 + /* "sklearn/linear_model/cd_fast.pyx":340 * * # tmp = (X[:,ii] * R).sum() * tmp = 0.0 # <<<<<<<<<<<<<< @@ -4673,7 +5017,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ __pyx_v_tmp = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":321 + /* "sklearn/linear_model/cd_fast.pyx":341 * # tmp = (X[:,ii] * R).sum() * tmp = 0.0 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): # <<<<<<<<<<<<<< @@ -4686,7 +5030,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina for (__pyx_t_42 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_bstruct_X_indptr.buf, __pyx_t_38, __pyx_bstride_0_X_indptr)); __pyx_t_42 < __pyx_t_23; __pyx_t_42+=1) { __pyx_v_jj = __pyx_t_42; - /* "sklearn/linear_model/cd_fast.pyx":322 + /* "sklearn/linear_model/cd_fast.pyx":342 * tmp = 0.0 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * tmp += R[X_indices[jj]] * X_data[jj] # <<<<<<<<<<<<<< @@ -4699,7 +5043,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_v_tmp = (__pyx_v_tmp + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_R.buf, __pyx_t_47, __pyx_bstride_0_R)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_48, __pyx_bstride_0_X_data)))); } - /* "sklearn/linear_model/cd_fast.pyx":324 + /* "sklearn/linear_model/cd_fast.pyx":344 * tmp += R[X_indices[jj]] * X_data[jj] * * if center: # <<<<<<<<<<<<<< @@ -4708,7 +5052,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ if (__pyx_v_center) { - /* "sklearn/linear_model/cd_fast.pyx":325 + /* "sklearn/linear_model/cd_fast.pyx":345 * * if center: * R_sum = 0.0 # <<<<<<<<<<<<<< @@ -4717,7 +5061,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ __pyx_v_R_sum = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":326 + /* "sklearn/linear_model/cd_fast.pyx":346 * if center: * R_sum = 0.0 * for jj in xrange(n_samples): # <<<<<<<<<<<<<< @@ -4728,7 +5072,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina for (__pyx_t_49 = 0; __pyx_t_49 < __pyx_t_42; __pyx_t_49+=1) { __pyx_v_jj = __pyx_t_49; - /* "sklearn/linear_model/cd_fast.pyx":327 + /* "sklearn/linear_model/cd_fast.pyx":347 * R_sum = 0.0 * for jj in xrange(n_samples): * R_sum += R[jj] # <<<<<<<<<<<<<< @@ -4739,7 +5083,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_v_R_sum = (__pyx_v_R_sum + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_R.buf, __pyx_t_50, __pyx_bstride_0_R))); } - /* "sklearn/linear_model/cd_fast.pyx":328 + /* "sklearn/linear_model/cd_fast.pyx":348 * for jj in xrange(n_samples): * R_sum += R[jj] * tmp -= R_sum * X_mean_ii # <<<<<<<<<<<<<< @@ -4751,7 +5095,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } __pyx_L26:; - /* "sklearn/linear_model/cd_fast.pyx":330 + /* "sklearn/linear_model/cd_fast.pyx":350 * tmp -= R_sum * X_mean_ii * * if positive and tmp < 0.0: # <<<<<<<<<<<<<< @@ -4766,7 +5110,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } if (__pyx_t_51) { - /* "sklearn/linear_model/cd_fast.pyx":331 + /* "sklearn/linear_model/cd_fast.pyx":351 * * if positive and tmp < 0.0: * w[ii] = 0.0 # <<<<<<<<<<<<<< @@ -4779,7 +5123,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":334 + /* "sklearn/linear_model/cd_fast.pyx":354 * else: * w[ii] = fsign(tmp) * fmax(fabs(tmp) - alpha, 0) \ * / (norm_cols_X[ii] + beta) # <<<<<<<<<<<<<< @@ -4788,7 +5132,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ __pyx_t_49 = __pyx_v_ii; - /* "sklearn/linear_model/cd_fast.pyx":333 + /* "sklearn/linear_model/cd_fast.pyx":353 * w[ii] = 0.0 * else: * w[ii] = fsign(tmp) * fmax(fabs(tmp) - alpha, 0) \ # <<<<<<<<<<<<<< @@ -4800,7 +5144,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } __pyx_L29:; - /* "sklearn/linear_model/cd_fast.pyx":336 + /* "sklearn/linear_model/cd_fast.pyx":356 * / (norm_cols_X[ii] + beta) * * if w[ii] != 0.0: # <<<<<<<<<<<<<< @@ -4811,7 +5155,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_t_51 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_53, __pyx_bstride_0_w)) != 0.0); if (__pyx_t_51) { - /* "sklearn/linear_model/cd_fast.pyx":338 + /* "sklearn/linear_model/cd_fast.pyx":358 * if w[ii] != 0.0: * # R -= w[ii] * X[:,ii] # Update residual * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): # <<<<<<<<<<<<<< @@ -4824,7 +5168,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina for (__pyx_t_56 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_bstruct_X_indptr.buf, __pyx_t_55, __pyx_bstride_0_X_indptr)); __pyx_t_56 < __pyx_t_23; __pyx_t_56+=1) { __pyx_v_jj = __pyx_t_56; - /* "sklearn/linear_model/cd_fast.pyx":339 + /* "sklearn/linear_model/cd_fast.pyx":359 * # R -= w[ii] * X[:,ii] # Update residual * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * R[X_indices[jj]] -= X_data[jj] * w[ii] # <<<<<<<<<<<<<< @@ -4838,7 +5182,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_R.buf, __pyx_t_60, __pyx_bstride_0_R) -= ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_57, __pyx_bstride_0_X_data)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_58, __pyx_bstride_0_w))); } - /* "sklearn/linear_model/cd_fast.pyx":341 + /* "sklearn/linear_model/cd_fast.pyx":361 * R[X_indices[jj]] -= X_data[jj] * w[ii] * * if center: # <<<<<<<<<<<<<< @@ -4847,7 +5191,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ if (__pyx_v_center) { - /* "sklearn/linear_model/cd_fast.pyx":342 + /* "sklearn/linear_model/cd_fast.pyx":362 * * if center: * for jj in xrange(n_samples): # <<<<<<<<<<<<<< @@ -4858,7 +5202,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina for (__pyx_t_61 = 0; __pyx_t_61 < __pyx_t_56; __pyx_t_61+=1) { __pyx_v_jj = __pyx_t_61; - /* "sklearn/linear_model/cd_fast.pyx":343 + /* "sklearn/linear_model/cd_fast.pyx":363 * if center: * for jj in xrange(n_samples): * R[jj] += X_mean_ii * w[ii] # <<<<<<<<<<<<<< @@ -4876,7 +5220,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } __pyx_L30:; - /* "sklearn/linear_model/cd_fast.pyx":346 + /* "sklearn/linear_model/cd_fast.pyx":366 * * # update the maximum absolute coefficient update * d_w_ii = fabs(w[ii] - w_ii) # <<<<<<<<<<<<<< @@ -4886,7 +5230,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_t_56 = __pyx_v_ii; __pyx_v_d_w_ii = fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_56, __pyx_bstride_0_w)) - __pyx_v_w_ii)); - /* "sklearn/linear_model/cd_fast.pyx":347 + /* "sklearn/linear_model/cd_fast.pyx":367 * # update the maximum absolute coefficient update * d_w_ii = fabs(w[ii] - w_ii) * if d_w_ii > d_w_max: # <<<<<<<<<<<<<< @@ -4896,7 +5240,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_t_51 = (__pyx_v_d_w_ii > __pyx_v_d_w_max); if (__pyx_t_51) { - /* "sklearn/linear_model/cd_fast.pyx":348 + /* "sklearn/linear_model/cd_fast.pyx":368 * d_w_ii = fabs(w[ii] - w_ii) * if d_w_ii > d_w_max: * d_w_max = d_w_ii # <<<<<<<<<<<<<< @@ -4908,7 +5252,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } __pyx_L36:; - /* "sklearn/linear_model/cd_fast.pyx":350 + /* "sklearn/linear_model/cd_fast.pyx":370 * d_w_max = d_w_ii * * if w[ii] > w_max: # <<<<<<<<<<<<<< @@ -4919,7 +5263,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_t_51 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_61, __pyx_bstride_0_w)) > __pyx_v_w_max); if (__pyx_t_51) { - /* "sklearn/linear_model/cd_fast.pyx":351 + /* "sklearn/linear_model/cd_fast.pyx":371 * * if w[ii] > w_max: * w_max = w[ii] # <<<<<<<<<<<<<< @@ -4934,7 +5278,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_L15_continue:; } - /* "sklearn/linear_model/cd_fast.pyx":353 + /* "sklearn/linear_model/cd_fast.pyx":373 * w_max = w[ii] * * if w_max == 0.0 or d_w_max / w_max < d_w_tol or n_iter == max_iter - 1: # <<<<<<<<<<<<<< @@ -4956,26 +5300,26 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":359 + /* "sklearn/linear_model/cd_fast.pyx":379 * * # sparse X.T / dense R dot product * X_T_R = np.zeros(n_features) # <<<<<<<<<<<<<< * for ii in xrange(n_features): * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyLong_FromUnsignedLong(__pyx_v_n_features); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; @@ -4983,7 +5327,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_v_X_T_R = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":360 + /* "sklearn/linear_model/cd_fast.pyx":380 * # sparse X.T / dense R dot product * X_T_R = np.zeros(n_features) * for ii in xrange(n_features): # <<<<<<<<<<<<<< @@ -4994,7 +5338,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_7; __pyx_t_32+=1) { __pyx_v_ii = __pyx_t_32; - /* "sklearn/linear_model/cd_fast.pyx":361 + /* "sklearn/linear_model/cd_fast.pyx":381 * X_T_R = np.zeros(n_features) * for ii in xrange(n_features): * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): # <<<<<<<<<<<<<< @@ -5007,7 +5351,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina for (__pyx_t_69 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_bstruct_X_indptr.buf, __pyx_t_68, __pyx_bstride_0_X_indptr)); __pyx_t_69 < __pyx_t_23; __pyx_t_69+=1) { __pyx_v_jj = __pyx_t_69; - /* "sklearn/linear_model/cd_fast.pyx":362 + /* "sklearn/linear_model/cd_fast.pyx":382 * for ii in xrange(n_features): * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * X_T_R[ii] += X_data[jj] * R[X_indices[jj]] # <<<<<<<<<<<<<< @@ -5015,22 +5359,22 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina * */ __pyx_t_70 = __pyx_v_ii; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_X_T_R, __pyx_t_70, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_X_T_R, __pyx_t_70, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_71 = __pyx_v_jj; __pyx_t_72 = __pyx_v_jj; __pyx_t_73 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_INTEGER *, __pyx_bstruct_X_indices.buf, __pyx_t_72, __pyx_bstride_0_X_indices)); - __pyx_t_4 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_71, __pyx_bstride_0_X_data)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_R.buf, __pyx_t_73, __pyx_bstride_0_R)))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_data.buf, __pyx_t_71, __pyx_bstride_0_X_data)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_R.buf, __pyx_t_73, __pyx_bstride_0_R)))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__Pyx_SetItemInt(__pyx_v_X_T_R, __pyx_t_70, __pyx_t_2, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_v_X_T_R, __pyx_t_70, __pyx_t_2, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "sklearn/linear_model/cd_fast.pyx":363 + /* "sklearn/linear_model/cd_fast.pyx":383 * for jj in xrange(X_indptr[ii], X_indptr[ii + 1]): * X_T_R[ii] += X_data[jj] * R[X_indices[jj]] * X_T_R[ii] -= X_mean[ii] * R.sum() # <<<<<<<<<<<<<< @@ -5038,48 +5382,48 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina * XtA = X_T_R - beta * w */ __pyx_t_69 = __pyx_v_ii; - __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_X_T_R, __pyx_t_69, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_v_X_T_R, __pyx_t_69, sizeof(unsigned int)+1, PyLong_FromUnsignedLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_70 = __pyx_v_ii; - __pyx_t_4 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_mean.buf, __pyx_t_70, __pyx_bstride_0_X_mean))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_X_mean.buf, __pyx_t_70, __pyx_bstride_0_X_mean))); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_R), __pyx_n_s__sum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_R), __pyx_n_s__sum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_InPlaceSubtract(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_SetItemInt(__pyx_v_X_T_R, __pyx_t_69, __pyx_t_3, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(__pyx_v_X_T_R, __pyx_t_69, __pyx_t_3, sizeof(unsigned int)+1, PyLong_FromUnsignedLong) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } - /* "sklearn/linear_model/cd_fast.pyx":365 + /* "sklearn/linear_model/cd_fast.pyx":385 * X_T_R[ii] -= X_mean[ii] * R.sum() * * XtA = X_T_R - beta * w # <<<<<<<<<<<<<< * if positive: * dual_norm_XtA = np.max(XtA) */ - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_beta); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_beta); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_w)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_v_X_T_R, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_v_X_T_R, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_v_XtA); __pyx_v_XtA = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":366 + /* "sklearn/linear_model/cd_fast.pyx":386 * * XtA = X_T_R - beta * w * if positive: # <<<<<<<<<<<<<< @@ -5088,24 +5432,24 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina */ if (__pyx_v_positive) { - /* "sklearn/linear_model/cd_fast.pyx":367 + /* "sklearn/linear_model/cd_fast.pyx":387 * XtA = X_T_R - beta * w * if positive: * dual_norm_XtA = np.max(XtA) # <<<<<<<<<<<<<< * else: * dual_norm_XtA = linalg.norm(XtA, np.inf) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_XtA); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_XtA); __Pyx_GIVEREF(__pyx_v_XtA); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -5116,24 +5460,24 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":369 + /* "sklearn/linear_model/cd_fast.pyx":389 * dual_norm_XtA = np.max(XtA) * else: * dual_norm_XtA = linalg.norm(XtA, np.inf) # <<<<<<<<<<<<<< * * # TODO: use squared L2 norm directly */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__inf); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(__pyx_v_XtA); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_XtA); @@ -5141,7 +5485,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -5151,24 +5495,24 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } __pyx_L43:; - /* "sklearn/linear_model/cd_fast.pyx":372 + /* "sklearn/linear_model/cd_fast.pyx":392 * * # TODO: use squared L2 norm directly * R_norm = linalg.norm(R) # <<<<<<<<<<<<<< * w_norm = linalg.norm(w, 2) * if (dual_norm_XtA > alpha): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_v_R)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_R)); __Pyx_GIVEREF(((PyObject *)__pyx_v_R)); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 392; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -5176,19 +5520,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_v_R_norm = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":373 + /* "sklearn/linear_model/cd_fast.pyx":393 * # TODO: use squared L2 norm directly * R_norm = linalg.norm(R) * w_norm = linalg.norm(w, 2) # <<<<<<<<<<<<<< * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__norm); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__norm); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_w)); @@ -5196,7 +5540,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __Pyx_INCREF(__pyx_int_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_2); __Pyx_GIVEREF(__pyx_int_2); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -5204,124 +5548,124 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_v_w_norm = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":374 + /* "sklearn/linear_model/cd_fast.pyx":394 * R_norm = linalg.norm(R) * w_norm = linalg.norm(w, 2) * if (dual_norm_XtA > alpha): # <<<<<<<<<<<<<< * const = alpha / dual_norm_XtA * A_norm = R_norm * const */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_dual_norm_XtA, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_dual_norm_XtA, __pyx_t_2, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_16 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":375 + /* "sklearn/linear_model/cd_fast.pyx":395 * w_norm = linalg.norm(w, 2) * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA # <<<<<<<<<<<<<< * A_norm = R_norm * const * gap = 0.5 * (R_norm ** 2 + A_norm ** 2) */ - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_dual_norm_XtA); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_dual_norm_XtA); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_const); __pyx_v_const = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":376 + /* "sklearn/linear_model/cd_fast.pyx":396 * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA * A_norm = R_norm * const # <<<<<<<<<<<<<< * gap = 0.5 * (R_norm ** 2 + A_norm ** 2) * else: */ - __pyx_t_2 = PyNumber_Multiply(__pyx_v_R_norm, __pyx_v_const); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_v_R_norm, __pyx_v_const); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_A_norm); __pyx_v_A_norm = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":377 + /* "sklearn/linear_model/cd_fast.pyx":397 * const = alpha / dual_norm_XtA * A_norm = R_norm * const * gap = 0.5 * (R_norm ** 2 + A_norm ** 2) # <<<<<<<<<<<<<< * else: * const = 1.0 */ - __pyx_t_2 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Power(__pyx_v_R_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Power(__pyx_v_R_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Power(__pyx_v_A_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Power(__pyx_v_A_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_gap = __pyx_t_31; goto __pyx_L44; } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":379 + /* "sklearn/linear_model/cd_fast.pyx":399 * gap = 0.5 * (R_norm ** 2 + A_norm ** 2) * else: * const = 1.0 # <<<<<<<<<<<<<< * gap = R_norm ** 2 * */ - __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_const); __pyx_v_const = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":380 + /* "sklearn/linear_model/cd_fast.pyx":400 * else: * const = 1.0 * gap = R_norm ** 2 # <<<<<<<<<<<<<< * * gap += alpha * linalg.norm(w, 1) - const * np.dot(R.T, y) + \ */ - __pyx_t_1 = PyNumber_Power(__pyx_v_R_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Power(__pyx_v_R_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_gap = __pyx_t_31; } __pyx_L44:; - /* "sklearn/linear_model/cd_fast.pyx":382 + /* "sklearn/linear_model/cd_fast.pyx":402 * gap = R_norm ** 2 * * gap += alpha * linalg.norm(w, 1) - const * np.dot(R.T, y) + \ # <<<<<<<<<<<<<< * 0.5 * beta * (1 + const ** 2) * (w_norm ** 2) * */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_w)); @@ -5329,22 +5673,22 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_74 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_74 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_74); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_74); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_t_4, __pyx_t_74); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_74); __pyx_t_74 = 0; - __pyx_t_74 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_74 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_74); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_74, __pyx_n_s__dot); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_74, __pyx_n_s__dot); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_74); __pyx_t_74 = 0; - __pyx_t_74 = PyObject_GetAttr(((PyObject *)__pyx_v_R), __pyx_n_s__T); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_74 = PyObject_GetAttr(((PyObject *)__pyx_v_R), __pyx_n_s__T); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_74); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_74); __Pyx_GIVEREF(__pyx_t_74); @@ -5352,55 +5696,55 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); __pyx_t_74 = 0; - __pyx_t_74 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_74 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_74); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_v_const, __pyx_t_74); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_v_const, __pyx_t_74); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_74); __pyx_t_74 = 0; - __pyx_t_74 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_74 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_74)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_74); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":383 + /* "sklearn/linear_model/cd_fast.pyx":403 * * gap += alpha * linalg.norm(w, 1) - const * np.dot(R.T, y) + \ * 0.5 * beta * (1 + const ** 2) * (w_norm ** 2) # <<<<<<<<<<<<<< * * if gap < tol: */ - __pyx_t_3 = PyFloat_FromDouble((0.5 * __pyx_v_beta)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble((0.5 * __pyx_v_beta)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyNumber_Add(__pyx_int_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_int_1, __pyx_t_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Power(__pyx_v_w_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Power(__pyx_v_w_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_74, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_t_74, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_74); __pyx_t_74 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_31 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_31 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_gap = __pyx_t_31; - /* "sklearn/linear_model/cd_fast.pyx":385 + /* "sklearn/linear_model/cd_fast.pyx":405 * 0.5 * beta * (1 + const ** 2) * (w_norm ** 2) * * if gap < tol: # <<<<<<<<<<<<<< @@ -5410,7 +5754,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina __pyx_t_16 = (__pyx_v_gap < __pyx_v_tol); if (__pyx_t_16) { - /* "sklearn/linear_model/cd_fast.pyx":387 + /* "sklearn/linear_model/cd_fast.pyx":407 * if gap < tol: * # return if we reached desired tolerance * break # <<<<<<<<<<<<<< @@ -5427,7 +5771,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina } __pyx_L14_break:; - /* "sklearn/linear_model/cd_fast.pyx":389 + /* "sklearn/linear_model/cd_fast.pyx":409 * break * * return w, gap, tol # <<<<<<<<<<<<<< @@ -5435,11 +5779,11 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_w)); @@ -5500,7 +5844,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordina return __pyx_r; } -/* "sklearn/linear_model/cd_fast.pyx":395 +/* "sklearn/linear_model/cd_fast.pyx":415 * @cython.wraparound(False) * @cython.cdivision(True) * def enet_coordinate_descent_gram(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< @@ -5597,7 +5941,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_self = __pyx_self; { PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; - values[8] = (PyObject *)__pyx_k_7; + values[8] = (PyObject *)__pyx_k_11; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5623,43 +5967,43 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__Q); if (likely(values[3])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__q); if (likely(values[4])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); if (likely(values[5])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_iter); if (likely(values[6])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tol); if (likely(values[7])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 8: if (kw_args > 0) { @@ -5668,7 +6012,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "enet_coordinate_descent_gram") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "enet_coordinate_descent_gram") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -5686,18 +6030,18 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc } } __pyx_v_w = ((PyArrayObject *)values[0]); - __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_beta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_beta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_Q = ((PyArrayObject *)values[3]); __pyx_v_q = ((PyArrayObject *)values[4]); __pyx_v_y = ((PyArrayObject *)values[5]); - __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_tol = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[6]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_tol = __pyx_PyFloat_AsDouble(values[7]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_positive = ((PyBoolObject *)values[8]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_gram", 0, 8, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.cd_fast.enet_coordinate_descent_gram", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5708,37 +6052,37 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_bstruct_Q.buf = NULL; __pyx_bstruct_q.buf = NULL; __pyx_bstruct_y.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Q), __pyx_ptype_5numpy_ndarray, 1, "Q", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q), __pyx_ptype_5numpy_ndarray, 1, "q", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 398; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_positive), __pyx_ptype_7cpython_4bool_bool, 1, "positive", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_Q), __pyx_ptype_5numpy_ndarray, 1, "Q", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_q), __pyx_ptype_5numpy_ndarray, 1, "q", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_positive), __pyx_ptype_7cpython_4bool_bool, 1, "positive", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_w, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_w, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_w = __pyx_bstruct_w.strides[0]; __pyx_bshape_0_w = __pyx_bstruct_w.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_Q, (PyObject*)__pyx_v_Q, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_Q, (PyObject*)__pyx_v_Q, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_Q = __pyx_bstruct_Q.strides[0]; __pyx_bstride_1_Q = __pyx_bstruct_Q.strides[1]; __pyx_bshape_0_Q = __pyx_bstruct_Q.shape[0]; __pyx_bshape_1_Q = __pyx_bstruct_Q.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_q, (PyObject*)__pyx_v_q, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_q, (PyObject*)__pyx_v_q, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_q = __pyx_bstruct_q.strides[0]; __pyx_bshape_0_q = __pyx_bstruct_q.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_y = __pyx_bstruct_y.strides[0]; __pyx_bshape_0_y = __pyx_bstruct_y.shape[0]; - /* "sklearn/linear_model/cd_fast.pyx":416 + /* "sklearn/linear_model/cd_fast.pyx":436 * * # get the data information into easy vars * cdef unsigned int n_samples = y.shape[0] # <<<<<<<<<<<<<< @@ -5747,7 +6091,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc */ __pyx_v_n_samples = (__pyx_v_y->dimensions[0]); - /* "sklearn/linear_model/cd_fast.pyx":417 + /* "sklearn/linear_model/cd_fast.pyx":437 * # get the data information into easy vars * cdef unsigned int n_samples = y.shape[0] * cdef unsigned int n_features = Q.shape[0] # <<<<<<<<<<<<<< @@ -5756,19 +6100,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc */ __pyx_v_n_features = (__pyx_v_Q->dimensions[0]); - /* "sklearn/linear_model/cd_fast.pyx":420 + /* "sklearn/linear_model/cd_fast.pyx":440 * * # initial value "Q w" which will be kept of up to date in the iterations * cdef np.ndarray[DOUBLE, ndim=1] H = np.dot(Q, w) # <<<<<<<<<<<<<< * * cdef double tmp */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_v_Q)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_Q)); @@ -5776,17 +6120,17 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_w)); __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_H, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_H = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_H.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 440; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_H = __pyx_bstruct_H.strides[0]; __pyx_bshape_0_H = __pyx_bstruct_H.shape[0]; } @@ -5795,7 +6139,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_v_H = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":427 + /* "sklearn/linear_model/cd_fast.pyx":447 * cdef double w_max * cdef double d_w_ii * cdef double gap = tol + 1.0 # <<<<<<<<<<<<<< @@ -5804,7 +6148,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc */ __pyx_v_gap = (__pyx_v_tol + 1.0); - /* "sklearn/linear_model/cd_fast.pyx":428 + /* "sklearn/linear_model/cd_fast.pyx":448 * cdef double d_w_ii * cdef double gap = tol + 1.0 * cdef double d_w_tol = tol # <<<<<<<<<<<<<< @@ -5813,35 +6157,35 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc */ __pyx_v_d_w_tol = __pyx_v_tol; - /* "sklearn/linear_model/cd_fast.pyx":432 + /* "sklearn/linear_model/cd_fast.pyx":452 * cdef unsigned int n_iter * * cdef double y_norm2 = linalg.norm(y) ** 2 # <<<<<<<<<<<<<< * tol = tol * y_norm2 * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__norm); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__norm); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(((PyObject *)__pyx_v_y)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_y_norm2 = __pyx_t_5; - /* "sklearn/linear_model/cd_fast.pyx":433 + /* "sklearn/linear_model/cd_fast.pyx":453 * * cdef double y_norm2 = linalg.norm(y) ** 2 * tol = tol * y_norm2 # <<<<<<<<<<<<<< @@ -5850,7 +6194,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc */ __pyx_v_tol = (__pyx_v_tol * __pyx_v_y_norm2); - /* "sklearn/linear_model/cd_fast.pyx":435 + /* "sklearn/linear_model/cd_fast.pyx":455 * tol = tol * y_norm2 * * if alpha == 0: # <<<<<<<<<<<<<< @@ -5860,19 +6204,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_t_6 = (__pyx_v_alpha == 0.0); if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":436 + /* "sklearn/linear_model/cd_fast.pyx":456 * * if alpha == 0: * warnings.warn("Coordinate descent with alpha=0 may lead to unexpected" # <<<<<<<<<<<<<< * " results and is discouraged.") * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__warn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__warn); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -5880,7 +6224,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc } __pyx_L6:; - /* "sklearn/linear_model/cd_fast.pyx":439 + /* "sklearn/linear_model/cd_fast.pyx":459 * " results and is discouraged.") * * for n_iter in range(max_iter): # <<<<<<<<<<<<<< @@ -5891,7 +6235,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_n_iter = __pyx_t_8; - /* "sklearn/linear_model/cd_fast.pyx":440 + /* "sklearn/linear_model/cd_fast.pyx":460 * * for n_iter in range(max_iter): * w_max = 0.0 # <<<<<<<<<<<<<< @@ -5900,7 +6244,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc */ __pyx_v_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":441 + /* "sklearn/linear_model/cd_fast.pyx":461 * for n_iter in range(max_iter): * w_max = 0.0 * d_w_max = 0.0 # <<<<<<<<<<<<<< @@ -5909,7 +6253,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc */ __pyx_v_d_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":442 + /* "sklearn/linear_model/cd_fast.pyx":462 * w_max = 0.0 * d_w_max = 0.0 * for ii in xrange(n_features): # Loop over coordinates # <<<<<<<<<<<<<< @@ -5920,7 +6264,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_ii = __pyx_t_10; - /* "sklearn/linear_model/cd_fast.pyx":443 + /* "sklearn/linear_model/cd_fast.pyx":463 * d_w_max = 0.0 * for ii in xrange(n_features): # Loop over coordinates * if Q[ii, ii] == 0.0: # <<<<<<<<<<<<<< @@ -5932,7 +6276,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_t_6 = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_Q.buf, __pyx_t_11, __pyx_bstride_0_Q, __pyx_t_12, __pyx_bstride_1_Q)) == 0.0); if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":444 + /* "sklearn/linear_model/cd_fast.pyx":464 * for ii in xrange(n_features): # Loop over coordinates * if Q[ii, ii] == 0.0: * continue # <<<<<<<<<<<<<< @@ -5944,7 +6288,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc } __pyx_L11:; - /* "sklearn/linear_model/cd_fast.pyx":446 + /* "sklearn/linear_model/cd_fast.pyx":466 * continue * * w_ii = w[ii] # Store previous value # <<<<<<<<<<<<<< @@ -5954,7 +6298,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_t_13 = __pyx_v_ii; __pyx_v_w_ii = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_13, __pyx_bstride_0_w)); - /* "sklearn/linear_model/cd_fast.pyx":448 + /* "sklearn/linear_model/cd_fast.pyx":468 * w_ii = w[ii] # Store previous value * * if w_ii != 0.0: # <<<<<<<<<<<<<< @@ -5964,7 +6308,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_t_6 = (__pyx_v_w_ii != 0.0); if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":452 + /* "sklearn/linear_model/cd_fast.pyx":472 * daxpy(n_features, -w_ii, * (Q.data + ii * n_features * sizeof(DOUBLE)), 1, * H.data, 1) # <<<<<<<<<<<<<< @@ -5976,7 +6320,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc } __pyx_L12:; - /* "sklearn/linear_model/cd_fast.pyx":454 + /* "sklearn/linear_model/cd_fast.pyx":474 * H.data, 1) * * tmp = q[ii] - H[ii] # <<<<<<<<<<<<<< @@ -5987,14 +6331,14 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_t_15 = __pyx_v_ii; __pyx_v_tmp = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_q.buf, __pyx_t_14, __pyx_bstride_0_q)) - (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_H.buf, __pyx_t_15, __pyx_bstride_0_H))); - /* "sklearn/linear_model/cd_fast.pyx":456 + /* "sklearn/linear_model/cd_fast.pyx":476 * tmp = q[ii] - H[ii] * * if positive and tmp < 0: # <<<<<<<<<<<<<< * w[ii] = 0.0 * else: */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 476; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_6) { __pyx_t_16 = (__pyx_v_tmp < 0.0); __pyx_t_17 = __pyx_t_16; @@ -6003,7 +6347,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc } if (__pyx_t_17) { - /* "sklearn/linear_model/cd_fast.pyx":457 + /* "sklearn/linear_model/cd_fast.pyx":477 * * if positive and tmp < 0: * w[ii] = 0.0 # <<<<<<<<<<<<<< @@ -6016,7 +6360,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":460 + /* "sklearn/linear_model/cd_fast.pyx":480 * else: * w[ii] = fsign(tmp) * fmax(fabs(tmp) - alpha, 0) \ * / (Q[ii, ii] + beta) # <<<<<<<<<<<<<< @@ -6026,7 +6370,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_t_19 = __pyx_v_ii; __pyx_t_20 = __pyx_v_ii; - /* "sklearn/linear_model/cd_fast.pyx":459 + /* "sklearn/linear_model/cd_fast.pyx":479 * w[ii] = 0.0 * else: * w[ii] = fsign(tmp) * fmax(fabs(tmp) - alpha, 0) \ # <<<<<<<<<<<<<< @@ -6038,7 +6382,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc } __pyx_L13:; - /* "sklearn/linear_model/cd_fast.pyx":462 + /* "sklearn/linear_model/cd_fast.pyx":482 * / (Q[ii, ii] + beta) * * if w[ii] != 0.0: # <<<<<<<<<<<<<< @@ -6049,7 +6393,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_t_17 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_22, __pyx_bstride_0_w)) != 0.0); if (__pyx_t_17) { - /* "sklearn/linear_model/cd_fast.pyx":464 + /* "sklearn/linear_model/cd_fast.pyx":484 * if w[ii] != 0.0: * # H += w[ii] * Q[ii] # Update H = X.T X w * daxpy(n_features, w[ii], # <<<<<<<<<<<<<< @@ -6058,7 +6402,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc */ __pyx_t_23 = __pyx_v_ii; - /* "sklearn/linear_model/cd_fast.pyx":466 + /* "sklearn/linear_model/cd_fast.pyx":486 * daxpy(n_features, w[ii], * (Q.data + ii * n_features * sizeof(DOUBLE)), 1, * H.data, 1) # <<<<<<<<<<<<<< @@ -6070,7 +6414,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc } __pyx_L14:; - /* "sklearn/linear_model/cd_fast.pyx":469 + /* "sklearn/linear_model/cd_fast.pyx":489 * * # update the maximum absolute coefficient update * d_w_ii = fabs(w[ii] - w_ii) # <<<<<<<<<<<<<< @@ -6080,7 +6424,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_t_24 = __pyx_v_ii; __pyx_v_d_w_ii = fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_24, __pyx_bstride_0_w)) - __pyx_v_w_ii)); - /* "sklearn/linear_model/cd_fast.pyx":470 + /* "sklearn/linear_model/cd_fast.pyx":490 * # update the maximum absolute coefficient update * d_w_ii = fabs(w[ii] - w_ii) * if d_w_ii > d_w_max: # <<<<<<<<<<<<<< @@ -6090,7 +6434,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_t_17 = (__pyx_v_d_w_ii > __pyx_v_d_w_max); if (__pyx_t_17) { - /* "sklearn/linear_model/cd_fast.pyx":471 + /* "sklearn/linear_model/cd_fast.pyx":491 * d_w_ii = fabs(w[ii] - w_ii) * if d_w_ii > d_w_max: * d_w_max = d_w_ii # <<<<<<<<<<<<<< @@ -6102,7 +6446,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc } __pyx_L15:; - /* "sklearn/linear_model/cd_fast.pyx":473 + /* "sklearn/linear_model/cd_fast.pyx":493 * d_w_max = d_w_ii * * if fabs(w[ii]) > w_max: # <<<<<<<<<<<<<< @@ -6113,7 +6457,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_t_17 = (fabs((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_25, __pyx_bstride_0_w))) > __pyx_v_w_max); if (__pyx_t_17) { - /* "sklearn/linear_model/cd_fast.pyx":474 + /* "sklearn/linear_model/cd_fast.pyx":494 * * if fabs(w[ii]) > w_max: * w_max = fabs(w[ii]) # <<<<<<<<<<<<<< @@ -6128,7 +6472,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_L9_continue:; } - /* "sklearn/linear_model/cd_fast.pyx":476 + /* "sklearn/linear_model/cd_fast.pyx":496 * w_max = fabs(w[ii]) * * if w_max == 0.0 or d_w_max / w_max < d_w_tol or n_iter == max_iter - 1: # <<<<<<<<<<<<<< @@ -6150,19 +6494,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc } if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":481 + /* "sklearn/linear_model/cd_fast.pyx":501 * # criterion * * q_dot_w = np.dot(w, q) # <<<<<<<<<<<<<< * * XtA = q - H - beta * w */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_w)); @@ -6170,7 +6514,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __Pyx_INCREF(((PyObject *)__pyx_v_q)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_q)); __Pyx_GIVEREF(((PyObject *)__pyx_v_q)); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 481; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -6178,21 +6522,21 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_v_q_dot_w = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":483 + /* "sklearn/linear_model/cd_fast.pyx":503 * q_dot_w = np.dot(w, q) * * XtA = q - H - beta * w # <<<<<<<<<<<<<< * if positive: * dual_norm_XtA = np.max(XtA) */ - __pyx_t_1 = PyNumber_Subtract(((PyObject *)__pyx_v_q), ((PyObject *)__pyx_v_H)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(((PyObject *)__pyx_v_q), ((PyObject *)__pyx_v_H)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_beta); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_beta); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_w)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_w)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __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; @@ -6200,34 +6544,34 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_v_XtA = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":484 + /* "sklearn/linear_model/cd_fast.pyx":504 * * XtA = q - H - beta * w * if positive: # <<<<<<<<<<<<<< * dual_norm_XtA = np.max(XtA) * else: */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":485 + /* "sklearn/linear_model/cd_fast.pyx":505 * XtA = q - H - beta * w * if positive: * dual_norm_XtA = np.max(XtA) # <<<<<<<<<<<<<< * else: * dual_norm_XtA = linalg.norm(XtA, np.inf) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_XtA); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_XtA); __Pyx_GIVEREF(__pyx_v_XtA); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -6238,24 +6582,24 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":487 + /* "sklearn/linear_model/cd_fast.pyx":507 * dual_norm_XtA = np.max(XtA) * else: * dual_norm_XtA = linalg.norm(XtA, np.inf) # <<<<<<<<<<<<<< * * R_norm2 = y_norm2 + np.sum(w * H) - 2.0 * q_dot_w */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(__pyx_v_XtA); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_XtA); @@ -6263,7 +6607,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -6273,41 +6617,41 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc } __pyx_L18:; - /* "sklearn/linear_model/cd_fast.pyx":489 + /* "sklearn/linear_model/cd_fast.pyx":509 * dual_norm_XtA = linalg.norm(XtA, np.inf) * * R_norm2 = y_norm2 + np.sum(w * H) - 2.0 * q_dot_w # <<<<<<<<<<<<<< * w_norm = linalg.norm(w, 2) * if (dual_norm_XtA > alpha): */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_y_norm2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_y_norm2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_w), ((PyObject *)__pyx_v_H)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(((PyObject *)__pyx_v_w), ((PyObject *)__pyx_v_H)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = PyTuple_New(1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyTuple_New(1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_28)); PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; - __pyx_t_28 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyNumber_Add(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_q_dot_w); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_v_q_dot_w); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_t_28, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_t_28, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -6315,19 +6659,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_v_R_norm2 = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":490 + /* "sklearn/linear_model/cd_fast.pyx":510 * * R_norm2 = y_norm2 + np.sum(w * H) - 2.0 * q_dot_w * w_norm = linalg.norm(w, 2) # <<<<<<<<<<<<<< * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_w)); @@ -6335,7 +6679,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __Pyx_INCREF(__pyx_int_2); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_2); __Pyx_GIVEREF(__pyx_int_2); - __pyx_t_28 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; @@ -6343,134 +6687,134 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_v_w_norm = __pyx_t_28; __pyx_t_28 = 0; - /* "sklearn/linear_model/cd_fast.pyx":491 + /* "sklearn/linear_model/cd_fast.pyx":511 * R_norm2 = y_norm2 + np.sum(w * H) - 2.0 * q_dot_w * w_norm = linalg.norm(w, 2) * if (dual_norm_XtA > alpha): # <<<<<<<<<<<<<< * const = alpha / dual_norm_XtA * A_norm2 = R_norm2 * (const ** 2) */ - __pyx_t_28 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_dual_norm_XtA, __pyx_t_28, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_dual_norm_XtA, __pyx_t_28, Py_GT); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":492 + /* "sklearn/linear_model/cd_fast.pyx":512 * w_norm = linalg.norm(w, 2) * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA # <<<<<<<<<<<<<< * A_norm2 = R_norm2 * (const ** 2) * gap = 0.5 * (R_norm2 + A_norm2) */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_dual_norm_XtA); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_v_dual_norm_XtA); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(__pyx_v_const); __pyx_v_const = __pyx_t_28; __pyx_t_28 = 0; - /* "sklearn/linear_model/cd_fast.pyx":493 + /* "sklearn/linear_model/cd_fast.pyx":513 * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA * A_norm2 = R_norm2 * (const ** 2) # <<<<<<<<<<<<<< * gap = 0.5 * (R_norm2 + A_norm2) * else: */ - __pyx_t_28 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyNumber_Multiply(__pyx_v_R_norm2, __pyx_t_28); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_v_R_norm2, __pyx_t_28); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; __Pyx_XDECREF(__pyx_v_A_norm2); __pyx_v_A_norm2 = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/linear_model/cd_fast.pyx":494 + /* "sklearn/linear_model/cd_fast.pyx":514 * const = alpha / dual_norm_XtA * A_norm2 = R_norm2 * (const ** 2) * gap = 0.5 * (R_norm2 + A_norm2) # <<<<<<<<<<<<<< * else: * const = 1.0 */ - __pyx_t_1 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = PyNumber_Add(__pyx_v_R_norm2, __pyx_v_A_norm2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyNumber_Add(__pyx_v_R_norm2, __pyx_v_A_norm2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_t_28); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_t_28); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_gap = __pyx_t_5; goto __pyx_L19; } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":496 + /* "sklearn/linear_model/cd_fast.pyx":516 * gap = 0.5 * (R_norm2 + A_norm2) * else: * const = 1.0 # <<<<<<<<<<<<<< * gap = R_norm2 * */ - __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_const); __pyx_v_const = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":497 + /* "sklearn/linear_model/cd_fast.pyx":517 * else: * const = 1.0 * gap = R_norm2 # <<<<<<<<<<<<<< * * gap += alpha * linalg.norm(w, 1) \ */ - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_R_norm2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_v_R_norm2); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_gap = __pyx_t_5; } __pyx_L19:; - /* "sklearn/linear_model/cd_fast.pyx":499 + /* "sklearn/linear_model/cd_fast.pyx":519 * gap = R_norm2 * * gap += alpha * linalg.norm(w, 1) \ # <<<<<<<<<<<<<< * - const * y_norm2 \ * + const * q_dot_w + \ */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - /* "sklearn/linear_model/cd_fast.pyx":500 + /* "sklearn/linear_model/cd_fast.pyx":520 * * gap += alpha * linalg.norm(w, 1) \ * - const * y_norm2 \ # <<<<<<<<<<<<<< * + const * q_dot_w + \ * 0.5 * beta * (1 + const ** 2) * (w_norm ** 2) */ - __pyx_t_28 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - /* "sklearn/linear_model/cd_fast.pyx":499 + /* "sklearn/linear_model/cd_fast.pyx":519 * gap = R_norm2 * * gap += alpha * linalg.norm(w, 1) \ # <<<<<<<<<<<<<< * - const * y_norm2 \ * + const * q_dot_w + \ */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_w)); @@ -6478,75 +6822,75 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_29 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_28, __pyx_t_29); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_t_28, __pyx_t_29); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - /* "sklearn/linear_model/cd_fast.pyx":501 + /* "sklearn/linear_model/cd_fast.pyx":521 * gap += alpha * linalg.norm(w, 1) \ * - const * y_norm2 \ * + const * q_dot_w + \ # <<<<<<<<<<<<<< * 0.5 * beta * (1 + const ** 2) * (w_norm ** 2) * */ - __pyx_t_29 = PyFloat_FromDouble(__pyx_v_y_norm2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyFloat_FromDouble(__pyx_v_y_norm2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); - __pyx_t_28 = PyNumber_Multiply(__pyx_v_const, __pyx_t_29); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyNumber_Multiply(__pyx_v_const, __pyx_t_29); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - __pyx_t_29 = PyNumber_Subtract(__pyx_t_1, __pyx_t_28); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyNumber_Subtract(__pyx_t_1, __pyx_t_28); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_28 = PyNumber_Multiply(__pyx_v_const, __pyx_v_q_dot_w); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyNumber_Multiply(__pyx_v_const, __pyx_v_q_dot_w); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyNumber_Add(__pyx_t_29, __pyx_t_28); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_t_29, __pyx_t_28); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "sklearn/linear_model/cd_fast.pyx":502 + /* "sklearn/linear_model/cd_fast.pyx":522 * - const * y_norm2 \ * + const * q_dot_w + \ * 0.5 * beta * (1 + const ** 2) * (w_norm ** 2) # <<<<<<<<<<<<<< * * if gap < tol: */ - __pyx_t_28 = PyFloat_FromDouble((0.5 * __pyx_v_beta)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyFloat_FromDouble((0.5 * __pyx_v_beta)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_29 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); - __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_t_29); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_t_29); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - __pyx_t_29 = PyNumber_Multiply(__pyx_t_28, __pyx_t_3); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyNumber_Multiply(__pyx_t_28, __pyx_t_3); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Power(__pyx_v_w_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Power(__pyx_v_w_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_28 = PyNumber_Multiply(__pyx_t_29, __pyx_t_3); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyNumber_Multiply(__pyx_t_29, __pyx_t_3); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_28); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_28); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_28 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_28); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_PyFloat_AsDouble(__pyx_t_28); if (unlikely((__pyx_t_5 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; __pyx_v_gap = __pyx_t_5; - /* "sklearn/linear_model/cd_fast.pyx":504 + /* "sklearn/linear_model/cd_fast.pyx":524 * 0.5 * beta * (1 + const ** 2) * (w_norm ** 2) * * if gap < tol: # <<<<<<<<<<<<<< @@ -6556,7 +6900,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc __pyx_t_6 = (__pyx_v_gap < __pyx_v_tol); if (__pyx_t_6) { - /* "sklearn/linear_model/cd_fast.pyx":506 + /* "sklearn/linear_model/cd_fast.pyx":526 * if gap < tol: * # return if we reached desired tolerance * break # <<<<<<<<<<<<<< @@ -6573,7 +6917,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc } __pyx_L8_break:; - /* "sklearn/linear_model/cd_fast.pyx":508 + /* "sklearn/linear_model/cd_fast.pyx":528 * break * * return w, gap, tol # <<<<<<<<<<<<<< @@ -6581,11 +6925,11 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc * # ------------------ old code, to be removed later ------------------------- */ __Pyx_XDECREF(__pyx_r); - __pyx_t_28 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_w)); @@ -6639,7 +6983,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_4enet_coordinate_desc return __pyx_r; } -/* "sklearn/linear_model/cd_fast.pyx":516 +/* "sklearn/linear_model/cd_fast.pyx":536 * @cython.wraparound(False) * @cython.cdivision(True) * def enet_coordinate_descent_old(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< @@ -6734,7 +7078,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_self = __pyx_self; { PyObject* values[8] = {0,0,0,0,0,0,0,0}; - values[7] = (PyObject *)__pyx_k_9; + values[7] = (PyObject *)__pyx_k_13; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -6759,37 +7103,37 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_old", 0, 7, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_old", 0, 7, 8, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_old", 0, 7, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_old", 0, 7, 8, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X); if (likely(values[3])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_old", 0, 7, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_old", 0, 7, 8, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); if (likely(values[4])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_old", 0, 7, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_old", 0, 7, 8, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__max_iter); if (likely(values[5])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_old", 0, 7, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_old", 0, 7, 8, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 6: values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__tol); if (likely(values[6])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_old", 0, 7, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_old", 0, 7, 8, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 7: if (kw_args > 0) { @@ -6798,7 +7142,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "enet_coordinate_descent_old") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "enet_coordinate_descent_old") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -6815,17 +7159,17 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } } __pyx_v_w = ((PyArrayObject *)values[0]); - __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_beta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_alpha = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_alpha == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_beta = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_beta == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_X = ((PyArrayObject *)values[3]); __pyx_v_y = ((PyArrayObject *)values[4]); - __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_tol = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_max_iter = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_max_iter == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_tol = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_tol == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_positive = ((PyBoolObject *)values[7]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_old", 0, 7, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("enet_coordinate_descent_old", 0, 7, 8, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.linear_model.cd_fast.enet_coordinate_descent_old", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6836,30 +7180,30 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_bstruct_w.buf = NULL; __pyx_bstruct_X.buf = NULL; __pyx_bstruct_y.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_positive), __pyx_ptype_7cpython_4bool_bool, 1, "positive", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_w), __pyx_ptype_5numpy_ndarray, 1, "w", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_positive), __pyx_ptype_7cpython_4bool_bool, 1, "positive", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_w, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_w, (PyObject*)__pyx_v_w, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_w = __pyx_bstruct_w.strides[0]; __pyx_bshape_0_w = __pyx_bstruct_w.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_X, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_X = __pyx_bstruct_X.strides[0]; __pyx_bstride_1_X = __pyx_bstruct_X.strides[1]; __pyx_bshape_0_X = __pyx_bstruct_X.shape[0]; __pyx_bshape_1_X = __pyx_bstruct_X.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_y, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_y = __pyx_bstruct_y.strides[0]; __pyx_bshape_0_y = __pyx_bstruct_y.shape[0]; - /* "sklearn/linear_model/cd_fast.pyx":533 + /* "sklearn/linear_model/cd_fast.pyx":553 * * # get the data information into easy vars * cdef unsigned int n_samples = X.shape[0] # <<<<<<<<<<<<<< @@ -6868,7 +7212,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc */ __pyx_v_n_samples = (__pyx_v_X->dimensions[0]); - /* "sklearn/linear_model/cd_fast.pyx":534 + /* "sklearn/linear_model/cd_fast.pyx":554 * # get the data information into easy vars * cdef unsigned int n_samples = X.shape[0] * cdef unsigned int n_features = X.shape[1] # <<<<<<<<<<<<<< @@ -6877,32 +7221,32 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc */ __pyx_v_n_features = (__pyx_v_X->dimensions[1]); - /* "sklearn/linear_model/cd_fast.pyx":537 + /* "sklearn/linear_model/cd_fast.pyx":557 * * # compute norms of the columns of X * cdef np.ndarray[DOUBLE, ndim=1] norm_cols_X = (X**2).sum(axis=0) # <<<<<<<<<<<<<< * * # initial value of the residuals */ - __pyx_t_1 = PyNumber_Power(((PyObject *)__pyx_v_X), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Power(((PyObject *)__pyx_v_X), __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_norm_cols_X, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_norm_cols_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_norm_cols_X.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 557; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_norm_cols_X = __pyx_bstruct_norm_cols_X.strides[0]; __pyx_bshape_0_norm_cols_X = __pyx_bstruct_norm_cols_X.shape[0]; } @@ -6911,7 +7255,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_v_norm_cols_X = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":547 + /* "sklearn/linear_model/cd_fast.pyx":567 * cdef double w_max * cdef double d_w_ii * cdef double gap = tol + 1.0 # <<<<<<<<<<<<<< @@ -6920,7 +7264,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc */ __pyx_v_gap = (__pyx_v_tol + 1.0); - /* "sklearn/linear_model/cd_fast.pyx":548 + /* "sklearn/linear_model/cd_fast.pyx":568 * cdef double d_w_ii * cdef double gap = tol + 1.0 * cdef double d_w_tol = tol # <<<<<<<<<<<<<< @@ -6929,7 +7273,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc */ __pyx_v_d_w_tol = __pyx_v_tol; - /* "sklearn/linear_model/cd_fast.pyx":552 + /* "sklearn/linear_model/cd_fast.pyx":572 * cdef unsigned int n_iter * * if alpha == 0: # <<<<<<<<<<<<<< @@ -6939,19 +7283,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_t_5 = (__pyx_v_alpha == 0.0); if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":553 + /* "sklearn/linear_model/cd_fast.pyx":573 * * if alpha == 0: * warnings.warn("Coordinate descent with alpha=0 may lead to unexpected" # <<<<<<<<<<<<<< * " results and is discouraged.") * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__warn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__warn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -6959,19 +7303,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } __pyx_L6:; - /* "sklearn/linear_model/cd_fast.pyx":556 + /* "sklearn/linear_model/cd_fast.pyx":576 * " results and is discouraged.") * * R = y - np.dot(X, w) # <<<<<<<<<<<<<< * * tol = tol * linalg.norm(y) ** 2 */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_X)); @@ -6979,14 +7323,14 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_w)); __Pyx_GIVEREF(((PyObject *)__pyx_v_w)); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_y), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(((PyObject *)__pyx_v_y), __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_3); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -7003,47 +7347,47 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } __pyx_bstride_0_R = __pyx_bstruct_R.strides[0]; __pyx_bshape_0_R = __pyx_bstruct_R.shape[0]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = 0; __pyx_v_R = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":558 + /* "sklearn/linear_model/cd_fast.pyx":578 * R = y - np.dot(X, w) * * tol = tol * linalg.norm(y) ** 2 # <<<<<<<<<<<<<< * * for n_iter in range(max_iter): */ - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__norm); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__norm); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(((PyObject *)__pyx_v_y)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); - __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Power(__pyx_t_11, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Power(__pyx_t_11, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_11); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_11); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __pyx_v_tol = __pyx_t_12; - /* "sklearn/linear_model/cd_fast.pyx":560 + /* "sklearn/linear_model/cd_fast.pyx":580 * tol = tol * linalg.norm(y) ** 2 * * for n_iter in range(max_iter): # <<<<<<<<<<<<<< @@ -7054,7 +7398,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_7; __pyx_t_13+=1) { __pyx_v_n_iter = __pyx_t_13; - /* "sklearn/linear_model/cd_fast.pyx":561 + /* "sklearn/linear_model/cd_fast.pyx":581 * * for n_iter in range(max_iter): * w_max = 0.0 # <<<<<<<<<<<<<< @@ -7063,7 +7407,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc */ __pyx_v_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":562 + /* "sklearn/linear_model/cd_fast.pyx":582 * for n_iter in range(max_iter): * w_max = 0.0 * d_w_max = 0.0 # <<<<<<<<<<<<<< @@ -7072,7 +7416,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc */ __pyx_v_d_w_max = 0.0; - /* "sklearn/linear_model/cd_fast.pyx":563 + /* "sklearn/linear_model/cd_fast.pyx":583 * w_max = 0.0 * d_w_max = 0.0 * for ii in xrange(n_features): # Loop over coordinates # <<<<<<<<<<<<<< @@ -7083,7 +7427,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_ii = __pyx_t_15; - /* "sklearn/linear_model/cd_fast.pyx":564 + /* "sklearn/linear_model/cd_fast.pyx":584 * d_w_max = 0.0 * for ii in xrange(n_features): # Loop over coordinates * if norm_cols_X[ii] == 0.0: # <<<<<<<<<<<<<< @@ -7094,7 +7438,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_t_5 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_norm_cols_X.buf, __pyx_t_16, __pyx_bstride_0_norm_cols_X)) == 0.0); if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":565 + /* "sklearn/linear_model/cd_fast.pyx":585 * for ii in xrange(n_features): # Loop over coordinates * if norm_cols_X[ii] == 0.0: * continue # <<<<<<<<<<<<<< @@ -7106,7 +7450,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } __pyx_L11:; - /* "sklearn/linear_model/cd_fast.pyx":567 + /* "sklearn/linear_model/cd_fast.pyx":587 * continue * * w_ii = w[ii] # Store previous value # <<<<<<<<<<<<<< @@ -7116,7 +7460,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_t_17 = __pyx_v_ii; __pyx_v_w_ii = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_17, __pyx_bstride_0_w)); - /* "sklearn/linear_model/cd_fast.pyx":569 + /* "sklearn/linear_model/cd_fast.pyx":589 * w_ii = w[ii] # Store previous value * * if w_ii != 0.0: # <<<<<<<<<<<<<< @@ -7126,7 +7470,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_t_5 = (__pyx_v_w_ii != 0.0); if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":573 + /* "sklearn/linear_model/cd_fast.pyx":593 * daxpy(n_samples, w_ii, * (X.data + ii * n_samples * sizeof(DOUBLE)), 1, * R.data, 1) # <<<<<<<<<<<<<< @@ -7138,7 +7482,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } __pyx_L12:; - /* "sklearn/linear_model/cd_fast.pyx":578 + /* "sklearn/linear_model/cd_fast.pyx":598 * tmp = ddot(n_samples, * (X.data + ii * n_samples * sizeof(DOUBLE)), 1, * R.data, 1) # <<<<<<<<<<<<<< @@ -7147,14 +7491,14 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc */ __pyx_v_tmp = cblas_ddot(__pyx_v_n_samples, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)(__pyx_v_X->data + ((__pyx_v_ii * __pyx_v_n_samples) * (sizeof(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE))))), 1, ((__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *)__pyx_v_R->data), 1); - /* "sklearn/linear_model/cd_fast.pyx":580 + /* "sklearn/linear_model/cd_fast.pyx":600 * R.data, 1) * * if positive and tmp < 0: # <<<<<<<<<<<<<< * w[ii] = 0.0 * else: */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 600; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_5) { __pyx_t_18 = (__pyx_v_tmp < 0.0); __pyx_t_19 = __pyx_t_18; @@ -7163,7 +7507,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } if (__pyx_t_19) { - /* "sklearn/linear_model/cd_fast.pyx":581 + /* "sklearn/linear_model/cd_fast.pyx":601 * * if positive and tmp < 0: * w[ii] = 0.0 # <<<<<<<<<<<<<< @@ -7176,7 +7520,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":584 + /* "sklearn/linear_model/cd_fast.pyx":604 * else: * w[ii] = fsign(tmp) * fmax(fabs(tmp) - alpha, 0) \ * / (norm_cols_X[ii] + beta) # <<<<<<<<<<<<<< @@ -7185,7 +7529,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc */ __pyx_t_21 = __pyx_v_ii; - /* "sklearn/linear_model/cd_fast.pyx":583 + /* "sklearn/linear_model/cd_fast.pyx":603 * w[ii] = 0.0 * else: * w[ii] = fsign(tmp) * fmax(fabs(tmp) - alpha, 0) \ # <<<<<<<<<<<<<< @@ -7197,7 +7541,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } __pyx_L13:; - /* "sklearn/linear_model/cd_fast.pyx":586 + /* "sklearn/linear_model/cd_fast.pyx":606 * / (norm_cols_X[ii] + beta) * * if w[ii] != 0.0: # <<<<<<<<<<<<<< @@ -7208,7 +7552,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_t_19 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_23, __pyx_bstride_0_w)) != 0.0); if (__pyx_t_19) { - /* "sklearn/linear_model/cd_fast.pyx":588 + /* "sklearn/linear_model/cd_fast.pyx":608 * if w[ii] != 0.0: * # R -= w[ii] * X[:,ii] # Update residual * daxpy(n_samples, -w[ii], # <<<<<<<<<<<<<< @@ -7217,7 +7561,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc */ __pyx_t_24 = __pyx_v_ii; - /* "sklearn/linear_model/cd_fast.pyx":590 + /* "sklearn/linear_model/cd_fast.pyx":610 * daxpy(n_samples, -w[ii], * (X.data + ii * n_samples * sizeof(DOUBLE)), 1, * R.data, 1) # <<<<<<<<<<<<<< @@ -7229,7 +7573,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } __pyx_L14:; - /* "sklearn/linear_model/cd_fast.pyx":593 + /* "sklearn/linear_model/cd_fast.pyx":613 * * # update the maximum absolute coefficient update * d_w_ii = fabs(w[ii] - w_ii) # <<<<<<<<<<<<<< @@ -7239,7 +7583,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_t_25 = __pyx_v_ii; __pyx_v_d_w_ii = fabs(((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_25, __pyx_bstride_0_w)) - __pyx_v_w_ii)); - /* "sklearn/linear_model/cd_fast.pyx":594 + /* "sklearn/linear_model/cd_fast.pyx":614 * # update the maximum absolute coefficient update * d_w_ii = fabs(w[ii] - w_ii) * if d_w_ii > d_w_max: # <<<<<<<<<<<<<< @@ -7249,7 +7593,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_t_19 = (__pyx_v_d_w_ii > __pyx_v_d_w_max); if (__pyx_t_19) { - /* "sklearn/linear_model/cd_fast.pyx":595 + /* "sklearn/linear_model/cd_fast.pyx":615 * d_w_ii = fabs(w[ii] - w_ii) * if d_w_ii > d_w_max: * d_w_max = d_w_ii # <<<<<<<<<<<<<< @@ -7261,7 +7605,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } __pyx_L15:; - /* "sklearn/linear_model/cd_fast.pyx":597 + /* "sklearn/linear_model/cd_fast.pyx":617 * d_w_max = d_w_ii * * if fabs(w[ii]) > w_max: # <<<<<<<<<<<<<< @@ -7272,7 +7616,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_t_19 = (fabs((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_12linear_model_7cd_fast_DOUBLE *, __pyx_bstruct_w.buf, __pyx_t_26, __pyx_bstride_0_w))) > __pyx_v_w_max); if (__pyx_t_19) { - /* "sklearn/linear_model/cd_fast.pyx":598 + /* "sklearn/linear_model/cd_fast.pyx":618 * * if fabs(w[ii]) > w_max: * w_max = fabs(w[ii]) # <<<<<<<<<<<<<< @@ -7287,7 +7631,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_L9_continue:; } - /* "sklearn/linear_model/cd_fast.pyx":600 + /* "sklearn/linear_model/cd_fast.pyx":620 * w_max = fabs(w[ii]) * * if w_max == 0.0 or d_w_max / w_max < d_w_tol or n_iter == max_iter - 1: # <<<<<<<<<<<<<< @@ -7309,21 +7653,21 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":605 + /* "sklearn/linear_model/cd_fast.pyx":625 * # criterion * * XtA = np.dot(X.T, R) - beta * w # <<<<<<<<<<<<<< * if positive: * dual_norm_XtA = np.max(XtA) */ - __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__T); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetAttr(((PyObject *)__pyx_v_X), __pyx_n_s__T); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11); __Pyx_GIVEREF(__pyx_t_11); @@ -7331,16 +7675,16 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_R)); __Pyx_GIVEREF(((PyObject *)__pyx_v_R)); __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_beta); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_beta); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_w)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, ((PyObject *)__pyx_v_w)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_11, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 605; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_11, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -7348,34 +7692,34 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_v_XtA = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":606 + /* "sklearn/linear_model/cd_fast.pyx":626 * * XtA = np.dot(X.T, R) - beta * w * if positive: # <<<<<<<<<<<<<< * dual_norm_XtA = np.max(XtA) * else: */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 606; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(((PyObject *)__pyx_v_positive)); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 626; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":607 + /* "sklearn/linear_model/cd_fast.pyx":627 * XtA = np.dot(X.T, R) - beta * w * if positive: * dual_norm_XtA = np.max(XtA) # <<<<<<<<<<<<<< * else: * dual_norm_XtA = linalg.norm(XtA, np.inf) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__max); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_XtA); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_XtA); __Pyx_GIVEREF(__pyx_v_XtA); - __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 607; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 627; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -7386,24 +7730,24 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":609 + /* "sklearn/linear_model/cd_fast.pyx":629 * dual_norm_XtA = np.max(XtA) * else: * dual_norm_XtA = linalg.norm(XtA, np.inf) # <<<<<<<<<<<<<< * * # TODO: use squared L2 norm directly */ - __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_11)); __Pyx_INCREF(__pyx_v_XtA); PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_v_XtA); @@ -7411,7 +7755,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 609; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; @@ -7421,24 +7765,24 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } __pyx_L18:; - /* "sklearn/linear_model/cd_fast.pyx":612 + /* "sklearn/linear_model/cd_fast.pyx":632 * * # TODO: use squared L2 norm directly * R_norm = linalg.norm(R) # <<<<<<<<<<<<<< * w_norm = linalg.norm(w, 2) * if (dual_norm_XtA > alpha): */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_11 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__norm); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__norm); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(((PyObject *)__pyx_v_R)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_R)); __Pyx_GIVEREF(((PyObject *)__pyx_v_R)); - __pyx_t_3 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 612; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 632; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -7446,19 +7790,19 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_v_R_norm = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":613 + /* "sklearn/linear_model/cd_fast.pyx":633 * # TODO: use squared L2 norm directly * R_norm = linalg.norm(R) * w_norm = linalg.norm(w, 2) # <<<<<<<<<<<<<< * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__norm); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__norm); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_w)); @@ -7466,7 +7810,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __Pyx_INCREF(__pyx_int_2); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_2); __Pyx_GIVEREF(__pyx_int_2); - __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -7474,124 +7818,124 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_v_w_norm = __pyx_t_11; __pyx_t_11 = 0; - /* "sklearn/linear_model/cd_fast.pyx":614 + /* "sklearn/linear_model/cd_fast.pyx":634 * R_norm = linalg.norm(R) * w_norm = linalg.norm(w, 2) * if (dual_norm_XtA > alpha): # <<<<<<<<<<<<<< * const = alpha / dual_norm_XtA * A_norm = R_norm * const */ - __pyx_t_11 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_dual_norm_XtA, __pyx_t_11, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_dual_norm_XtA, __pyx_t_11, Py_GT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 614; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 634; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":615 + /* "sklearn/linear_model/cd_fast.pyx":635 * w_norm = linalg.norm(w, 2) * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA # <<<<<<<<<<<<<< * A_norm = R_norm * const * gap = 0.5 * (R_norm ** 2 + A_norm ** 2) */ - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_dual_norm_XtA); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_v_dual_norm_XtA); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 635; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XDECREF(__pyx_v_const); __pyx_v_const = __pyx_t_11; __pyx_t_11 = 0; - /* "sklearn/linear_model/cd_fast.pyx":616 + /* "sklearn/linear_model/cd_fast.pyx":636 * if (dual_norm_XtA > alpha): * const = alpha / dual_norm_XtA * A_norm = R_norm * const # <<<<<<<<<<<<<< * gap = 0.5 * (R_norm ** 2 + A_norm ** 2) * else: */ - __pyx_t_11 = PyNumber_Multiply(__pyx_v_R_norm, __pyx_v_const); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 616; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyNumber_Multiply(__pyx_v_R_norm, __pyx_v_const); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 636; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_XDECREF(__pyx_v_A_norm); __pyx_v_A_norm = __pyx_t_11; __pyx_t_11 = 0; - /* "sklearn/linear_model/cd_fast.pyx":617 + /* "sklearn/linear_model/cd_fast.pyx":637 * const = alpha / dual_norm_XtA * A_norm = R_norm * const * gap = 0.5 * (R_norm ** 2 + A_norm ** 2) # <<<<<<<<<<<<<< * else: * const = 1.0 */ - __pyx_t_11 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_3 = PyNumber_Power(__pyx_v_R_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Power(__pyx_v_R_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Power(__pyx_v_A_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Power(__pyx_v_A_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_t_11, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_t_11, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 617; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_gap = __pyx_t_12; goto __pyx_L19; } /*else*/ { - /* "sklearn/linear_model/cd_fast.pyx":619 + /* "sklearn/linear_model/cd_fast.pyx":639 * gap = 0.5 * (R_norm ** 2 + A_norm ** 2) * else: * const = 1.0 # <<<<<<<<<<<<<< * gap = R_norm ** 2 * */ - __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 619; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_const); __pyx_v_const = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":620 + /* "sklearn/linear_model/cd_fast.pyx":640 * else: * const = 1.0 * gap = R_norm ** 2 # <<<<<<<<<<<<<< * * gap += alpha * linalg.norm(w, 1) - const * np.dot(R.T, y) + \ */ - __pyx_t_2 = PyNumber_Power(__pyx_v_R_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Power(__pyx_v_R_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 640; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_gap = __pyx_t_12; } __pyx_L19:; - /* "sklearn/linear_model/cd_fast.pyx":622 + /* "sklearn/linear_model/cd_fast.pyx":642 * gap = R_norm ** 2 * * gap += alpha * linalg.norm(w, 1) - const * np.dot(R.T, y) + \ # <<<<<<<<<<<<<< * 0.5 * beta * (1 + const ** 2) * (w_norm ** 2) * */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_GetName(__pyx_m, __pyx_n_s__linalg); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_11, __pyx_n_s__norm); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_11)); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_v_w)); @@ -7599,22 +7943,22 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_29 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - __pyx_t_11 = PyNumber_Multiply(__pyx_t_1, __pyx_t_29); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyNumber_Multiply(__pyx_t_1, __pyx_t_29); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - __pyx_t_29 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_29, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_29, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - __pyx_t_29 = PyObject_GetAttr(((PyObject *)__pyx_v_R), __pyx_n_s__T); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyObject_GetAttr(((PyObject *)__pyx_v_R), __pyx_n_s__T); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_29); __Pyx_GIVEREF(__pyx_t_29); @@ -7622,55 +7966,55 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); __pyx_t_29 = 0; - __pyx_t_29 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_v_const, __pyx_t_29); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_v_const, __pyx_t_29); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - __pyx_t_29 = PyNumber_Subtract(__pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = PyNumber_Subtract(__pyx_t_11, __pyx_t_3); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_29); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/linear_model/cd_fast.pyx":623 + /* "sklearn/linear_model/cd_fast.pyx":643 * * gap += alpha * linalg.norm(w, 1) - const * np.dot(R.T, y) + \ * 0.5 * beta * (1 + const ** 2) * (w_norm ** 2) # <<<<<<<<<<<<<< * * if gap < tol: */ - __pyx_t_3 = PyFloat_FromDouble((0.5 * __pyx_v_beta)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble((0.5 * __pyx_v_beta)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyNumber_Power(__pyx_v_const, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_t_11); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Power(__pyx_v_w_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Power(__pyx_v_w_norm, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Multiply(__pyx_t_11, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 623; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(__pyx_t_11, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_t_29, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_t_29, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_12 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 642; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_gap = __pyx_t_12; - /* "sklearn/linear_model/cd_fast.pyx":625 + /* "sklearn/linear_model/cd_fast.pyx":645 * 0.5 * beta * (1 + const ** 2) * (w_norm ** 2) * * if gap < tol: # <<<<<<<<<<<<<< @@ -7680,7 +8024,7 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc __pyx_t_5 = (__pyx_v_gap < __pyx_v_tol); if (__pyx_t_5) { - /* "sklearn/linear_model/cd_fast.pyx":627 + /* "sklearn/linear_model/cd_fast.pyx":647 * if gap < tol: * # return if we reached desired tolerance * break # <<<<<<<<<<<<<< @@ -7697,17 +8041,17 @@ static PyObject *__pyx_pf_7sklearn_12linear_model_7cd_fast_5enet_coordinate_desc } __pyx_L8_break:; - /* "sklearn/linear_model/cd_fast.pyx":629 + /* "sklearn/linear_model/cd_fast.pyx":649 * break * * return w, gap, tol # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_gap); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_tol); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 629; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_INCREF(((PyObject *)__pyx_v_w)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_w)); @@ -7907,7 +8251,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -7947,7 +8291,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * * info.buf = PyArray_DATA(self) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -8217,7 +8561,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -8457,7 +8801,7 @@ static CYTHON_UNUSED int __pyx_pf_5numpy_7ndarray___getbuffer__(PyObject *__pyx_ */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_17), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_21), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8989,7 +9333,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * * if ((child.byteorder == '>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -9040,7 +9384,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_20), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -9145,7 +9489,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_22), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -9491,7 +9835,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 * else: */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_17), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_21), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); @@ -9716,20 +10060,21 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, - {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, {&__pyx_kp_u_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 1, 0, 0}, - {&__pyx_kp_u_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 1, 0, 0}, + {&__pyx_kp_u_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 1, 0, 0}, {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, {&__pyx_kp_u_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 1, 0, 0}, - {&__pyx_n_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 1}, - {&__pyx_n_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 1}, - {&__pyx_n_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 1}, - {&__pyx_n_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 1}, + {&__pyx_kp_u_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 1, 0, 0}, + {&__pyx_kp_u_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 1, 0, 0}, {&__pyx_n_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 1}, {&__pyx_n_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 1}, {&__pyx_n_s_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 1, 1}, + {&__pyx_n_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 1}, + {&__pyx_n_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 1}, + {&__pyx_n_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 1}, + {&__pyx_n_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 1}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, {&__pyx_n_s__Q, __pyx_k__Q, sizeof(__pyx_k__Q), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__T, __pyx_k__T, sizeof(__pyx_k__T), 0, 0, 1, 1}, @@ -9753,6 +10098,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__linalg, __pyx_k__linalg, sizeof(__pyx_k__linalg), 0, 0, 1, 1}, {&__pyx_n_s__max, __pyx_k__max, sizeof(__pyx_k__max), 0, 0, 1, 1}, {&__pyx_n_s__max_iter, __pyx_k__max_iter, sizeof(__pyx_k__max_iter), 0, 0, 1, 1}, + {&__pyx_n_s__memory_limit, __pyx_k__memory_limit, sizeof(__pyx_k__memory_limit), 0, 0, 1, 1}, {&__pyx_n_s__n_features, __pyx_k__n_features, sizeof(__pyx_k__n_features), 0, 0, 1, 1}, {&__pyx_n_s__n_iter, __pyx_k__n_iter, sizeof(__pyx_k__n_iter), 0, 0, 1, 1}, {&__pyx_n_s__n_samples, __pyx_k__n_samples, sizeof(__pyx_k__n_samples), 0, 0, 1, 1}, @@ -9783,7 +10129,7 @@ static int __Pyx_InitCachedBuiltins(void) { #else __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -9795,72 +10141,108 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); - /* "sklearn/linear_model/cd_fast.pyx":169 + /* "sklearn/linear_model/cd_fast.pyx":171 * * if alpha == 0: * warnings.warn("Coordinate descent with alpha=0 may lead to unexpected" # <<<<<<<<<<<<<< * " results and is discouraged.") * */ - __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_3 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_3)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); PyTuple_SET_ITEM(__pyx_k_tuple_3, 0, ((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); - /* "sklearn/linear_model/cd_fast.pyx":196 + /* "sklearn/linear_model/cd_fast.pyx":184 + * else: + * store_feature_inner_product = False + * warnings.warn("Allowed memory is not sufficient " # <<<<<<<<<<<<<< + * " some values need to be recalculated.") + * + */ + __pyx_k_tuple_5 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_5)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_k_tuple_5, 0, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); + + /* "sklearn/linear_model/cd_fast.pyx":206 * # initial calculation - * if n_iter == 0: + * if n_iter == 0 and store_feature_inner_product: * feature_inner_product[:, ii] = np.dot(X[:, ii], X) # <<<<<<<<<<<<<< - * gradient[ii] = Xy[ii] - np.dot(feature_inner_product[:, ii], w) - * + * gradient[ii] = Xy[ii] - \ + * np.dot(feature_inner_product[:, ii], w) */ - __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_4); - __Pyx_GIVEREF(__pyx_k_slice_4); - __pyx_k_slice_5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_5); - __Pyx_GIVEREF(__pyx_k_slice_5); + __pyx_k_slice_6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_6); + __Pyx_GIVEREF(__pyx_k_slice_6); + __pyx_k_slice_7 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_7); + __Pyx_GIVEREF(__pyx_k_slice_7); - /* "sklearn/linear_model/cd_fast.pyx":197 - * if n_iter == 0: + /* "sklearn/linear_model/cd_fast.pyx":208 * feature_inner_product[:, ii] = np.dot(X[:, ii], X) - * gradient[ii] = Xy[ii] - np.dot(feature_inner_product[:, ii], w) # <<<<<<<<<<<<<< + * gradient[ii] = Xy[ii] - \ + * np.dot(feature_inner_product[:, ii], w) # <<<<<<<<<<<<<< * - * tmp = gradient[ii] + w_ii * norm_cols_X[ii] + * if not store_feature_inner_product: */ - __pyx_k_slice_6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_6); - __Pyx_GIVEREF(__pyx_k_slice_6); + __pyx_k_slice_8 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_8); + __Pyx_GIVEREF(__pyx_k_slice_8); - /* "sklearn/linear_model/cd_fast.pyx":436 + /* "sklearn/linear_model/cd_fast.pyx":211 + * + * if not store_feature_inner_product: + * tmp_feature_inner_product = np.dot(X[:, ii], X) # <<<<<<<<<<<<<< + * gradient[ii] = Xy[ii] - \ + * np.dot(tmp_feature_inner_product, w) + */ + __pyx_k_slice_9 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_9); + __Pyx_GIVEREF(__pyx_k_slice_9); + + /* "sklearn/linear_model/cd_fast.pyx":231 + * (w[ii] - w_ii) + * else: + * tmp_feature_inner_product = np.dot(X[:, j], X) # <<<<<<<<<<<<<< + * gradient[j] -= tmp_feature_inner_product[j] * \ + * (w[ii] - w_ii) + */ + __pyx_k_slice_10 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_10); + __Pyx_GIVEREF(__pyx_k_slice_10); + + /* "sklearn/linear_model/cd_fast.pyx":456 * * if alpha == 0: * warnings.warn("Coordinate descent with alpha=0 may lead to unexpected" # <<<<<<<<<<<<<< * " results and is discouraged.") * */ - __pyx_k_tuple_8 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_8)); + __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); - PyTuple_SET_ITEM(__pyx_k_tuple_8, 0, ((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); - /* "sklearn/linear_model/cd_fast.pyx":553 + /* "sklearn/linear_model/cd_fast.pyx":573 * * if alpha == 0: * warnings.warn("Coordinate descent with alpha=0 may lead to unexpected" # <<<<<<<<<<<<<< * " results and is discouraged.") * */ - __pyx_k_tuple_10 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_10)); + __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); - PyTuple_SET_ITEM(__pyx_k_tuple_10, 0, ((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); /* "numpy.pxd":211 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) @@ -9869,12 +10251,12 @@ static int __Pyx_InitCachedConstants(void) { * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_k_tuple_12 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_12)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); - PyTuple_SET_ITEM(__pyx_k_tuple_12, 0, ((PyObject *)__pyx_kp_u_11)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_15)); + PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_u_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) @@ -9883,12 +10265,12 @@ static int __Pyx_InitCachedConstants(void) { * * info.buf = PyArray_DATA(self) */ - __pyx_k_tuple_14 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_14)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); - PyTuple_SET_ITEM(__pyx_k_tuple_14, 0, ((PyObject *)__pyx_kp_u_13)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + __pyx_k_tuple_18 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_18)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_17)); + PyTuple_SET_ITEM(__pyx_k_tuple_18, 0, ((PyObject *)__pyx_kp_u_17)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_17)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); /* "numpy.pxd":253 * if ((descr.byteorder == '>' and little_endian) or @@ -9897,12 +10279,12 @@ static int __Pyx_InitCachedConstants(void) { * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_k_tuple_16 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_16)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_15)); - PyTuple_SET_ITEM(__pyx_k_tuple_16, 0, ((PyObject *)__pyx_kp_u_15)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_15)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); + __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_19)); + PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_u_19)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_19)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); /* "numpy.pxd":795 * @@ -9911,12 +10293,12 @@ static int __Pyx_InitCachedConstants(void) { * * if ((child.byteorder == '>' and little_endian) or */ - __pyx_k_tuple_19 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_19)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_18)); - PyTuple_SET_ITEM(__pyx_k_tuple_19, 0, ((PyObject *)__pyx_kp_u_18)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_18)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + __pyx_k_tuple_23 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_23)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_22)); + PyTuple_SET_ITEM(__pyx_k_tuple_23, 0, ((PyObject *)__pyx_kp_u_22)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_22)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); /* "numpy.pxd":799 * if ((child.byteorder == '>' and little_endian) or @@ -9925,12 +10307,12 @@ static int __Pyx_InitCachedConstants(void) { * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_k_tuple_20 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_20)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_20)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_15)); - PyTuple_SET_ITEM(__pyx_k_tuple_20, 0, ((PyObject *)__pyx_kp_u_15)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_15)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_20)); + __pyx_k_tuple_24 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_24)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_19)); + PyTuple_SET_ITEM(__pyx_k_tuple_24, 0, ((PyObject *)__pyx_kp_u_19)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_19)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); /* "numpy.pxd":819 * t = child.type_num @@ -9939,12 +10321,12 @@ static int __Pyx_InitCachedConstants(void) { * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_k_tuple_22 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_22)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_22)); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_21)); - PyTuple_SET_ITEM(__pyx_k_tuple_22, 0, ((PyObject *)__pyx_kp_u_21)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_21)); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_22)); + __pyx_k_tuple_26 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_k_tuple_26)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_25)); + PyTuple_SET_ITEM(__pyx_k_tuple_26, 0, ((PyObject *)__pyx_kp_u_25)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_25)); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -10059,10 +10441,10 @@ PyMODINIT_FUNC PyInit_cd_fast(void) */ __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(((PyObject *)__pyx_n_s_24)); - PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s_24)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s_24)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_23), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_n_s_28)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s_28)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_28)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_27), ((PyObject *)__pyx_t_1), -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s__linalg, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -10087,7 +10469,7 @@ PyMODINIT_FUNC PyInit_cd_fast(void) * unsigned int n_features, * np.ndarray[DOUBLE, ndim=1] X_data, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_sparse_std, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_sparse_std, NULL, __pyx_n_s_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sparse_std, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -10099,7 +10481,7 @@ PyMODINIT_FUNC PyInit_cd_fast(void) * #remove inactive features * # its not clear why this fails with */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_1update_active_set, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_1update_active_set, NULL, __pyx_n_s_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__update_active_set, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -10107,9 +10489,9 @@ PyMODINIT_FUNC PyInit_cd_fast(void) /* "sklearn/linear_model/cd_fast.pyx":139 * np.ndarray[DOUBLE, ndim=2] X, * np.ndarray[DOUBLE, ndim=1] y, - * int max_iter, double tol, bool positive=False): # <<<<<<<<<<<<<< + * int max_iter, double tol, bool positive=False, # <<<<<<<<<<<<<< + * int memory_limit=500): * """Cython version of the coordinate descent algorithm - * for Elastic-Net regression */ __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -10125,73 +10507,73 @@ PyMODINIT_FUNC PyInit_cd_fast(void) * double alpha, double beta, * np.ndarray[DOUBLE, ndim=2] X, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_2enet_coordinate_descent, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_2enet_coordinate_descent, NULL, __pyx_n_s_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_26, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_30, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":239 + /* "sklearn/linear_model/cd_fast.pyx":259 * @cython.wraparound(False) * @cython.cdivision(True) * def sparse_enet_coordinate_descent(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< * double alpha, double beta, * np.ndarray[DOUBLE, ndim=1] X_data, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordinate_descent, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_3sparse_enet_coordinate_descent, NULL, __pyx_n_s_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_27, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_31, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":400 + /* "sklearn/linear_model/cd_fast.pyx":420 * np.ndarray[DOUBLE, ndim=1] q, * np.ndarray[DOUBLE, ndim=1] y, * int max_iter, double tol, bool positive=False): # <<<<<<<<<<<<<< * """Cython version of the coordinate descent algorithm * for Elastic-Net regression */ - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_k_7 = ((PyBoolObject *)__pyx_t_2); + if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_11 = ((PyBoolObject *)__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":395 + /* "sklearn/linear_model/cd_fast.pyx":415 * @cython.wraparound(False) * @cython.cdivision(True) * def enet_coordinate_descent_gram(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< * double alpha, double beta, * np.ndarray[DOUBLE, ndim=2] Q, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_4enet_coordinate_descent_gram, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_4enet_coordinate_descent_gram, NULL, __pyx_n_s_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_28, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_32, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":520 + /* "sklearn/linear_model/cd_fast.pyx":540 * np.ndarray[DOUBLE, ndim=2] X, * np.ndarray[DOUBLE, ndim=1] y, * int max_iter, double tol, bool positive=False): # <<<<<<<<<<<<<< * """Cython version of the coordinate descent algorithm * for Elastic-Net regression */ - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_k_9 = ((PyBoolObject *)__pyx_t_2); + if (!(likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7cpython_4bool_bool)))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_13 = ((PyBoolObject *)__pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/linear_model/cd_fast.pyx":516 + /* "sklearn/linear_model/cd_fast.pyx":536 * @cython.wraparound(False) * @cython.cdivision(True) * def enet_coordinate_descent_old(np.ndarray[DOUBLE, ndim=1] w, # <<<<<<<<<<<<<< * double alpha, double beta, * np.ndarray[DOUBLE, ndim=2] X, */ - __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_5enet_coordinate_descent_old, NULL, __pyx_n_s_25); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_7sklearn_12linear_model_7cd_fast_5enet_coordinate_descent_old, NULL, __pyx_n_s_29); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_29, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_33, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/linear_model/cd_fast.pyx":1 diff --git a/sklearn/linear_model/cd_fast.pyx b/sklearn/linear_model/cd_fast.pyx index e54cac29a1cc5..01a199329e7e3 100644 --- a/sklearn/linear_model/cd_fast.pyx +++ b/sklearn/linear_model/cd_fast.pyx @@ -136,7 +136,8 @@ def enet_coordinate_descent(np.ndarray[DOUBLE, ndim=1] w, double alpha, double beta, np.ndarray[DOUBLE, ndim=2] X, np.ndarray[DOUBLE, ndim=1] y, - int max_iter, double tol, bool positive=False): + int max_iter, double tol, bool positive=False, + int memory_limit=500): """Cython version of the coordinate descent algorithm for Elastic-Net regression @@ -164,6 +165,7 @@ def enet_coordinate_descent(np.ndarray[DOUBLE, ndim=1] w, cdef double d_w_tol = tol cdef unsigned int ii cdef unsigned int n_iter + cdef bool store_feature_inner_product = True if alpha == 0: warnings.warn("Coordinate descent with alpha=0 may lead to unexpected" @@ -174,6 +176,14 @@ def enet_coordinate_descent(np.ndarray[DOUBLE, ndim=1] w, Xy = np.dot(X.T, y) # memory foodprint has to be reduced + #memory_limit = 5000 + if memory_limit > n_features * n_features: + feature_inner_product = np.zeros(shape=(n_features, n_features)) + else: + store_feature_inner_product = False + warnings.warn("Allowed memory is not sufficient " + " some values need to be recalculated.") + feature_inner_product = np.zeros(shape=(n_features, n_features)) gradient = np.zeros(n_features) active_set = set(range(n_features)) @@ -192,9 +202,15 @@ def enet_coordinate_descent(np.ndarray[DOUBLE, ndim=1] w, w_ii = w[ii] # Store previous value # initial calculation - if n_iter == 0: + if n_iter == 0 and store_feature_inner_product: feature_inner_product[:, ii] = np.dot(X[:, ii], X) - gradient[ii] = Xy[ii] - np.dot(feature_inner_product[:, ii], w) + gradient[ii] = Xy[ii] - \ + np.dot(feature_inner_product[:, ii], w) + + if not store_feature_inner_product: + tmp_feature_inner_product = np.dot(X[:, ii], X) + gradient[ii] = Xy[ii] - \ + np.dot(tmp_feature_inner_product, w) tmp = gradient[ii] + w_ii * norm_cols_X[ii] @@ -208,9 +224,13 @@ def enet_coordinate_descent(np.ndarray[DOUBLE, ndim=1] w, if w_ii != w[ii]: for j in active_set: if n_iter >= 1 or j <= ii: - gradient[j] -= feature_inner_product[ii, j] * \ + if store_feature_inner_product: + gradient[j] -= feature_inner_product[ii, j] * \ + (w[ii] - w_ii) + else: + tmp_feature_inner_product = np.dot(X[:, j], X) + gradient[j] -= tmp_feature_inner_product[j] * \ (w[ii] - w_ii) - # update the maximum absolute coefficient update d_w_ii = fabs(w[ii] - w_ii) if d_w_ii > d_w_max: