def get_prior(): prior_dict = { 'log_eta': dists.LogD(dists.Gamma(a=.1, b=.1)), 'logit_sigma': dists.LogitD(dists.Beta(a=1., b=1.)), 'log_c': dists.LogD(dists.Gamma(a=.1, b=.1)) } return dists.StructDist(prior_dict)
def get_prior(): prior_dict = { 'lam': dists.Normal(loc=0., scale=1.),#W 'log_alpha': dists.LogD(dists.Gamma(a=.1, b=.1)),#W 'log_delta': dists.LogD(dists.Gamma(a=.1, b=.1)), } return dists.StructDist(prior_dict)
def get_prior(): prior_dict = { 'log_eta': dists.LogD(dists.Gamma(a=.1, b=.1)), #W 'log_tau_minus_one': dists.LogD(dists.Uniform(a=0., b=4.)), #W 'logit_sigma': dists.LogitD(dists.Beta(a=1., b=1.)), 'log_c': dists.LogD(dists.Gamma(a=.1, b=.1)) #W } return dists.StructDist(prior_dict)
def get_prior(): prior_dict = { 'log_eta': dists.LogD(dists.Gamma(a=0.1, b=0.1)), 'log_tau_minus_one': dists.LogD(dists.Gamma(a=1.0, b=1.0)), 'log_c': dists.LogD(dists.Gamma(a=0.1, b=0.1)), 'log_lam': dists.LogD(dists.Gamma(a=0.1, b=0.1)) } #prior_dict = { # 'log_eta':dists.LogD(dists.Gamma(a=1.0, b=1.0)), # 'log_tau_minus_one':dists.LogD(dists.Gamma(a=1.0, b=1.0)), # 'log_c':dists.LogD(dists.Gamma(a=1.0, b=1.0)), # 'log_lam':dists.LogD(dists.Gamma(a=1.0, b=1.0))} return dists.StructDist(prior_dict)
def get_prior(): prior_dict = { 'log_alpha': dists.LogD(dists.Gamma(a=.1, b=.1)), 'log_lambda': dists.LogD(dists.Gamma(a=.1, b=.1)) } return dists.StructDist(prior_dict)
def get_prior(): prior_dict = { 'log_half_nu_minus_one': dists.LogD(dists.Gamma(a=1., b=1.)), 'log_sigma': dists.LogD(dists.Gamma(a=.1, b=.1)) } return dists.StructDist(prior_dict)
def get_prior(): prior_dict = { 'log_eta':dists.LogD(dists.Gamma(a=0.1, b=0.1)), 'log_c':dists.LogD(dists.Gamma(a=0.1, b=0.1)), 'log_lam':dists.LogD(dists.Gamma(a=0.1, b=0.1))} return dists.StructDist(prior_dict)
theta = my_prior.rvs(size=500) # sample 500 theta-parameters plt.style.use('ggplot') plt.hist(theta['sigma'], 30) plt.xlabel('sigma') plt.figure() z = my_prior.logpdf(theta) plt.hist(z, 30) plt.xlabel('log-pdf') plt.figure() another_prior_dict = { 'rho': dists.Uniform(a=-1., b=1.), 'log_sigma': dists.LogD(dists.Gamma()) } another_prior = dists.StructDist(another_prior_dict) another_theta = another_prior.rvs(size=100) plt.hist(another_theta['log_sigma'], 20) plt.xlabel('log-sigma') from collections import OrderedDict dep_prior_dict = OrderedDict() dep_prior_dict['rho'] = dists.Uniform(a=0., b=1.) dep_prior_dict['sigma'] = dists.Cond( lambda theta: dists.Gamma(b=1. / theta['rho'])) dep_prior = dists.StructDist(dep_prior_dict) dep_theta = dep_prior.rvs(size=2000)