예제 #1
0
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
예제 #2
0
    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)
예제 #3
0
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
예제 #4
0
파일: priors.py 프로젝트: tchen0123/pyflux
 def logpdf(self,X):
     return invwishart.logpdf(X, df=self.v, scale=self.Psi)