Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.
Take the demo code for linear re- gression available at https://github.com/pytorch/examples/blob/master/regression/ main.
Take the demo code for linear re-
gression available at https://github.com/pytorch/examples/blob/master/regression/
main.py.This demo implements Stochastic Gradient Descent for estimating the parameters
of the linear model. Your task is to familiarize yourself with every step of the code, and
understand what it is doing.
(a) Modify the simplistic implementation of Gradient Descent to use SGD class in the
torch.optim package (http://pytorch.org/docs/master/optim.html#torch.optim.
SGD). Modify the learning rate and comment on its eect.
(b) You are provided with a toy dataset in qn2 data.csv. The data relates to the amount
of corn produced (column 3) with respect to the amount of fertilizers and insecticides
that are used (column 1 and column 2). Fit a linear regression model on this data,
trained with SGD. Report the parameters of the trained model(weights[w1, w2] and
the bias). Report the values of the number of corn produced with the following test
set:
test_set = torch.Tensor([[6,4],[10,5],[14,8]])
Submit your code along with the weight, biases and the predicted values.
(c) Implement the least squares solution = (XTX)????1XTy using the same dataset. What
are the predictions for the above test set? How do they compare to the predictions of
the linear neuron trained with SGD? How do the parameters compare?
Can anyone please help me with this assignment ?