python -m pip install -r requirements.txtRun the production-ready dashboard locally:
streamlit run streamlit_app.pyNotes:
- The dashboard loads
data/processed/global_active_power_hourly.csvby default. Override withENERGY_APP_DATA_CSV=/path/to/your.csv. - For model-based forecasts, run the training scripts at least once to generate
outputs/artifacts (e.g.,run_ml_models.py,prophet_forecasting.py,arima_forecasting.py,run_model_comparison.py). - Plot PNG downloads use
kaleido(included inrequirements.txt).
Downloads the UCI household power consumption dataset (if missing), builds an hourly target series, engineers time-based features, and saves temporal train/val/test splits under data/processed/.
python prepare_time_series_data.pyRuns Prophet with:
- daily + weekly seasonality enabled
- yearly seasonality enabled only if there is at least ~2 years of training data
- calendar regressors derived from existing time features (hour/day/month sin/cos, weekend/business hour)
- optional country holidays (default: France)
python prophet_forecasting.py --output-dir outputs/prophetArtifacts:
outputs/prophet/prophet_forecast.csvoutputs/prophet/prophet_forecast_vs_actual.pngoutputs/prophet/prophet_components.png
Fits a small SARIMAX model on the last N training points (default 1500) and forecasts the test horizon.
python arima_forecasting.py --output-dir outputs/arima --max-train-points 1500Artifacts:
outputs/arima/arima_forecast.csvoutputs/arima/arima_forecast_vs_actual.png
Runs both models, writes a metrics table, and saves an overlay plot.
python compare_prophet_arima.py --output-dir outputs --max-arima-train-points 1500Artifacts:
outputs/compare/metrics_comparison.csvoutputs/compare/forecast_overlay.png
Trains an LSTM on sequences of the previous 24 hours to predict the next hour. It:
- scales inputs/targets with
MinMaxScaler(fit on train only) - uses
EarlyStopping+ModelCheckpoint - saves loss curves and test predictions/metrics
Note: TensorFlow support depends on your Python version. If pip install tensorflow fails on your interpreter, use a Python version supported by TensorFlow (commonly 3.10–3.12) or install a compatible TensorFlow build for your environment.
python run_lstm.py --lookback-hours 24 --epochs 50 --batch-size 128Optional: include calendar/time features (still fed as sequences):
python run_lstm.py --include-time-features --lookback-hours 24Artifacts:
outputs/lstm/best_model.kerasoutputs/lstm/training_history.pngoutputs/lstm/lstm_test_predictions.csvoutputs/lstm/lstm_pred_vs_actual.pngoutputs/lstm/model_comparison.csv