Here we will implement linear regression with one variable to predict profits for a food truck. Suppose you are the CEO of a restaurant franchise and are considering different cities for opening a new outlet. The chain already has trucks in various cities and you have data for profits and populations from the cities.
Here we will implement linear regression with one variable to predict profits for a food truck. Suppose you are the CEO of a restaurant franchise and are considering different cities for opening a new outlet. The chain already has trucks in various cities and you have data for profits and populations from the cities.
You would like to use this data to help you select which city to expand to next.The file ex1data1.txt contains the dataset for our linear regression problem. The first column is the population of a city and the second column is the profit of a food truck in that city. There are 97 sample are available to train the model. A negative value for profit indicates a loss.
Here we used 97 training example to train the model, and used Batch Gradient Descent as Otimizer over 5000 iteration to get optimized theta(paramer/weight).
Here some sample of training dataset.
6.1101 | 17.592 |
5.5277 | 9.1302 |
8.5186 | 13.662 |
7.0032 | 11.854 |
5.8598 | 6.8233 |
Important liraries.