Machine Learning HW#6 solution