Battery State of Health (SoH) Prediction - LSTM Model
Overview
LSTM-based model for predicting the State of Health (SoH) of electric vehicle batteries.
Architecture based on:
- CyclePatch-LSTM (BatteryLife, arxiv 2502.18807) - cycle-level tokenization
- EVBattery (arxiv 2201.12358) - real EV capacity estimation
Architecture
- Intra-cycle encoder: 2-layer FFN with LayerNorm (captures within-cycle patterns)
- Inter-cycle LSTM: 2-layer, 128 hidden units (captures cross-cycle degradation dynamics)
- Prediction head: 3-layer MLP with Sigmoid output
Performance (Test Set)
| Metric | Value |
|---|---|
| MAE | 0.005013 |
| RMSE | 0.006177 |
| MAPE | 0.51% |
| R² | 0.8846 |
Input Features (8 per cycle)
- Average discharge voltage
- Charge capacity
- Average temperature
- Internal resistance
- Charge time ratio
- Voltage drop at end of discharge
- Coulombic efficiency
- Normalized cycle number
Usage
import torch
import json
from model import BatterySoHLSTM
# Load model
checkpoint = torch.load('battery_soh_lstm.pt', map_location='cpu')
config = checkpoint['config']
model = BatterySoHLSTM(
n_features=config['n_features'],
embed_dim=config['embed_dim'],
intra_layers=config['intra_layers'],
lstm_hidden=config['lstm_hidden'],
lstm_layers=config['lstm_layers'],
dropout=config['dropout'],
bidirectional=config['bidirectional']
)
model.load_state_dict(checkpoint['model_state_dict'])
model.eval()
# Predict SoH from 20 consecutive cycles of features
# Input: (batch, 20, 8) - 20 cycles, 8 features each
x = torch.randn(1, 20, 8) # replace with real data
with torch.no_grad():
soh = model(x)
print(f"Predicted SoH: {soh.item():.4f}")
Training Configuration
- Optimizer: Adam (lr=1e-3, weight_decay=1e-4)
- Scheduler: ReduceLROnPlateau (factor=0.5, patience=5)
- Early stopping: patience=15
- Batch size: 64
- Data: 150 batteries, split by battery ID (no data leakage)
References
- BatteryLife: A Comprehensive Dataset and Benchmark (arxiv 2502.18807)
- EVBattery: Large-Scale EV Dataset (arxiv 2201.12358)
- BatteryML: An Open-Source Platform (arxiv 2310.14714)
- Downloads last month
- 3
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support