Skip to content

Instantly share code, notes, and snippets.

@amacbee
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amacbee/10f08d4a10102bc4b8a2 to your computer and use it in GitHub Desktop.
Save amacbee/10f08d4a10102bc4b8a2 to your computer and use it in GitHub Desktop.
ベータ分布のサンプル
# -*- coding: utf-8 -*-
import matplotlib
colors = matplotlib.rcParams['axes.color_cycle']
from matplotlib import pyplot as plt
from scipy.stats import beta
import numpy as np
x = np.linspace(0,1, num=200)
for a, b, c in zip([0.5, 0.5, 1, 2, 3], [0.5, 1, 3, 2, 5], colors):
plt.plot(x, beta.pdf(x, a, b), lw=2,
c=c, label=r"$\alpha = {0:.1f},\ \beta={1:.1f}$".format(a, b))
plt.legend(loc=0)
plt.ylabel("$pdf$")
plt.xlabel("$x$")
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment