Update app.py
Browse files116 unmodified lines117118119120121122123124125126127128129116 unmodified linesplt.contourf(b,w,Z, 50, alpha=0.5, cmap=plt.get_cmap('jet'))### (5.5) Add optimal lossplt.plot(theta0_best, theta1_best, 'x', ms=12, markeredgewidth=3, color='orange')plt.text(theta0_best, theta1_best,'MSE:'+str(np.round(cal_mse(X,y,theta0_best, theta1_best),2)), color='red', fontsize=22)### (5.6) Add loss of random linesif intercept_random != intercept or slope_random != slope: #avoid overlapplt.plot(intercept_random, slope_random, 'o', ms=5, markeredgewidth=3, color='orange')plt.text(intercept_random, slope_random,'MSE:'+str(np.round(cal_mse(X,y,intercept_random, slope_random),2)), fontsize=22)### (5.7) draw gradient updatesif gradient_descent:116 unmodified lines117118119120121122123124125126127128129116 unmodified linesplt.contourf(b,w,Z, 50, alpha=0.5, cmap=plt.get_cmap('jet'))### (5.5) Add optimal loss#plt.plot(theta0_best, theta1_best, 'x', ms=12, markeredgewidth=3, color='orange')#plt.text(theta0_best, theta1_best,'MSE:'+str(np.round(cal_mse(X,y,theta0_best, theta1_best),2)), color='red', fontsize=22)### (5.6) Add loss of random lines#if intercept_random != intercept or slope_random != slope: #avoid overlap#plt.plot(intercept_random, slope_random, 'o', ms=5, markeredgewidth=3, color='orange')#plt.text(intercept_random, slope_random,'MSE:'+str(np.round(cal_mse(X,y,intercept_random, slope_random),2)), fontsize=22)### (5.7) draw gradient updatesif gradient_descent:
app.py+5-5