October 2018
Beginner to intermediate
676 pages
18h 30m
English
The following is the code to draw a contour plot of loss function in the given regression problem:
Loss = pd.read_excel('Loss.xlsx')theta0_vals = pd.read_excel('theta0.xlsx')theta1_vals = pd.read_excel('theta1.xlsx')
fig = plt.figure(figsize=(12,8))
X, Y = np.meshgrid(theta0_vals, theta1_vals)
CS = plt.contour(X, Y, Loss, np.logspace(-2,3,20), cmap=cm.coolwarm) plt.clabel(CS, inline=1, fontsize=10)
plt.show()
Read now
Unlock full access