theta = np.ones(X.shape[1])
lr.cost(theta, X, y)

"""
Explanation: cost
<img style="float: left;" src="../img/linear_cost.png">
End of explanation
"""


lr.regularized_cost(theta, X, y)

"""
Explanation: regularized cost
<img style="float: left;" src="../img/linear_reg_cost.png">
End of explanation
"""


lr.gradient(theta, X, y)

"""
Explanation: gradient
<img style="float: left;" src="../img/linear_gradient.png">
End of explanation
"""


lr.regularized_gradient(theta, X, y)

"""
Explanation: regularized gradient
<img style="float: left;" src="../img/linear_reg_gradient.png">
End of explanation
"""


theta = np.ones(X.shape[0])

final_theta = lr.linear_regression_np(X, y, l=0).get('x')

b = final_theta[0] # intercept
m = final_theta[1] # slope

plt.scatter(X[:,1], y, label="Training data")
plt.plot(X[:, 1], X[:, 1]*m + b, label="Prediction")
plt.legend(loc=2)

"""
Explanation: fit the data

regularization term $\lambda=0$
End of explanation
"""


