EV Battery Health Prediction
Intelligent predictive maintenance system using machine learning to forecast State of Health and Remaining Useful Life of lithium-ion batteries in electric vehicles
Project Mission
Core Objective
Predict battery State of Health within ±5% absolute error on unseen data
RUL Forecasting
Estimate Remaining Useful Life with >90% recall for failure detection
Production Pipeline
Build scalable, deployable ML system for real-world applications
The project addresses critical challenges in EV battery management by leveraging supervised, unsupervised, and reinforcement learning paradigms across NASA's comprehensive battery aging dataset.
The Challenge
Problem Statement
Lithium-ion battery degradation in electric vehicles is non-linear and complex. Predicting State of Health and forecasting Remaining Useful Life requires parsing complex sensor data and engineering meaningful features from raw measurements.
Traditional approaches lack the precision needed for proactive maintenance strategies that could prevent unexpected failures and optimize battery lifespan.
Technical Barriers
  • Complex nested MATLAB data structures requiring sophisticated parsing
  • Non-linear degradation patterns difficult to model
  • High-dimensional sensor data with hidden correlations
  • Need for real-time prediction capabilities
  • Engineering-grade accuracy requirements
Contents Preview
Explore the comprehensive journey of our EV Battery Health Prediction project, from data foundations to deployment and future impact.
1
Data Foundation & Exploration
Establish robust data pipelines and analyze battery behavior.
2
Feature Engineering & Selection
Transform raw data into meaningful inputs for predictive models.
3
Model Architecture Overview
Introduction to supervised, deep, and unsupervised learning approaches.
4
Supervised Learning Results
Performance of initial models for SOH and RUL prediction.
5
Deep Learning Performance
Advanced neural network models for enhanced accuracy.
6
Unsupervised Learning Insights
Discover hidden patterns and anomalies in battery data.
7
Reinforcement Learning & Explainability
Strategies for optimal battery management and model interpretation.
8
Technical Achievements & Deployment
Key project milestones and architecture for production.
9
Impact & Future Directions
Vision for sustainable EV battery lifecycle management.
Data Foundation
1
Dataset Acquisition
NASA Prognostics Center of Excellence battery aging data featuring Li-ion 18650 batteries (B0005, B0006, B0007, B0018) with complete charge, discharge, and impedance measurements in MATLAB format.
2
Data Pipeline Engineering
Built robust pipeline to extract nested structures, flatten time-series data, and aggregate cycle-level metrics including voltage, current, temperature, and capacity measurements.
3
Feature Engineering
Derived physics-based features like voltage drop and temperature increase as powerful degradation indicators. Created cumulative capacity calculations from raw sensor readings.
Data Storage: Amazon S3 Foundation
Amazon S3 serves as the standard, highly scalable, and durable storage area for all raw and processed battery data within the project. This robust foundation is critical for managing the vast datasets involved in EV battery health prediction, ensuring data integrity and accessibility throughout the machine learning pipeline.
Scalability
Designed to handle petabytes of data, easily accommodating the project's ever-growing historical and real-time battery datasets without capacity limitations.
Durability & Security
Offers 99.999999999% data durability and robust security features, ensuring that critical battery data is always protected and available for analysis.
Seamless Integration
Facilitates easy integration with AWS computing and analytics services, streamlining data pipelines for feature engineering, model training, and deployment.
Understanding Battery Fundamentals
Exploratory Data Analysis
Comprehensive analysis revealed fundamental degradation patterns and validated feature selection for predictive modeling.
01
Capacity Degradation Analysis
Plotted capacity fade curves showing characteristic "knee point" where degradation accelerates
02
Correlation Discovery
Strong negative correlation (-0.88) between cycle number and capacity; strong positive correlation (0.89) between voltage and capacity
03
Knee Point Detection
Identified critical cycles where rapid degradation begins: B0005 at cycle 13, B0006 at cycle 13, B0007 at cycle 9, B0018 at cycle 17
Correlation Analysis: Key Insights
The correlation heatmap reveals critical relationships with battery capacity (capacity_Ah):
  • Cycle Number (-0.9): Strong negative correlation confirms fundamental aging—more cycles = lower capacity. Primary degradation trend.
  • Average Voltage (+0.8): Strong positive correlation shows healthier batteries maintain higher voltage. Direct SoH indicator.
  • Average Temperature (moderate negative): Higher temps signal degradation as internal resistance increases with age.
