Skip to content

Commit

Permalink
Rever formating of warning, Reword warning for sparse uniform case
Browse files Browse the repository at this point in the history
  • Loading branch information
hamsal committed Aug 4, 2014
1 parent 44499fa commit cfad359
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions sklearn/dummy.py
Expand Up @@ -97,9 +97,10 @@ def fit(self, X, y, sample_weight=None):

if self.strategy == "uniform" and sp.issparse(y):
y = y.toarray()
warnings.warn('prediciting on sparse target data with the uniform '
'strategy would not save memory and would be '
'slower. The target data has been densified',
warnings.warn('The target data has been converted to a numpy '
'array. Prediciting on sparse target data with the '
'uniform strategy would not save memory and would '
'be slower.',
sp.SparseEfficiencyWarning)

self.sparse_target_input_ = sp.issparse(y)
Expand All @@ -115,12 +116,10 @@ def fit(self, X, y, sample_weight=None):

if self.strategy == "constant":
if self.constant is None:
raise ValueError("Constant target value has to be"
"specified when the constant strategy is"
" used.")
raise ValueError("Constant target value has to be specified "
"when the constant strategy is used.")
else:
constant = np.reshape(np.atleast_1d(self.constant),
(-1, 1))
constant = np.reshape(np.atleast_1d(self.constant), (-1, 1))
if constant.shape[0] != self.n_outputs_:
raise ValueError("Constant target value should have "
"shape (%d, 1)." % self.n_outputs_)
Expand Down

0 comments on commit cfad359

Please sign in to comment.