Coursera ML Assignment 1 Part 1

April 20, 2015
This is assignment 1 part 1 for ML course by Andrew Ng.
This is part of [Introduction to ML]( course by Andrew Ng on coursera using ex1data1.txt. This assignment is done in R using the formulas suggested as part of the assignment. This assignment also tries to predict using linear regression algorithm built in Azure ML. Since algorithms in R are using the exact same approach as highlighted in the course, answers match with the results shown in the course. While the built-in algorithms are more optimized for practical applications, answers don't match exactly with the results shown in the course. The overall experiment is shown below. In the experiment, left-hand side is using the built-in Azure algorithms while right-hand side of the graph is using R-scripts to create gradient descent based linear regression algorithm. ![]( The first part of the assignment requires a plot of the input data to observe any correlation that may be easy to discern. ![]( The second part of the assignment is to write a cost function and gradient descent function using cost function to find the feature weights Theta. The output of this function is the theta matrix. ![]( The last part of the assignment is to write a predict function that uses given input data and theta computed in the previous step to predict the profit based on the population. ![]( ## Additional References Part II of this assignment is located [here]( Created by a Microsoft Employee