Feature Selection Conclusion: cycle, avg_voltage_measured, and avg_temp_measured are highly predictive features for SoH and RUL modeling.
Data Quality Validation
Outlier Detection Results
Applied both Z-score (|z| > 3) and IQR methods to ensure data integrity.
Z-score method: 3 minor outliers detected (0.47% of data)
IQR method: 9 outliers detected (1.42% of data)
All outliers belonged to battery B0006 at end-of-life cycles, representing natural behavior rather than measurement errors.
Data Quality Metrics
99.5%
Clean Data
Percentage of data points passing quality checks
<5%
Missing Data
Well within engineering-grade requirements
Box Plots – Feature Distribution Overview
  • Box – Interquartile Range (IQR) | Middle 50% of Data (P25–P75)
  • Center Line – Median | 50th Percentile
  • Whiskers – Data Range | Up to 1.5× IQR
  • Dots – Outliers | Values Beyond Whiskers
Feature Engineering Strategy
Voltage-Based Features
Delta_V: Voltage drop from start to end of discharge. Larger drops indicate higher internal resistance and degradation progression.
Temperature Features
Delta_T: Temperature increase during discharge. Rising temperatures signal increased internal resistance from aging.
Time-Based Features
Discharge_Time: Total cycle duration. Shorter times for same load indicate reduced capacity and health decline.
Model Architecture Overview
Implemented comprehensive machine learning strategy spanning supervised learning, deep learning, unsupervised clustering, and reinforcement learning approaches.
1
Supervised Learning
Random Forest and XGBoost for baseline SoH prediction
2
Deep Learning
LSTM and GRU networks for time-series modeling
3
Unsupervised Learning
K-means clustering for degradation pattern discovery
4
Reinforcement Learning
Q-learning for charging optimization
Supervised Learning Results
Random Forest and XGBoost delivered exceptional baseline performance, significantly exceeding project accuracy targets.
Both models exceeded the ±5% error target by substantial margins. Random Forest emerged as the top traditional ML model with highest R² and lowest RMSE.
Model Performance Comparison
Summary of Model Performance
Both supervised learning models, Random Forest and XGBoost, demonstrate exceptional performance in predicting EV battery State of Health, meeting and exceeding project accuracy targets.
Exceptional Overall Accuracy
With R² scores of 0.937 for Random Forest and 0.928 for XGBoost, the models explain approximately 93-94% of the variance in battery State of Health, validating feature effectiveness.
Random Forest: The Slight Winner
Random Forest demonstrated marginally superior performance across all metrics, with a lower RMSE (0.0206 vs. 0.0220) and MAE (0.0170 vs. 0.0176), indicating more precise predictions.
Project Goals Achieved
Both models comfortably surpassed the project's primary objective of predicting SoH within a ±5% absolute error, achieving MAEs of 1.70% (RF) and 1.76% (XGBoost).
The Random Forest Regressor is identified as the top-performing baseline model for its slightly higher accuracy on unseen test data (battery B0018).
Deep Learning Architecture
LSTM Network Design
  • Sequential architecture with time-step windows
  • 64-unit and 32-unit LSTM layers with dropout
  • Captures long-term dependencies in degradation
  • Memory gates retain critical historical patterns
  • Trained on 50 epochs with validation monitoring
GRU Network Design
  • Simplified gating mechanism vs LSTM
  • 128-unit and 64-unit GRU layers with dropout
  • Faster training with fewer parameters
  • Update and reset gates for efficiency
  • Reduced overfitting through architecture
