PyCaret makes time series forecasting easy, automating predictions for sales, stocks, or ETAs in minutes. In this post, I will show simple code for sequential data—no complex ARIMA or stationarity tests needed.
Time series forecasting uses past patterns to predict future values. It captures trends (steady rise/fall), seasonality (weekly/monthly repeats), and noise. Unlike regular ML, order matters—yesterday affects tomorrow. Perfect for ETA predictions with models like ARIMA, Prophet, or ETS, measured by MASE or SMAPE.
Effortless Setup
Install via pip install pycaret[full] ts.
from pycaret.time_series import *
from pycaret.datasets import get_data
y = get_data(‘airline_passenger’)
setup(y, fh=12, fold=3) # Auto-detects trends, seasonality, stationarity
Smart Model Comparison
best_model = compare_models() # Ranks ARIMA, ETS, Prophet
exp_smooth = create_model(‘exp_smooth’)
tuned_exp = tune_model(exp_smooth)
| Step | Code | What It Does |
|---|---|---|
| Setup | setup(y, fh=12) | Detects patterns & splits |
| Compare | compare_models() | Tests 10+ models auto |
| Tune | tune_model('prophet') | Hyperparameter optimization |
| Forecast | predict_model(tuned_exp, fh=24) | Future predictions ready |
Real-World Deployment
plot_model(tuned_exp, plot=’forecast’) # Visual proof
save_model(tuned_exp, ‘eta_forecast’) # Production ready
For ETAs, use traffic data—handles weather too