Source-linked AI summary

Port-Hamiltonian Neural Networks for Learning Explicit Time-Dependent Dynamical Systems

Shaan Desai, Marios Mattheakis, David Sondak, Pavlos Protopapas, Stephen Roberts

arXiv:2107.08024v1cs.LGnlin.CDphysics.comp-ph

TL;DR

Learning long-term dynamics from state data remains challenging for neural networks, and existing physically informed approaches generally do not handle explicit time dependence together with dissipation. This paper embeds the port-Hamiltonian formulation in a neural network to learn these systems, reporting improved performance and recovery of underlying terms, including in chaotic Duffing dynamics.

  • Problem

    Many real-world systems involve explicit time-dependent forces and energy dissipation, while existing learning methods generally address autonomous systems or systems with a known control signal.

    Source: §I · p. 1
  • Method

    The pHNN embeds the port-Hamiltonian formulation to learn a stationary Hamiltonian, time-varying force, and damping from position, momentum, and time inputs.

    Source: B. Network optimization · p. 3
  • Results

    The pHNN outperforms other approaches across investigated physical systems, recovers Hamiltonian, force, and damping terms, and recovers a chaotic Duffing Poincaré section with minimal training data.

    Source: §V · p. 8, §VI · p. 9
  • Takeaways & Limitations

    The reported chaotic Duffing result suggests pHNN can model chaotic behavior even when trained on only a few points from a chaotic trajectory.

    Source: §2 · p. 8

    In the Duffing setting, state vectors may not identify the Hamiltonian and force separately, allowing a shifted force; reasonable learned terms can still reveal the dynamics.

    Source: §V · p. 8

Abstract

from arXiv · show

Accurately learning the temporal behavior of dynamical systems requires models with well-chosen learning biases. Recent innovations embed the Hamiltonian and Lagrangian formalisms into neural networks and demonstrate a significant improvement over other approaches in predicting trajectories of physical systems. These methods generally tackle autonomous systems that depend implicitly on time or systems for which a control signal is known apriori. Despite this success, many real world dynamical systems are non-autonomous, driven by time-dependent forces and experience energy dissipation. In this study, we address the challenge of learning from such non-autonomous systems by embedding the port-Hamiltonian formalism into neural networks, a versatile framework that can capture energy dissipation and time-dependent control forces. We show that the proposed \emph{port-Hamiltonian neural network} can efficiently learn the dynamics of nonlinear physical systems of practical interest and accurately recover the underlying stationary Hamiltonian, time-dependent force, and dissipative coefficient. A promising outcome of our network is its ability to learn and predict chaotic systems such as the Duffing equation, for which the trajectories are typically hard to learn.

I. INTRODUCTION

Physically informed learning biases improve how neural networks learn and generalize physical dynamics, but the cited approaches do not address explicit time dependence together with damping. The introduction motivates port-Hamiltonian networks as a way to learn such systems and recover their underlying forces and dissipation.

I. INTRODUCTION

  • The paper embeds the port-Hamiltonian formalism in neural networks to learn non-autonomous forced and damped dynamics from position and momentum data.It reports outperforming other approaches, recovering driving force and damping, and visually recovering a chaotic Duffing Poincaré section with minimal data.Source: §I · p. 1

A. Hamiltonian Neural Networks

  • Hamiltonian Neural Networks learn a Hamiltonian from position and momentum and derive dynamics by differentiating it, embedding energy conservation by construction.The cited formulation does not readily generalize to damped or forced time-varying systems.Source: A. Hamiltonian Neural Networks · p. 2

B. Port-Hamiltonian framework

  • The port-Hamiltonian formalism generalizes Hamilton’s equations to include energy dissipation and external control, but prior neural-network use assumed the control input was known.The paper instead targets cases where forcing and damping must be uncovered from state data.Source: B. Port-Hamiltonian framework · p. 2