Deep Learning Performance
GRU emerged as the champion deep learning model with superior consistency across different battery chemistries and degradation patterns.
GRU demonstrated remarkable consistency, maintaining strong performance across challenging test cases where LSTM struggled significantly.
Model Performance Champion
GRU Network
Best Overall Model
Lowest MAE: 1.50% | Most Consistent: R² 0.79-0.93 across batteries
Why GRU Wins
Sequential data understanding combined with computational efficiency and reduced overfitting tendency
Random Forest: Runner-Up
Highest R² (0.9367) with excellent interpretability for traditional ML applications
Production Recommendation
Deploy GRU as primary model with Random Forest as interpretable baseline
Unsupervised Learning Insights
K-means clustering revealed natural degradation stages without labeled training data, validating the progression from healthy to degraded states.
2
Optimal Clusters
Identified via silhouette score analysis
73%
Late Stage SoH
Average health in degraded cluster
90%
Early Stage SoH
Average health in healthy cluster
Clustering separated batteries into healthy (early-life, high voltage, low temperature) and degraded (late-life, low voltage, elevated temperature) stages, confirming feature engineering choices.
Reinforcement Learning Application
Q-learning agent optimized charging strategies to maximize State of Charge gain while minimizing thermal stress and preventing overvoltage conditions.
01
Environment Design
Data-driven battery simulation with realistic voltage curves and thermal dynamics from real charging cycles
02
Reward Shaping
Balanced rewards for charge gain against penalties for overheating, overvoltage, and excessive time
03
Policy Learning
2000 episodes with epsilon-greedy exploration converged to stable charging strategy
04
Optimized Protocol
Pulse charging pattern alternating high current for speed with low current for thermal recovery
RL Training Convergence – Key Insights
Training Phases
  • Initial (0–50 Episodes): Low rewards, random actions, frequent penalties
  • Learning (50–200 Episodes): Rapid improvement, unsafe behavior eliminated
  • Convergence (200–2000 Episodes): Stable rewards (~170–185), no drift
Model Interpretation
Stable, repeatable policy with aligned reward shaping and bounded variance—healthy learning dynamics.
Optimized Charging Profile Plot – Key Takeaways
Current Pattern
  • Bang–Bang Control Strategy
  • Low Current (≈0–0.5 A) | High Current (≈4 A)
  • Minimal Mid-Range Current Usage
  • Square-Wave / Pulsed Profile
Control Interpretation
  • High Current – Maximum SoC Gain
  • Low Current – Thermal Recovery
  • Medium Current – Lower Reward Efficiency
Model Explainability with SHAP
SHAP analysis revealed which features drive predictions and how they influence battery health estimates, providing critical transparency for engineering decisions.
1
Cycle Number
Most influential feature showing strong negative impact as cycles increase, validating fundamental aging relationship
2
Average Voltage
Second most important with positive correlation to SoH reflecting capacity retention
3
Temperature
Moderate influence indicating thermal stress contribution to degradation
4
Current
Lowest direct impact but important for interaction effects with other features
Key Technical Achievements
Accuracy Excellence
MAE of 1.50% significantly exceeds ±5% target specification by 70%, demonstrating production-grade precision
Cross-Battery Robustness
GRU maintained R² above 0.79 across different batteries with varying degradation patterns and chemistries
Feature Validation
Correlation analysis and SHAP explainability confirmed cycle, voltage, and temperature as critical predictors
Data Pipeline
Robust engineering pipeline successfully parsed complex MATLAB structures and aggregated multi-scale measurements
Production Deployment Architecture
Built scalable cloud-based system ready for real-world EV fleet management applications.
Infrastructure Components
  • AWS S3 bucket for model and data storage
  • Automated data ingestion pipeline
  • MinMax scaler for feature normalization
  • Joblib serialization for ML models
  • Keras format for deep learning models
  • Version control for model iterations
Deployed Models
  • GRU network (primary predictor)
  • Random Forest (interpretable baseline)
  • XGBoost (ensemble alternative)
  • LSTM network (sequential backup)
  • Feature scaler (preprocessing)
  • Q-learning agent (charging optimizer)
Project Impact and Future Directions
Immediate Impact
Enables predictive maintenance strategies preventing unexpected EV battery failures and optimizing replacement timing
Cost Reduction
Accurate SoH prediction reduces warranty costs and extends battery service life through optimized usage patterns
Safety Enhancement
Early degradation detection prevents thermal runaway risks and catastrophic failures in deployed fleets
Next Steps: Validate RUL forecasting on complete run-to-failure datasets. Deploy ensemble approach combining GRU with Random Forest for maximum robustness. Integrate real-time streaming data for live fleet monitoring.
Executive Summary
This project demonstrates that accurate EV battery health prediction is not only feasible but achievable at production-grade precision levels.
1.50%
Champion MAE
GRU model error rate
70%
Target Exceeded
Beyond ±5% specification
93%
R² Performance
Variance explained
4
Model Types
Comprehensive approach
The GRU network emerged as the champion model with lowest error and highest consistency, while Random Forest provides excellent interpretability. Both significantly exceed project accuracy targets and are ready for production deployment in EV fleet management systems.