4th exercises in Stanford Machine Learning coursera