license: mit
language:
- en
metrics:
- mae
pipeline_tag: time-series-forecasting
Battery health prediction using machine learning models
This repository contains transformer model for predicting battery capacity / remaining useful life (RUL).
Project description
Developed deep learning models based on Transformer architectures to predict Li-ion battery capacity degradation and estimate remaining useful life using time-series charge–discharge data. The codebase is implemented using python utilizing pytorch, leveraging voltage, current, and temperature trends with feature engineering and sliding time windows for temporal modeling. The Transformer achieved the best prediction accuracy, while GRU and CNN–LSTM provided efficient alternatives for smaller datasets. The work highlights effective data-driven approaches for battery health monitoring, critical for electric vehicles and energy storage systems. The plot of the capacity of all batteries used is shown below.

Repository structure
- transformer.ipynb — Contains code for data processing, model architecture, training and evaluation for transformer based model.
- artifacts-v1.zip - Contains model artifacts to use for inference.
Requirements
Install core Python packages used by the notebooks:
pip install numpy pandas scipy scikit-learn matplotlib torch transformers
Typical workflow
- Load raw .mat from dataset/ for transformer model.
- Extract sequences with utility functions involving extracting capacity.
- Build sliding windows using build_instances.
- Train models in the notebooks; Models are saved in saved_models folder.
Results
The table containing performance comparison across different deep learning models is shown below.
| Model | MAE | RMSE | MAPE |
|---|---|---|---|
| Basic LSTM | 0.0442 | 0.0522 | 0.0299 |
| Basic GRU | 0.0234 | 0.0430 | 0.0154 |
| CNN + LSTM | 0.0313 | 0.0478 | 0.0206 |
| Transformer | 0.0281 | 0.0349 | 0.0186 |
and the plots of predicted vs actual capacity is shown below.

Future work
- Integrate uncertainty quantification to improve capacity prediction reliability.
- Expand dataset diversity and explore domain adaptation to improve generalization.
References
https://ieee-dataport.org/documents/lithium-ion-battery-data-set
Authors
- Dharunkumar Senthilkumar
- Dhruvkumar Patel
