Uploaded transformer custom model for battery capacity prediction
Browse files- B0018_transformer.png +0 -0
- README.md +47 -3
- artifacts_v1.zip +3 -0
- transformer.ipynb +0 -0
B0018_transformer.png
ADDED
|
README.md
CHANGED
|
@@ -1,3 +1,47 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Battery health prediction using machine learning models
|
| 2 |
+
|
| 3 |
+
This repository contains experiments and utilities for predicting battery capacity / remaining useful life (RUL) using deep learning models under the course SSY340 - Deep Machine Learning, Chalmers University.
|
| 4 |
+
|
| 5 |
+
## Project description
|
| 6 |
+
Developed deep learning models based on LSTM, GRU, CNN–LSTM, and 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.
|
| 7 |
+

|
| 8 |
+
|
| 9 |
+
## Repository structure
|
| 10 |
+
- [models.ipynb](models.ipynb) — Contains code for data processing, model architecture, training and evaluation for LSTM, GRU and CNN-LSTM hybrid models.
|
| 11 |
+
- [transformer.ipynb](transformer.ipynb) — Contains code for data processing, model architecture, training and evaluation for transformer based model.
|
| 12 |
+
- [dataset/](dataset/) — original .mat files (B0005, B0006, B0007, B0018) and precomputed [NASA.npy](dataset/NASA.npy).
|
| 13 |
+
- [data/NASA/](data/NASA/) — raw CSVs extracted from [dataset/](dataset) used by the pipeline for LSTM, GRU and CNN-LSTM hybrid.
|
| 14 |
+
|
| 15 |
+
## Requirements
|
| 16 |
+
Install core Python packages used by the notebooks:
|
| 17 |
+
```sh
|
| 18 |
+
pip install numpy pandas scipy scikit-learn matplotlib torch transformers
|
| 19 |
+
```
|
| 20 |
+
|
| 21 |
+
## Typical workflow
|
| 22 |
+
- Load raw .mat from dataset/ for transformer model or CSV data from data/NASA/ for LSTM, GRU and CNN-LSTM hybrid models.
|
| 23 |
+
- Extract sequences with utility functions involving extracting capacity.
|
| 24 |
+
- Build sliding windows using build_instances.
|
| 25 |
+
- Train models in the notebooks; Models are saved in saved_models folder.
|
| 26 |
+
|
| 27 |
+
## Results
|
| 28 |
+
The table containing performance comparison across different deep learning models is shown below.
|
| 29 |
+
| Model | MAE | RMSE | MAPE |
|
| 30 |
+
|-------------|-------|-------|-------|
|
| 31 |
+
| Basic LSTM | 0.0442 | 0.0522 | 0.0299 |
|
| 32 |
+
| Basic GRU | 0.0234 | 0.0430 | 0.0154 |
|
| 33 |
+
| CNN + LSTM | 0.0313 | 0.0478 | 0.0206 |
|
| 34 |
+
| Transformer | 0.0281 | 0.0349 | 0.0186 |
|
| 35 |
+
|
| 36 |
+
and the plots of predicted vs actual capacity is shown below.
|
| 37 |
+

|
| 38 |
+
|
| 39 |
+

|
| 40 |
+
|
| 41 |
+
## Future work
|
| 42 |
+
- Integrate uncertainty quantification to improve capacity prediction reliability.
|
| 43 |
+
- Expand dataset diversity and explore domain adaptation to improve generalization.
|
| 44 |
+
|
| 45 |
+
### Authors
|
| 46 |
+
- Dharunkumar Senthilkumar
|
| 47 |
+
- Dhruvkumar Patel
|
artifacts_v1.zip
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:f4a9b98bac0b8640747d811f6b5508db40cbf5a1b8eb900f495264cb56b36acf
|
| 3 |
+
size 1235744
|
transformer.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|