machine learning algorithm exercise