  Recently, there has been an increasing interest in modelling and computation
of physical systems with neural networks. Hamiltonian systems are an elegant
and compact formalism in classical mechanics, where the dynamics is fully
determined by one scalar function, the Hamiltonian. The solution trajectories
are often constrained to evolve on a submanifold of a linear vector space. In
this work, we propose new approaches for the accurate approximation of the
Hamiltonian function of constrained mechanical systems given sample data
information of their solutions. We focus on the importance of the preservation
of the constraints in the learning strategy by using both explicit Lie group
integrators and other classical schemes.
