DummyRegressor
noun
say it: “DUM-ee rih-GRES-er” /ˈdʌmi rɪˈɡrɛsər/
A scikit-learn model that always predicts one fixed number, such as the average, used as a baseline for comparison.
What is DummyRegressor?
DummyRegressor is a scikit-learn model that ignores the features and always guesses the same number: the training
labels' mean by default, or their median with strategy="median". It gives the baseline score a real model has to
beat, with the same fit() and predict() as the rest.
from sklearn.dummy import DummyRegressor
miles = [[2.1], [1.4], [3.8], [2.9]]
minutes = [30, 25, 40, 33]
dummy = DummyRegressor().fit(miles, minutes)
print(dummy.predict([[5.0]])) # [32.]: the average, whatever the miles
In a sentence
- “The DummyRegressor guessed 32 minutes for every delivery.”
- “If your model can't beat a DummyRegressor, the features aren't helping.”
Level: Journeyman · More Python terms at this level
Updated