Thermodynamic machine learning through maximum work production. (1st August 2022)