Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: THEend8_
1 Handwritten Homework
Note All problems in this section requires the handwritten answers.
Problem 1.1 (10pts). Given a training data {x
(i)
, y(i)} with i = 1, 2, · · · , M and x
i ∈
R
N , y(i) ∈ R. Consider a linear regression model with predictor and loss defined in the
lecture note. Calculate and simplify the gradient of the loss function.
Problem 1.2 (10pts). Given a training data {x
(i)
, y(i)} with i = 1, 2, · · · , M and x
i ∈
R
N , y(i) ∈ {0, 1}. Consider a logistic regression model with predictor and loss defined in the
lecture note. Calculate and simplify the gradient of the loss function.
2 Programming Homework
Note Write your codes in Jupyter notebook format. Each problem is in a separate notebook
and submit all of them via a dropbox in D2L. Machine learning libraries in Python
packages are not allowed to use.
Problem 2.1 (30pts). Given training data: X iris train.csv (feature values), y iris train.csv
(labels) and test data: X iris test.csv (feature values), y iris test.csv (labels) . File
Iris feature description.csv describes the meaning of each column in the data set.
a) Program a logistic regression model to predict the labels in the test data. Explicitly write
down the representation of model’s predictor (note: type down your formulation in the
notebook).
b) Calculate the accuracy of your model.