Write a program using tensorflow to build a stochastic gradient descent model for linear regression.
Co-efficients $\theta_1$ & $\theta_0$ for
$$y=\theta_0 + \theta_1x$$are calculated for given values from previous assignment.
Stochastic gradient descent requires two parameters:
Learning Rate: Used to limit the amount each coefficient is corrected each time it is updated.
Epochs: The number of times to run through the training data while updating the coefficients.
There are 3 loops we need to perform in the function:
a. Loop over each epoch.
b. Loop over each row in the training data for an epoch.
c. Loop over each coefficient and update it for a row in an epoch.
Part 1
// for Trial - dataset = [[1, 1], [2, 3], [4, 3], [3, 2], [5, 5]]
$$\theta_1(t+1) = \theta_1(t) - learning\_rate * cost(t) * x(t)$$
$$\theta_0(t+1) = \theta_0(t) - learning\_rate * cost(t) $$
Part 2
In [ ]:
Part 3
1. Write analysis on how optimization was improved.
2. Implement 3 cost functions
Additional Cost Function :
A1 = Root Mean Square Error A2 = B1 = B2 = C1 = C2 = D1 = D2 = Sum of Square Error