Prediction
1. Classification vs Prediction
| Aspect | Classification | Prediction (numeric / regression) |
|---|---|---|
| Output | Discrete class label (yes/no, A/B/C) |
Continuous numeric value (price, temperature, demand) |
| Model | Classifier | Predictor / regressor |
| Evaluation | Accuracy, error rate, confusion matrix | MAE, MSE, RMSE, , correlation |
| Example | 'Will the customer default?' | 'What will be the sales next quarter?' |
Both are supervised learning of a mapping from attributes to a target; prediction is used where exact labels are replaced by numeric estimates.
2. Main Prediction (Regression) Techniques
(a) Linear regression — the simplest, assumes a linear relationship:
with the least-squares solution:
(b) Multiple linear regression — several independent attributes:
Weights are found by solving the normal equations ; it can also be solved by gradient descent (the basis of neural networks). Categorical attributes are converted with dummy variables.
(c) Non-linear / other models
| Method | Idea |
|---|---|
| Polynomial regression | — curves are fitted by treating powers as new attributes |
| Logistic regression | — classification and probability estimation |
| Generalised linear models (GLM) | Link function + distribution (Poisson, gamma) — insurance claims, counts |
| Regression trees (model trees) | Leaves carry a linear equation, not a class; M5 / M5' algorithms |
| Neural networks (MLP, RBF) | Universal approximators for non-linear regression |
| Support vector regression (SVR) | -insensitive tube, kernels for non-linearity |
| k-NN regression / LWR | Locally weighted average of neighbours |
| Time-series models (AR, MA, ARIMA, exponential smoothing, Holt-Winters) | Trend, seasonality and autocorrelation in sequences |
| Ensembles (bagging, boosting) | Combine many weak regressors (random forest regression, gradient boosting) |
3. Worked Least-Squares Example
Data: → , .
Model: . Prediction at → . Residuals: (small, so a good linear fit).
4. Accuracy of a Predictor
Example — actual 20, 30, 40, 50; predicted 21, 28, 42, 48:
MAE ; MSE ; RMSE ; mean , so relative RMSE .
5. Handling Overfitting and Underfitting
- Overfitting — the model fits noise (too many attributes/parameters, too deep a tree): low training error, high test error. Fix with pruning, regularisation ( Lasso, Ridge), more data, cross-validation.
- Underfitting — the model is too simple: high error on both. Fix with more/better features, a more flexible model.
Regularisation shrinks coefficients:
6. Choosing a Model / Avoiding Overfitting
Split data into training / validation / test; use cross-validation for tuning; prefer the simplest model that fits (Occam's razor); check the bias-variance trade-off; use domain constraints.
7. Applications of Prediction
Sales and demand forecasting, financial time-series forecasting, price and risk estimation, medical dosage/prognosis, weather and energy-load prediction, click-through/response prediction, predictive maintenance, customer lifetime value.
8. Exam Points
- Explain linear and multiple regression for prediction with the least-squares formulas — 10 marks (frequent).
- Numerical: fit a regression line from given data and predict — 5-7 marks (very frequent).
- Compute MAE, MSE, RMSE, relative error and for predicted vs actual values — 5 marks.
- Difference between classification and prediction — 3-5 marks.
- Discuss overfitting and regularisation — 5 marks.