Given a posterior p(Θ|D) over some parameters Θ, one can define the following:
The Highest Posterior Density Region
To calculate HPD you can leverage pymc3, Here is an example
import pymc3 from scipy.stats import norm a = norm.rvs(size=10000) pymc3.stats.hpd(a)