Question: ( 4 0 points ) A Python Implementation of Stochastic Gradient Descent. Assume we are given a data set S = { ( x i

(40 points) A Python Implementation of Stochastic Gradient Descent.
Assume we are given a data set
S={(xi,yi)}i=1nsubeRd+1
and wish to fit a linear regression predictor h(x)=TTx for some parameters inRd. Recall that stochastic gradient descent is defined similarly to gradient descent, except that the update step to the current set of parameters k is based off a single training point (xi,yi). That is, the algorithm takes successive passes over that data set S and updates k according to the rule
k+1:=k-(hk(xi)-yi)xi.
This problem will have you implement stochastic gradient descent by modifying code in the attached file hw1_problem_2.py. You will need to submit a modified version hu1_problem_2. py that has the appropriate code filled in.
The implementation that you submit will be tested through Python unit tests executed by the file test_hw1_problem_2.py. The test file is attached and may be used to check your progress. In a terminal navigate to the directory containing both Python files and run the command python test_hu1_problem_2.py to execute the tests.
However, you should not modify the test file as it will not be part of your submission. In addition, your implementation will be graded based upon inspection of the completed Python functions and not just passing the unit tests.
( 4 0 points ) A Python Implementation of

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!