def inverse_wishart_log_prob(gaussian): """ Compute the log probability under a IW prior for a GaussianFixedMean object :param gaussian: :return: """ from scipy.stats import invwishart lp = 0 lp += invwishart.logpdf(gaussian.sigma, gaussian.nu_0, gaussian.lmbda_0) return lp
def logpdf(self, X): """ Log PDF for Inverse Wishart prior Parameters ---------- X : float Covariance matrix for which the prior is being formed over Returns ---------- - log(p(X)) """ return invwishart.logpdf(X, df=self.v, scale=self.Psi)
def normal_inverse_wishart_log_prob(gaussian): """ Compute the log probability under a NIW prior for a Gaussian object :param gaussian: :return: """ from scipy.stats import invwishart, multivariate_normal lp = 0 lp += invwishart.logpdf(gaussian.sigma, gaussian.nu_0, gaussian.sigma_0) # Compute log N(mu_0 | mu_0, Sigma / kappa_0) lp += multivariate_normal.logpdf(gaussian.mu, gaussian.mu_0, gaussian.sigma / gaussian.kappa_0) return lp
def logpdf(self,X): return invwishart.logpdf(X, df=self.v, scale=self.Psi)