Programming exercise for the ML class by Andrew Ng