- Matplotlib 3.0 Cookbook
- Srinivasa Rao Poladi
- 76字
- 2021-08-13 15:16:01
There's more...
The previous screenshot only represents various contours of the Loss function for a given set of theta0 and theta1. We can also plot the optimal values of theta0 and theta1 on the same plot to represent minimum loss:
# Plot the minimum point(Theta at Minimum cost)
plt.plot(theta[0], theta[1], 'rx', markersize=15, linewidth=2)
plt.show()
Here is how the plot looks. The red cross position depicts the optimal theta that gives lowest error for this regression problem: