Madhav commited on
Commit
400456a
·
1 Parent(s): 4350ba5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -35,10 +35,13 @@ def run_linear_regression(X, y, alpha_prior, beta_prior, sigma_prior):
35
  fig, ax = plt.subplots(figsize=(8, 6))
36
  ax.scatter(X, y, color='blue', alpha=0.5, label='data')
37
  light_color = (1.0, 0.5, 0.5, 0.7)
38
- for i in range(500):
39
  alpha_i = samples['alpha'][i]
40
  beta_i = samples['beta'][i]
41
- ax.plot(X, alpha_i + beta_i * X, color=light_color,label='MCMC samples')
 
 
 
42
  ax.plot(X, np.mean(samples['alpha']) + np.mean(samples['beta']) * X, color='red', label='mean')
43
  ax.legend(loc='upper left')
44
  st.pyplot(fig)
 
35
  fig, ax = plt.subplots(figsize=(8, 6))
36
  ax.scatter(X, y, color='blue', alpha=0.5, label='data')
37
  light_color = (1.0, 0.5, 0.5, 0.7)
38
+ for i in range(499):
39
  alpha_i = samples['alpha'][i]
40
  beta_i = samples['beta'][i]
41
+ ax.plot(X, alpha_i + beta_i * X, color=light_color)
42
+ alpha_i = samples['alpha'][499]
43
+ beta_i = samples['beta'][499]
44
+ ax.plot(X, alpha_i + beta_i * X, color=light_color,label='MCMC samples')
45
  ax.plot(X, np.mean(samples['alpha']) + np.mean(samples['beta']) * X, color='red', label='mean')
46
  ax.legend(loc='upper left')
47
  st.pyplot(fig)