14
14
15
15
16
16
class DummyClassifier (BaseEstimator , ClassifierMixin ):
17
+
17
18
"""
18
19
DummyClassifier is a classifier that makes predictions using simple rules.
19
20
@@ -274,6 +275,7 @@ def predict_log_proba(self, X):
274
275
275
276
276
277
class DummyRegressor (BaseEstimator , RegressorMixin ):
278
+
277
279
"""
278
280
DummyRegressor is a regressor that always predicts the mean of the training
279
281
targets.
@@ -286,7 +288,7 @@ class DummyRegressor(BaseEstimator, RegressorMixin):
286
288
`constant_' : float or array of shape [n_outputs]
287
289
Mean or median of the training targets or constant value given the by
288
290
the user.
289
-
291
+
290
292
`n_outputs_` : int,
291
293
Number of outputs.
292
294
@@ -324,7 +326,8 @@ def fit(self, X, y):
324
326
"""
325
327
326
328
if self .strategy not in ("mean" , "median" , "constant" ):
327
- raise ValueError ("Unknown strategy type: %s, expected 'mean, 'median' or 'constant'"
329
+ raise ValueError ("Unknown strategy type: %s, "
330
+ "expected 'mean', 'median' or 'constant'"
328
331
% self .strategy )
329
332
330
333
y = safe_asarray (y )
@@ -345,8 +348,8 @@ def fit(self, X, y):
345
348
346
349
if self .output_2d_ and self .constant .shape [0 ] != y .shape [1 ]:
347
350
raise ValueError (
348
- "Constant target value should have "
349
- "shape (%d, 1)." % y .shape [1 ])
351
+ "Constant target value should have "
352
+ "shape (%d, 1)." % y .shape [1 ])
350
353
351
354
self .constant_ = np .reshape (self .constant , (1 , - 1 ))
352
355
0 commit comments