Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -3,6 +3,7 @@ import streamlit as st
|
|
| 3 |
import scipy.stats
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
from matplotlib import rc
|
|
|
|
| 6 |
|
| 7 |
st.subheader("Bayesian Coin Toss")
|
| 8 |
st_col = st.columns(1)[0]
|
|
@@ -30,7 +31,7 @@ ax.set_xlabel('p(head)');
|
|
| 30 |
# axs.text(h/N,2,'MLE', color='b')
|
| 31 |
|
| 32 |
axs.plot(theta, [scipy.stats.beta.pdf(t, h+alpha, N-h+beta) for t in theta], color='r')
|
| 33 |
-
ax.text(theta[N_theta//4], Likelihood[N_theta//4],'Likelihood', color='b')
|
| 34 |
axs.text(theta[3*N_theta//4], scipy.stats.beta.pdf(theta, alpha,beta)[3*N_theta//4],'Prior')
|
| 35 |
# axs.text(alpha/(alpha+beta)-0.1,1,'Prior mean')
|
| 36 |
axs.text(theta[N_theta//2],scipy.stats.beta.pdf(theta[N_theta//2], h+alpha, N-h+beta),'Posterior',color='r')
|
|
|
|
| 3 |
import scipy.stats
|
| 4 |
import matplotlib.pyplot as plt
|
| 5 |
from matplotlib import rc
|
| 6 |
+
plt.style.use('fivethirtyeight')
|
| 7 |
|
| 8 |
st.subheader("Bayesian Coin Toss")
|
| 9 |
st_col = st.columns(1)[0]
|
|
|
|
| 31 |
# axs.text(h/N,2,'MLE', color='b')
|
| 32 |
|
| 33 |
axs.plot(theta, [scipy.stats.beta.pdf(t, h+alpha, N-h+beta) for t in theta], color='r')
|
| 34 |
+
ax.text(theta[N_theta//4], Likelihood[N_theta//4], 'Likelihood', color='b')
|
| 35 |
axs.text(theta[3*N_theta//4], scipy.stats.beta.pdf(theta, alpha,beta)[3*N_theta//4],'Prior')
|
| 36 |
# axs.text(alpha/(alpha+beta)-0.1,1,'Prior mean')
|
| 37 |
axs.text(theta[N_theta//2],scipy.stats.beta.pdf(theta[N_theta//2], h+alpha, N-h+beta),'Posterior',color='r')
|