Low-dimensional models of complex systems using principal interaction patterns