Learning Short-Term and Long-Term Patterns of High-Order Dynamics in Real-World Networks