Predict instantaneous vehicle energy consumption rate (kW) from multivariate CAN-like sensor time series (speed, accel, rpm, torque, throttle, gear, road grade). This repository is a reproducible, report-ready pipeline that generates artifacts (CSV, LaTeX tables, PDF figures) automatically and composes a LaTeX report that reads those artifacts directly.
Repository: https://github.com/salarsadek/surrogate-can-energy
Author: Salar Sadek
- 📄 Full report (PDF): assets/report.pdf
Random Forest: Observed vs Predicted (test set)

Permutation importance (top engineered signals)

- Leakage-safe train/test splitting at the trip level to avoid temporal leakage.
- Physically motivated feature engineering (speed², torque×RPM power proxy, grade×speed interaction).
- Strong tabular baselines: Ridge and Random Forest (static features) plus rolling-window feature baselines.
- A sequence experiment using GRU (included for comparison).
- Uncertainty quantification (UQ) via ensemble spread + split conformal prediction.
- Interpretability via permutation importance and partial dependence plots (PDPs).
- Reproducible pipeline: scripts save models, tables, and figures under
outputs/and the LaTeX report reads them automatically.
These numbers are example outputs from the included synthetic demo dataset to illustrate expected artifacts.
| Model (test set) | RMSE | R² |
|---|---|---|
| Ridge (static) | 84.13 | 0.889 |
| Random Forest (static) | 7.03 | 0.999 |
| Ridge (windowed) | 87.10 | 0.897 |
| RF (windowed) | 19.67 | 0.995 |
| GRU (keras experiment) | 222.34 | 0.329 |
Key takeaway: on this synthetic dataset, engineered tabular features + Random Forest give a very strong baseline; the GRU sequence model did not improve performance for this target (suggests short-horizon / largely memoryless structure).
- Clone repository (if not already):
git clone https://github.com/salarsadek/surrogate-can-energy
cd surrogate-can-energy
### 1. Create & activate a virtual environment
From the project root:
```powershell
python -m venv .venv
.\.venv\Scripts\Activate.ps1
python -m pip install --upgrade pip
pip install -r requirements.txt
### Folder structure
surrogate-can-energy/
├── config/ # YAML configuration
├── data/
│ ├── raw/ # raw inputs (ignored by git)
│ └── processed/ # processed splits + engineered features
├── outputs/
│ ├── figures/ # PDFs for report (optionally PNG previews)
│ ├── tables/ # CSV + LaTeX tables
│ └── models/ # saved models (ignored by git)
├── report/
│ └── main.tex # report (reads outputs/*)
├── src/
│ ├── scripts/ # pipeline steps
│ └── utils.py # common utilities
├── tests/ # sanity checks
├── run_all.ps1 # end-to-end runner (Windows)
├── Makefile # convenience targets
└── requirements.txt