C. Related Work

  • Existing approaches do not investigate explicit time dependence and damping together, despite both being common in real-world dynamical systems.The introduction identifies this as the gap the paper addresses.Source: C. Related Work · p. 2

III. METHOD

The proposed pHNN replaces the general damping and control terms in the port-Hamiltonian formulation with a state-independent damping parameter and a time-varying force field. It learns these alongside a stationary Hamiltonian, and the paper reports that it outperforms the compared architectures across the investigated applications.

A. Theory

  • The model replaces the general damping matrix with a state-independent term and replaces G(q)u with a time-dependent force field F(t).The formulation is intended to handle forced systems including the Duffing equation.Source: A. Theory · p. 3
  • The pHNN learns a stationary Hamiltonian, damping term, and force term to predict state-time derivatives; the compared baselines add time as an input.The baselines are a standard feed-forward network and a time-dependent HNN.Source: A. Theory · p. 3
  • The pHNN consistently outperforms the compared network architectures across the investigated applications while exposing the system’s Hamiltonian, driving force, and damping.The time-input baseline and time-dependent HNN incorporate time but do not provide this information about the underlying dynamics.Source: A. Theory · p. 3

B. Network optimization

The pHNN is trained using position, momentum, and time, with separate components for the stationary Hamiltonian, damping, and time-varying force. The section describes derivative- and state-based training options and evaluates predictions through integrated test trajectories.

B. Network optimization

  • The pHNN uses [q, p, t] inputs and separate components to learn a stationary Hamiltonian, damping, and time-varying force before predicting state derivatives.The Hamiltonian and force components each have three hidden layers; the damping component has one weight parameter.Source: B. Network optimization · p. 3
  • Training can use state time-derivative data or state data with an embedded RK-4 integrator, and the authors report their method remains the most performant in the latter setting.They use derivative data for the main comparison because HNN is trained that way and they sought a fair comparison.Source: B. Network optimization · p. 4

C. Testing

  • Testing integrates predicted derivatives into state rollouts and compares them with ground truth using state-variable and energy mean squared errors.The testing procedure averages these measures across multiple initial conditions; the benchmark datasets span time-independent systems through chaotic damped and driven systems.Source: C. Testing · p. 4, §IV · p. 4

A. Simple Mass-Spring System

The pHNN nearly matches the HNN on the undamped oscillator and recovers damped dynamics that Hamiltonian-only models struggle to learn. In the damped case, its force and damping estimates are useful despite an identifiability challenge.

A. Simple Mass-Spring System

  • For the undamped oscillator, a separately learned, regularized force improves state and energy predictions over TDHNN and the Baseline NN, nearly matching the standard HNN.Force-recovery error is of order 10^-5 and damping-term error is of order 10^-8.Source: A. Simple Mass-Spring System · p. 4

B. Damped Mass-Spring System

  • State-only inference creates an identifiability challenge between force and damping, and pHNN may learn a non-zero oscillating force while still recovering terms consistent with ground truth.The predicted Hamiltonian and force can leak information into one another.Source: B. Damped Mass-Spring System · p. 5
  • For the damped oscillator, pHNN and the Baseline NN recover dynamics well, while HNN and TDHNN struggle because damping prevents a scalar Hamiltonian description.The predicted damping is indistinguishable from ground truth, and the learned force and damping terms are sufficient for accurate evolution with small numerical error.Source: B. Damped Mass-Spring System · pp. 4–5

C. Forced Mass-Spring System

The forced-oscillator experiments test simple and complex time-dependent forces. The pHNN learns the forcing explicitly, performs best on the simple-force case, and better handles the complex-force case than the baseline network.

