Machine learning for cosmic explosions