Skip to content

Commit ec8edb6

Browse files
author
Fabian Pedregosa
committed
I won't import scipy.sparse globally.
I won't import scipy.sparse globally. I won't import scipy.sparse globally. I won't import scipy.sparse globally. I won't import scipy.sparse globally. ...
1 parent cbb0a1b commit ec8edb6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

scikits/learn/linear_model/base.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# License: BSD Style.
1313

1414
import numpy as np
15-
import scipy.sparse as sp
1615

1716
from ..base import BaseEstimator, RegressorMixin, ClassifierMixin
1817
from .sgd_fast import Hinge, Log, ModifiedHuber, SquaredLoss, Huber
@@ -54,8 +53,9 @@ def _center_data(X, y, fit_intercept):
5453
because nearly all Linear Models will want it's data to be
5554
centered.
5655
"""
56+
import scipy.sparse # importing scipy.sparse just for this is overkill
5757
if fit_intercept:
58-
if sp.issparse(X):
58+
if scipy.sparse.issparse(X):
5959
Xmean = np.zeros(X.shape[1])
6060
else:
6161
Xmean = X.mean(axis=0)

0 commit comments

Comments
 (0)