Sie sind auf Seite 1von 2

Homework 1

Release Date: February 9, 2018 - Due Date: February 23 , 2018 at 5:00 pm

You are required to form groups of 3 for this Lab assignment. Please email your group
member to Mr. Abdallah Moubayed (amoubaye@uwo.ca). Do not show your code to any
other student and do not look at any other student's code. Do not put your code in any public
domain. Due to the large enrollment in this course we will not be able to answer questions by
email. This assignment has 2 parts.
When you complete your assignment, p le ase submit the r e p o r t a n d t h e source code
using OWL. Although this is a programming assignment, you must comment the code so
that it can be read and understood by another programmer that is not necessarily
experienced with M a t la b o r Python (you may use Matlb or Python for this homework).

Part 1: Linear Regression with one feature


Download Dataset-HW01-Part-01.xlsx, and extract the files from the zip file. The files contain some
example measurements of power demands in the Emirates of Sharjah in United Arab Emirates The y-
values are the power generated measured in MW, and the x-values are the temperatures corresponding
to the power generated.

Each power generated and temperature tuple constitutes one training example in our dataset. There
are training examples, and you will use them to develop a linear regression model.

Supervised learning problem

In this problem, you'll implement linear regression using gradient descent.

Now, we will implement linear regression for this problem. Recall that the linear regression model is

and the batch gradient descent update rule is

1. Implement gradient descent using a small value of the learning rate. Initialize the parameters to
, and run one iteration of gradient descent from this initial starting point. Record the value
of 𝜃0 𝑎𝑛𝑑 𝜃1 that you get after this first iteration
2. Continue running gradient descent for more iterations until 𝜃 converges. After convergence,
record the final values of 𝜃0 𝑎𝑛𝑑 𝜃1 that you get.

1
When you have found 𝜃 , plot the straight line fit from your algorithm on the same graph as your
training data.

Understanding 𝑱(𝜽)

We'd like to understand better what gradient descent has done, and visualize the relationship between
the parameters and 𝜃 ∈ 𝑅 2 𝑎𝑛𝑑 𝐽(𝜃). In this problem, you have to plot 𝐽(𝜃) as a 3D surface plot.

Part 2: Linear Regression with multiple features


Download Dataset-HW01-Part-02.xlsx, and extract the files from the zip file. In this part, repeat all the
steps in Part 1 of the assignment. The following four features will be used in this part: Temperature,
Humidity, Wind Sped, and Vapour pressure.

Note: Implement the Graduate Descent algorithm in this part as well.

Das könnte Ihnen auch gefallen