我正在做MCMC,我有两个发行版:
from scipy.stats import lognorm
from scipy.stats import uniform
import numpy as np
prior_fb = uniform(loc=0, scale=0.1)
post_fb = lognorm(s=np.log(1.15), scale=0.0076)
如何比较同一图中的先验分布和后验分布?
答案 0 :(得分:3)
from scipy.stats import lognorm
from scipy.stats import uniform
import numpy as np
import matplotlib.pyplot as plt
prior_fb = uniform(loc=0, scale=0.1)
post_fb = lognorm(s=np.log(1.15), scale=0.0076)
x = np.linspace(0, 0.1, 1000)
plt.plot(x, prior_fb.pdf(x), x, post_fb.pdf(x));
plt.legend(['prior', 'post'])