Exercise 2 of Coursera Machine Learning Course