Exercise from Coursera's Machine Learning.