Linear Regression code and report

Programming Assignment: Linear Regression

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

Total points: 100
Note: This assignment is for each individual student to complete on his or her
own.
In this assignment, you will implement linear regression by using both normal
equations and the gradient descent. To get started, you will need to download the
starter code and unzip its contents to the directory where you wish to complete the
assignment.
The problem considered in this assignment is to predict the price of a house using
the real estate valuation data
set (included in the code folder) downloaded from
https://archive.ics.uci.edu/ml/datasets/Real+estat…
You are required to use three input features to build the linear regression model:
1) X2=the house age
2) X3=the distance to the nearest MRT station (unit:degree)
3) X4=the number of convenience stores in the living circle on foot (integer).
When implementing normal equations, you are required the complete the following
steps:1. Split the dataset into two, one for training (70%) and another one for testing
(30%).
2. Use normal equations and the training data to estimate parameters in the linear
regression model3. Evaluate the performance of the model on the testing data4. Predict the price of a house that is 2 years old, 500 meters to the nearest MRT
station, and has 8 convenience stores in the living circle
When implementing gradient descent, you are required to complete the following
steps:

1. Normalize input features so that the mean value of each feature is 0 and the
standard deviation is 1.
2. Run gradient descent to learn the linear regression model using the training
data3. Evaluate the performance of the model on the testing data4. Predict the price of a house that is 2 years old, 500 meter to the nearest
MRT station, and has 8 convenience stores in the living circle
To get started, first open the main script
assignmentLinearR.m
. You are
required to modify this script as well as all the other six scripts, including
• loadData.m –
Function to load and split the dataset into training and
testing sets
• normalEqn.m
– Function to compute the normal equations
• evaluateAccuracy.m
– Function to evaluate the performance of the
linear regression model• featureNormalize.m
– Function to normalize features
• computCost.m –
Function to compute the cost
• gradientDescent.m
– Function to run gradient descent
You can download Matlab by following the instructions provided in this link:
https://library.sdsu.edu/computers-technology/soft…
What to submit?
A zip file that includes the following items:
1) All codes (85 points)
a. Part 1: Normal Equations (15 points)
b. Part 2: Evaluate Performance (15 points)
c. Part 3: Feature Normalization (15 points)
d. Part 4: Gradient Descent (40 points)
2) A report that includes (15 points):

a. (5 points) All results displayed by the fprintf() function (e.g.,
parameter values, predicted house prices, and prediction errors).
Specify the values of the hyperparameters you used.
b. (5 points) Change the learning rate and analyze the results.
Explain the impact of the learning rate.
c. (5 points) Describe what have gone well and what have not gone
well during the implementation. Also describe how your current
implementation can be potentially improved to achieve better
performance.

Programming Assignment: Linear Regression
Total points: 100
Note: This assignment is for each individual student to complete on his or her
own.
In this assignment, you will implement linear regression by using both normal
equations and the gradient descent. To get started, you will need to download the
starter code and unzip its contents to the directory where you wish to complete the
assignment.
The problem considered in this assignment is to predict the price of a house using
the real estate valuation data set (included in the code folder) downloaded from
https://archive.ics.uci.edu/ml/datasets/Real+estate+valuation+data+set
You are required to use three input features to build the linear regression model:
1) X2=the house age
2) X3=the distance to the nearest MRT station (unit:degree)
3) X4=the number of convenience stores in the living circle on foot (integer).
When implementing normal equations, you are required the complete the following
steps:
1. Split the dataset into two, one for training (70%) and another one for testing
(30%).
2. Use normal equations and the training data to estimate parameters in the linear
regression model
3. Evaluate the performance of the model on the testing data
4. Predict the price of a house that is 2 years old, 500 meters to the nearest MRT
station, and has 8 convenience stores in the living circle
When implementing gradient descent, you are required to complete the following
steps:
1. Normalize input features so that the mean value of each feature is 0 and the
standard deviation is 1.
2. Run gradient descent to learn the linear regression model using the training
data
3. Evaluate the performance of the model on the testing data
4. Predict the price of a house that is 2 years old, 500 meter to the nearest
MRT station, and has 8 convenience stores in the living circle
To get started, first open the main script assignmentLinearR.m. You are
required to modify this script as well as all the other six scripts, including
• loadData.m – Function to load and split the dataset into training and
testing sets
• normalEqn.m – Function to compute the normal equations
• evaluateAccuracy.m – Function to evaluate the performance of the
linear regression model
• featureNormalize.m – Function to normalize features
• computCost.m – Function to compute the cost
• gradientDescent.m – Function to run gradient descent
You can download Matlab by following the instructions provided in this link:
https://library.sdsu.edu/computers-technology/software/matlab
What to submit?
A zip file that includes the following items:
1) All codes (85 points)
a. Part 1: Normal Equations (15 points)
b. Part 2: Evaluate Performance (15 points)
c. Part 3: Feature Normalization (15 points)
d. Part 4: Gradient Descent (40 points)
2) A report that includes (15 points):
a. (5 points) All results displayed by the fprintf() function (e.g.,
parameter values, predicted house prices, and prediction errors).
Specify the values of the hyperparameters you used.
b. (5 points) Change the learning rate and analyze the results.
Explain the impact of the learning rate.
c. (5 points) Describe what have gone well and what have not gone
well during the implementation. Also describe how your current
implementation can be potentially improved to achieve better
performance.

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper
Are you stuck with your online class?
Get help from our team of writers!

Order your essay today and save 20% with the discount code RAPID