Downloads · 30 days
0
yunussgultekiin/gnn-electric-vehicle-energy-model
gnn-electric-vehicle-energy-model is a machine learning model from yunussgultekiin. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
A Graph Convolutional Network (GCN) trained to predict energy consumption (kWh) per road segment, combined with an energy-weighted Dijkstra algorithm to find the minimum-energy route for electric vehicles in Istanbul'…
Downloads · 30 days
0
Access
Public
Updated Jun 5, 2026
Repo size
1.7 MB
Likes
0
Public
Click a slice to open those files.
.csv2.5 MB · 41%
From the Hugging Face model README
A Graph Convolutional Network (GCN) trained to predict energy consumption (kWh) per road segment, combined with an energy-weighted Dijkstra algorithm to find the minimum-energy route for electric vehicles in Istanbul's Maltepe district.
Standard shortest-path or fastest-path routing does not address EV range anxiety. This project tackles the problem in two stages:
The model is defined as EnergyGCN using PyTorch Geometric:
input_proj linear layer projects the 17-dimensional input into a hidden_dim=64 space.GCNConv layers are stacked with residual connections; each is followed by ReLU and dropout (0.2).skip connection adds the input_proj output to the final GCN output.head layer produces the scalar energy prediction.The k-NN graph is built in [speed_kmh, length, gradient] space — segments with similar speed regime, distance, and grade are connected. GCNConv aggregating over these neighbours provides a genuine regularisation signal that a plain MLP cannot exploit.
Feature pipeline
10 base features (length, gradient, surface_type, traffic_density, temperature, wind_speed, weather_condition, speed_kmh, battery_soc, acceleration) are extended at inference time with 7 engineered features (gradient_sq, length_x_gradient, cold_penalty, wind_speed_sq, speed_sq, power_proxy, speed_x_length) to form a 17-dimensional node feature vector. The strongest single predictor is speed_x_length (|r| = 0.822).
EV Energy Consumption Dataset — Kaggle
Real-time driving behaviour, road conditions, weather, and vehicle data for energy prediction. Target column: Energy_Consumption_kWh. The raw CSV is included at data/raw/EV_Energy_Consumption_Dataset.csv.
[speed_kmh, length, gradient] space (k = 10)The model completed 600 epochs without early stopping.
| Metric | Value |
|---|---|
| Best epoch | 600 |
| Val MSE / MAE | 0.891 kWh² / 0.747 kWh |
| Test MSE / MAE | 0.953 kWh² / 0.787 kWh |
| Test RMSE | 0.976 kWh |
| RMSE / target mean | 11.6 % (mean = 8.45 kWh) |
The average test error is ~0.79 kWh, roughly 9% of the target mean. Sensitivity analyses confirm the model has learned physical reality: predicted energy rises super-linearly with speed (driven by speed_sq and speed_x_length), increases on uphill gradients, and decreases on downhill ones.
| File | Description |
|---|---|
best_model.pt | Trained GCN weights (PyTorch checkpoint) |
scaler.pkl | StandardScaler fitted on the 17-feature training set |
encoders.pkl | Integer encoding dictionaries for categorical features |
graph_dataset.pt | Serialised PyG Data objects used during training (train/val/test) |
training_summary.json | Hyperparameters, metrics, and feature column list |
feature_map.md | Full feature documentation with correlation coefficients |
requirements.txt | Pinned Python dependencies |
data/raw/EV_Energy_Consumption_Dataset.csv | Raw Kaggle dataset |
data/processed/{train,val,test}_processed.csv | Scaled and encoded splits (output of notebook 02) |
| Notebook | Description |
|---|---|
notebooks/01_eda_feature_analysis.ipynb | Exploratory data analysis: distributions, target correlations, feature selection rationale |
notebooks/02_preprocessing_pipeline.ipynb | Cleaning, label encoding, feature engineering, train/val/test split |
notebooks/03_graph_construction.ipynb | k-NN graph construction with PyTorch Geometric and visualisation |
notebooks/04_gcn_training_evaluation.ipynb | GCN training loop, loss curves, test evaluation, sensitivity analysis |
Run notebooks in order. Jupyter can be started from either hugging/ or hugging/notebooks/ — notebooks detect the CWD automatically and always write outputs to the hugging/ root.
Apache 2.0