SMS: Statistical Mechanics of Learning