Learning the Electrochemistry of Degradation and Safety in Graphite Porous Electrodes for Lithium-ion Batteries