def linear_model_logp(b, sig): if smp.outofbounds(sig > 0): return -np.inf mu = np.dot(b, x) n = len(data) likelihood = -n*0.5*np.log(2*np.pi) - \ n*0.5*np.log(sig**2) - \ np.sum((data - mu)**2)/(2*sig**2) prior_sig = -np.log(np.abs(sig)) prior_b = smp.uniform(b, lower=-5, upper=10) return likelihood + prior_sig + prior_b
def normal_logp(mu, sig): likelihood = -n*0.5*np.log(sig**2) - \ np.sum((data - mu)**2)/(2*sig**2) mu_prior = smp.uniform(mu, 5, 15) sig_prior = -np.log(np.abs(sig)) return likelihood + mu_prior + sig_prior
def prior(self, vec): n_param_super = super(Stationary, self).n_params() return super(Stationary, self).prior(vec[:n_param_super]) + smp.uniform(np.exp(vec[n_param_super:]), lower=np.exp(log_lower_bnd), upper=np.exp(self.max_log_ls))