C. Forced Mass-Spring System

  • For the simple forced oscillator, pHNN shows the best performance because it explicitly learns a time-dependent force, while standard HNN lacks explicit-time dependence.The system is undamped, and the section also considers a more complex force.Source: C. Forced Mass-Spring System · pp. 5–6
  • For the more complex force, pHNN recovers the ground-truth force precisely and evolves test states better than the other models.Its learned spurious damping contributes only about 10^-5 to dp/dt, which the paper describes as practically negligible.Source: C. Forced Mass-Spring System · p. 6
  • With a simple force, the Baseline NN performs relatively well against pHNN, but the complex force significantly worsens its state and energy MSE.The forced-oscillator setting is used to study resonance and has applications including material science, music, bridge design, and molecular excitation.Source: C. Forced Mass-Spring System · pp. 5–6

D. Duffing Equation

The Duffing equation extends the oscillator setting with a nonlinear potential, time-varying forcing, and damping. Parameter choices determine whether its dynamics are chaotic.

D. Duffing Equation

  • The Duffing system adds a quadratic function of position, making its potential non-harmonic and tunable between single-well and double-well shapes.The potential shape depends on coefficients α and β.Source: D. Duffing Equation · p. 6
  • The general Duffing equation includes a time-varying force and damping proportional to the derivative of the stationary Hamiltonian with respect to position.Source: D. Duffing Equation · p. 6
  • Different choices of α, β, δ, γ, and ω produce chaotic or non-chaotic behavior, and the system is used to study phenomena including frequency hysteresis and chaos.Source: D. Duffing Equation · p. 6

1. Non-Chaotic regime

The pHNN recovers the non-chaotic Duffing system’s force, damping, and stationary Hamiltonian, outperforming the other tested models. In the chaotic regime, its predicted Poincaré section is closer to ground truth than the baseline’s, even with sparse trajectory data.

1. Non-Chaotic regime

  • In the non-chaotic regime, pHNN significantly outperforms the other methods and extracts the ground-truth force and damping coefficient.It also learns the stationary Hamiltonian’s functional form and outperforms other architectures on that representation.Source: §1 · pp. 6–7

2. Chaotic regime

  • The chaotic-regime model is trained on 20 initial conditions and 2000 points, while the trajectory’s sensitivity to initial conditions makes learning harder than in the non-chaotic regime.Source: §2 · p. 7

1. Non-Chaotic regime

  • For non-chaotic Duffing, HNN and TDHNN learn distorted Hamiltonians that depend strongly on time, whereas pHNN recovers a non-distorted Hamiltonian.Source: §2 · p. 8

2. Chaotic regime

  • For chaotic Duffing, the Poincaré-section histogram MSE is 1.61 for pHNN and 4.05 for bNN, and the pHNN section is visually closer to ground truth.The comparison uses an unseen initial condition rolled out to Tmax = 18000; prior knowledge of the forcing period is used to extract the section, not to train beyond one period.Source: §2 · pp. 7–8, §1 · p. 7

E. Relativistic System

The relativistic driven Duffing experiment tests pHNN beyond non-relativistic classical mechanics. The discussion and conclusion report recovery of system components across challenging settings, while noting identifiability and training-horizon qualifications.

E. Relativistic System

  • In the relativistic test, the rest mass was set to m0 = 1, though the framework naturally accounts for other values.The speed of light was typically set to 1.Source: E. Relativistic System · p. 8
  • pHNN recovered the underlying force and outperformed other architectures on unseen initial conditions for a relativistic driven Duffing system.The experiment also reports that pHNN can discover dynamics independent of the underlying Hamiltonian’s form.Source: E. Relativistic System · p. 8

V. DISCUSSION

  • For Duffing with force and damping, q and p may not identify the Hamiltonian and force simultaneously, allowing a shifted learned force.The authors report that reasonable force and damping terms are generally sufficient to reveal the underlying dynamics.Source: §V · p. 8
  • Although prediction may be constrained to the training horizon, periodic forcing can be inspected to learn its period and renormalize time for beyond-horizon integration.The paper points to a Poincaré map as an example.Source: §V · p. 8
  • pHNN outperformed other methods with noisy input state vectors and performed best in a two-body coupled-spring test with one forced mass.The two-body result is described as suggesting potential to scale to larger domains.Source: §V · p. 8

