Machine Learning and Statistical Mechanics I