An application of canonical ensemble formulation of statistical physics for learning from data problems