VI. CONCLUSION

  • Across numerous settings, pHNN extended beyond simple mass-spring dynamics to nonlinear forced and damped systems and recovered a chaotic driven system’s Poincaré section with minimal training data.On the simple mass-spring system, its performance was comparable to HNN.Source: §VI · p. 9

Appendix A: Hyperparameters

The appendix describes selection of regularization coefficients, the pHNN training and evaluation pipeline, and why damping is not incorporated into a scalar Hamiltonian for the considered system.

Appendix A: Hyperparameters

  • The regularization coefficients λF and λN were selected by a grid search over [10^-2, 10^-4, 10^-6, 10^-8] for each coefficient, choosing the lowest validation loss.The search is described as taking place across log-space values.Source: Appendix A · p. 11

Appendix B: Pipeline

  • The pHNN pipeline uses ground-truth states and time derivatives to learn a Hamiltonian, force, and damping term, then integrates test initial conditions and evaluates MSE.Training minimizes Eq. (5); performance is assessed with the MSE functions in Eqs. (6) and (7).Source: Appendix B · p. 11

Appendix C: Damped Hamiltonians

  • For the damped system, the appendix argues that damping violates energy conservation, so a scalar Hamiltonian cannot be written for that system.It starts from p = m qdot and describes integrating the right-hand side with respect to q to obtain a modified potential-like function.Source: Appendix C · p. 12

Appendix D: Results

Appendix D presents rollout errors and learned Hamiltonian, force, and damping visualizations across mass-spring and Duffing systems. The supplied passages identify the figures but provide few detailed outcomes.

Appendix D: Results

  • Each system’s test rollout plots MSE over time for a single test initial condition.The figure sequence covers mass-spring, damped and forced mass-spring, and Duffing cases.Source: Appendix D · p. 13
  • Figure 2 presents the simple mass-spring system, with panels identifying learned Hamiltonian and force/damping visualizations.The supplied passages do not specify the figure’s outcome.Source: Figure 2 · p. 13, Appendix D · p. 18
  • Figure 3 presents the damped mass-spring system, with learned Hamiltonian and force/damping visualizations.The supplied passages do not specify the figure’s outcome.Source: Figure 3 · p. 14, Appendix D · p. 15
  • Figure 6 is labeled as the non-chaotic Duffing equation, and its associated panel describes learned Hamiltonian across methods.The supplied passages do not specify the figure’s outcome.Source: Figure 6 · p. 17, Appendix D · pp. 17–18
  • Figure 7 is labeled Relativistic Duffing, with an associated panel describing learned force and damping.The supplied passages do not specify the figure’s outcome.Source: Figure 7 · p. 18, Appendix D · p. 18

Appendix E: Tabularized Results

The appendix provides tabularized state- and energy-error results, describes an input-noise robustness study, and reports an additional two-body coupled-spring experiment.

Appendix E: Tabularized Results

  • Table I reports state and energy MSE for methods averaged across 25 initial test points.The supplied passage gives the table’s scope but no cell values.Source: Table I · p. 19, Appendix E · p. 19
  • Table II reports state and energy MSE for each method using an embedded RK4 integrator.The supplied passage gives the table’s scope but no cell values.Source: Table II · p. 19

Appendix F: Results with Noise

  • The noise study adds Gaussian input noise with standard deviation σ = 0.1 during HNN training to promote robustness, then tests robustness to noisy inputs.Source: Appendix F · p. 19

Appendix G: 2 body coupled spring system

  • The two-body coupled-spring experiment applies a cos(t) driving force to one mass, and its figure caption says pHNN performs best, with bNN performing similarly.Results are reported for an embedded integrator.Source: Appendix G · pp. 19, 21, Figure 9 · p. 21
Loading 2107.08024v1…