What Is a Regression Model? Predicting a Number, With Measured Results
A regression model predicts a number, such as tomorrow's demand. Measured on 731 days of bike rentals: what the inputs, the split and the baseline do to the error.
In this article
A regression model predicts a number. How many units will sell tomorrow, what a property will sell for, how many minutes a job will take. That is the difference from a classification model, which predicts a category such as "will churn" or "won't churn". The word comes from statistics; today it covers any model with a numeric target, from a straight-line formula to gradient boosting and neural networks.
Measured example: on 731 days of public bike-rental data, we predicted the latest 147 days from the earlier ones. Predicting the training average was off by 2,290 rentals a day on average. A linear regression using weather and calendar inputs was off by 804. With calendar inputs only, the error rose to 1,056.
How a regression model is judged
Every prediction has an error: the actual value minus the predicted one. Three summaries are common:
- Mean absolute error (MAE): the average size of the miss, in the target's own units. "Off by 804 rentals a day."
- Root mean squared error (RMSE): like MAE, but large misses count more.
- R-squared (R²): the share of the day-to-day variation the model explains. 1 is perfect; 0 means no better than predicting the average of the rows being scored; it can be negative.
None of them means much alone. Compare against a baseline, such as always predicting the training average or median. A model that does not clearly beat that has learned nothing useful.
A measured example: daily bike rentals
We used the public Bike Sharing dataset from the UCI Machine Learning Repository: two years of daily totals for a city bike-share scheme, with season, month, weekday, holiday, working-day flag, weather type, temperature, humidity and wind speed.
Two columns had to go first. The dataset also records casual and registered rentals, and those two add up exactly to the total we are predicting. A model given them would look perfect and be useless, because on the day you make the prediction neither number exists yet. That is target leakage.
We trained on the first 584 days and scored on the last 147, so the test looks like the future the model would face. Results on those 147 days:
| Model | Inputs | MAE (rentals/day) | R² |
|---|---|---|---|
| Predict the training average | none | 2,290 | −0.87 |
| Linear regression | weather + calendar | 804 | 0.65 |
| Gradient boosting | weather + calendar | 915 | 0.65 |
| Linear regression | calendar only | 1,056 | 0.41 |
| Gradient boosting | calendar only | 1,149 | 0.36 |
Three things stand out.
- The baseline did badly because demand grew. The latest days averaged 5,898 rentals against 4,154 in the training days. A model that cannot pick up growth is wrong for the future even if it fits the past.
- The simple model won. Linear regression beat gradient boosting here. Tree-based models cannot predict beyond the range they were trained on, which hurts when the numbers are rising. More complex is not automatically better.
- Inputs matter more than the algorithm. Dropping the weather inputs raised the linear model's error from 804 to 1,056.
A random split would have flattered every model. Shuffling the days and holding out a random 20% instead gave gradient boosting an MAE of 462 and R² of 0.88: much better-looking figures, because the test days were surrounded by training days from the same weeks. For dated data, that is not how the model will be used.
What Model Manager reported on the same data
YourCloudGroup Model Manager's sample-data demonstration runs on the same public dataset with calendar inputs only (season, year, month, holiday, weekday, working day; no weather). It held back the final 102 days of the record, built 12 models, and chose the winner (a small neural network) on half of those days. On the other 51 days, which took no part in the choice, it reported:
- Mean absolute error 1,535 rentals a day, against 1,988 for a baseline that always predicts the training median (4,359);
- an error reduction of 22.8%, with a 90% range of 18.1–27.5%;
- verdict MODERATE: useful predictive value over the baseline, with limitations.
Across all 102 held-back days, its predictions stayed between about 4,000 and 5,300 while actual rentals ranged from 22 to 8,555, and 32 of the 102 days were predicted within 10%. That is what a calendar-only model of a weather-driven number looks like, and the product said so rather than reporting a flattering figure. Its split and inputs differ from our experiment, so its MAE should not be compared directly with ours.
When to use a regression model
- The thing you want to predict is a quantity: demand, revenue, duration, price, a score.
- You have past rows where that quantity is known, with inputs you would also know at the moment of prediction.
- You can say what a useful error is, in the target's own units. "Within 500 units" is a business requirement; R² is not.
If what you need is a yes/no decision, such as reorder or not, a classification model on that decision may serve better than a regression on the quantity.
Takeaway
A regression model predicts a number, and it is judged by how far off it is on rows it never saw, against a simple baseline. On bike-rental data the inputs mattered more than the algorithm, a random split overstated accuracy, and Model Manager rated a calendar-only model MODERATE: better than the baseline, not good enough to rely on alone.
See it on sample data: How much demand you will have tomorrow shows how Model Manager tested a model on the public Bike Sharing (UCI) dataset: the verdict, the measured figures and the predictions to download.
Sources
- Fanaee-T, H. Bike Sharing [Dataset]. UCI Machine Learning Repository. doi:10.24432/C5W894. CC BY 4.0.
- Experiment script:
regression_bike.py(chronological 584/147 split; random 80/20 split for comparison; scikit-learn). - YourCloudGroup Model Manager sample-data run: yourcloudgroup.com/try/demand.
Build predictive models from your own data
YourCloudGroup Model Manager builds, evaluates, certifies and schedules predictive models from your CSV or spreadsheet data — point and click, on your own dedicated server.
Learn about Model Manager →Published by YourCloudGroup. Read our editorial standards and corrections policy.