Neuronal diversity can improve machine learning for physics and beyond