Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- class:`linear_model:ElasticNet` and class:`linear_model:Lasso` with
`precompute=False` uses less memory for dense `X` and is a bit faster.
By :user:`Christian Lorentzen <lorentzenchr>`
5 changes: 4 additions & 1 deletion sklearn/linear_model/_cd_fast.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ def enet_coordinate_descent(
cdef unsigned int n_features = X.shape[1]

# compute norms of the columns of X
cdef floating[::1] norm_cols_X = np.square(X).sum(axis=0)
# same as norm_cols_X = np.square(X).sum(axis=0)
cdef floating[::1] norm_cols_X = np.einsum(
"ij,ij->j", X, X, dtype=dtype, order="C"
)

# initial value of the residuals
cdef floating[::1] R = np.empty(n_samples, dtype=dtype)
Expand Down