Machine learning for predicting fuel cell and battery polarisation and charge–discharge curves