Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
probml
GitHub Repository: probml/pyprobml
Path: blob/master/deprecated/scripts/beta_dist_plot.py
1192 views
1
import superimport
2
3
import numpy as np
4
import matplotlib.pyplot as plt
5
import pyprobml_utils as pml
6
7
from scipy.stats import beta
8
9
10
x = np.linspace(0, 1, 100)
11
aa = [0.1, 0.1, 1.0, 2.0, 2.0]
12
bb = [0.1, 1.0, 1.0, 2.0, 8.0]
13
#props = ['b-', 'r:', 'k-.', 'g--', 'c-']
14
props = ['b', 'r', 'k', 'g', 'c']
15
for a, b, p in zip(aa, bb, props):
16
y = beta.pdf(x, a, b)
17
plt.plot(x, y, p, lw=3, label='a=%.1f,b=%.1f' % (a, b))
18
plt.legend(fontsize=14)
19
plt.title('Beta distributions')
20
pml.savefig('betadist.pdf', dpi=300)
21
plt.show()
22
23