100 beginner machine learning projects with runnable Python code, tests and honest case studies. By Networkers Home, Bangalore.
This small teaching project demonstrates how to fit a simple ARIMA-style model for univariate time-series forecasting using only numpy, pandas and scikit-learn. It focuses on documented differencing (d), fitting an autoregressive component (p) on the differenced series, generating multi-step forecasts from a fixed origin, and comparing those forecasts (and prediction intervals) to a naive last-value baseline. It also computes horizon-specific mean absolute errors and a simple interval coverage diagnostic.
The data are synthetic: a regularly spaced daily series combining a linear trend, a seasonal weekly component and Gaussian noise. The series is generated inside the code using numpy; no external data downloads are used. The final 30 days are held out as the evaluation period.
Measured by running python project.py (seed 42) on 2026-10-23; the tests in test_project.py assert the floor.
| Metric | Value |
|---|---|
| model | ARIMA-like AR(p,d,0) via linear regression |
| d | 1 |
| p | 5 |
| mae | 0.8400 |
| naive_mae | 1.0525 |
| r2 | 0 |
| coverage_95 | 1 |
| mae_h1 | 0.0573 |
| mae_h7 | 0.6723 |
| mae_h14 | 0.8634 |
| mae_h30 | 0.8400 |
| resid_std | 0.5820 |
This project deliberately implements an ARIMA( p,d,0 )-style model: differencing (d) plus an autoregressive component (p) fitted by ordinary least squares. It does not fit a full ARIMA(p,d,q) with an explicit MA(q) term using packages like statsmodels. Prediction intervals are approximate: they assume the one-step residuals are an adequate estimator of uncertainty and scale with horizon using a simple sqrt(h) factor. The synthetic data are small and idealised; real-world time series often require more careful diagnostics and specialised tools.
Full case study, build steps and evaluation checks: Time series forecasting with ARIMA on networkershome.com
Built by Networkers Home · Learn the skills in the AI Engineer Course · Part of 100 AI projects with code