jiehou commited on
Commit
ce0a2c6
·
1 Parent(s): 4caab07

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -117,13 +117,13 @@ def gradient_descent(intercept=4, slope=3, intercept_random=4, slope_random=3, g
117
  plt.contourf(b,w,Z, 50, alpha=0.5, cmap=plt.get_cmap('jet'))
118
 
119
  ### (5.5) Add optimal loss
120
- plt.plot(theta0_best, theta1_best, 'x', ms=12, markeredgewidth=3, color='orange')
121
- plt.text(theta0_best, theta1_best,'MSE:'+str(np.round(cal_mse(X,y,theta0_best, theta1_best),2)), color='red', fontsize=22)
122
 
123
  ### (5.6) Add loss of random lines
124
- if intercept_random != intercept or slope_random != slope: #avoid overlap
125
- plt.plot(intercept_random, slope_random, 'o', ms=5, markeredgewidth=3, color='orange')
126
- plt.text(intercept_random, slope_random,'MSE:'+str(np.round(cal_mse(X,y,intercept_random, slope_random),2)), fontsize=22)
127
 
128
  ### (5.7) draw gradient updates
129
  if gradient_descent:
 
117
  plt.contourf(b,w,Z, 50, alpha=0.5, cmap=plt.get_cmap('jet'))
118
 
119
  ### (5.5) Add optimal loss
120
+ #plt.plot(theta0_best, theta1_best, 'x', ms=12, markeredgewidth=3, color='orange')
121
+ #plt.text(theta0_best, theta1_best,'MSE:'+str(np.round(cal_mse(X,y,theta0_best, theta1_best),2)), color='red', fontsize=22)
122
 
123
  ### (5.6) Add loss of random lines
124
+ #if intercept_random != intercept or slope_random != slope: #avoid overlap
125
+ #plt.plot(intercept_random, slope_random, 'o', ms=5, markeredgewidth=3, color='orange')
126
+ #plt.text(intercept_random, slope_random,'MSE:'+str(np.round(cal_mse(X,y,intercept_random, slope_random),2)), fontsize=22)
127
 
128
  ### (5.7) draw gradient updates
129
  if gradient_descent: