Predicting battery capacity from impedance at varying temperature and state of charge using machine learning