Data-driven discovery and model reduction of complex systems