
CS229 Problem Set #1 1
CS 229, Summer 2024
Problem Set #1
Zhiyao Shu
Due Friday, July 12 at 11:59 pm on Gradescope.
Notes: (1) These questions require thought, but do not require long answers. Please be as
concise as possible.
(2) If you have a question about this homework, we encourage you to post your question on our
Ed forum, at https://edstem.org/us/courses/60202/discussion/.
(3) If you missed the first lecture or are unfamiliar with the collaboration or honor code policy,
please read the policy on the course website before starting work.
(4) For the coding problems, you may not use any libraries except those defined in the provided
environment.yml file. In particular, ML-specific libraries such as scikit-learn are not permitted.
(5) The due date is Friday, July 12 at 11:59 pm. If you submit after Friday, July 12 at 11:59
pm, you will begin consuming your late days. The late day policy can be found in the course
website: Course Logistics and FAQ.
All students must submit an electronic PDF version of the written question including plots
generated from the codes. We require you to typeset your solutions via L
A
T
E
X. All
students must also submit a zip file of their source code to Gradescope, which should be created
using the make zip.py script. You should make sure to (1) restrict yourself to only using libraries
included in the environment.yml file, and (2) make sure your code runs without errors. Your
submission may be evaluated by the auto-grader using a private test set, or used for verifying the
outputs reported in the writeup. Please make sure that your PDF file and zip file are submitted
to the corresponding Gradescope assignments respectively. We reserve the right to not give any
points to the written solutions if the associated code is not submitted.
Honor code: We strongly encourage students to form study groups. Students may discuss and
work on homework problems in groups. However, each student must write down the solutions
independently, and without referring to written notes from the joint session. In other words,
each student must understand the solution well enough in order to reconstruct it by themself.
In addition, each student should write on the problem set the set of people with whom s/he
collaborated. Further, because we occasionally reuse problem set questions from previous years,
we expect students not to copy, refer to, or look at the solutions in preparing their answers. It
is an honor code violation to intentionally refer to a previous year’s solutions.
Regarding Notation: The notation used in this problem set matches the notation used in the
lecture notes. Some notable differences from lecture notation:
•The superscript “(i)” represents an index into the training set – for example, x(i)is the
i-th feature vector and y(i)is the i-th output variable. In lecture notation, these would
instead be expressed as xiand yi.
•The subscript jrepresents an index in a vector – in particular, x(i)
jrepresents the j-th
feature in the feature vector x(i). In lecture notation, x(i)
jwould be hj(xi) or xi[j].
•The vector that contains the weights parameterizing a linear regression is expressed by the
variable θ, whereas lectures use the variable w. As such, θ0=w0,θ1=w1, and so on.