Resumen: We develop a method to learn physical systems from data that employs feedforward neural networks and whose predictions comply with the first and second principles of thermodynamics. The method employs a minimum amount of data by enforcing the metriplectic structure of dissipative Hamiltonian systems in the form of the so-called General Equation for the Non-Equilibrium Reversible-Irreversible Coupling, GENERIC (Öttinger and Grmela (1997) [36]). The method does not need to enforce any kind of balance equation, and thus no previous knowledge on the nature of the system is needed. Conservation of energy and dissipation of entropy in the prediction of previously unseen situations arise as a natural by-product of the structure of the method. Examples of the performance of the method are shown that comprise conservative as well as dissipative systems, discrete as well as continuous ones. Idioma: Inglés DOI: 10.1016/j.jcp.2020.109950 Año: 2021 Publicado en: Journal of Computational Physics 426, 109950 (2021), [16 pp.] ISSN: 0021-9991 Factor impacto JCR: 4.645 (2021) Categ. JCR: PHYSICS, MATHEMATICAL rank: 3 / 56 = 0.054 (2021) - Q1 - T1 Categ. JCR: COMPUTER SCIENCE, INTERDISCIPLINARY APPLICATIONS rank: 40 / 112 = 0.357 (2021) - Q2 - T2 Factor impacto CITESCORE: 7.1 - Physics and Astronomy (Q1) - Mathematics (Q1) - Computer Science (Q1)