Skip to content

Commit ee59a0c

Browse files
author
maheshakya
committed
Refactored the code and added quotes
1 parent b047518 commit ee59a0c

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

sklearn/dummy.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ def fit(self, X, y):
324324
"""
325325

326326
if self.strategy not in ("mean", "median", "constant"):
327-
raise ValueError("Unknown strategy type: %s, expected mean, median or constant"
327+
raise ValueError("Unknown strategy type: %s, expected 'mean, 'median' or 'constant'"
328328
% self.strategy)
329329

330330
y = safe_asarray(y)
@@ -343,11 +343,10 @@ def fit(self, X, y):
343343

344344
self.constant = safe_asarray(self.constant)
345345

346-
if self.output_2d_:
347-
if self.constant.shape[0] != y.shape[1]:
348-
raise ValueError(
346+
if self.output_2d_ and self.constant.shape[0] != y.shape[1]:
347+
raise ValueError(
349348
"Constant target value should have "
350-
"shape (%d, 1)." % y.shape[1])
349+
"shape (%d, 1)." % y.shape[1])
351350

352351
self.constant_ = np.reshape(self.constant, (1, -1))
353352

0 commit comments

Comments
 (0)