示例#1
0
    def update_u_v(self, rho):

        D = self.D
        zeta = self.prior['zeta']
        # compute u, v
        self.u = self.prior['u'] + (D / 2) * (
            1 + np.sum(rho, 0)) + self.zeta * self.k / D * d_hyp1f1(
                0.5, D / 2, self.zeta * self.k, iteration=self.max_hy1f1_iter)
        self.v = self.prior['v'] + np.sum(rho, 0) * (
                    D / (2 * self.k) + (1 / D) * d_hyp1f1(0.5, D / 2, self.k, iteration=self.max_hy1f1_iter)) + \
                 (D / (2 * self.k) + (zeta / D) * d_hyp1f1(0.5, D / 2, zeta * self.k, iteration=self.max_hy1f1_iter))
示例#2
0
 def update_u_v(self):
     # compute u, v
     D = self.D
     zeta = self.prior['zeta']
     self.u = self.prior['u'] + (D / 2) * (
         1 + self.temp_k_ss) + self.zeta * self.k * (d_hyp1f1(
             0.5, D / 2, self.zeta * self.k, iteration=self.max_hy1f1_iter)
                                                     / D)
     self.v = self.prior['v'] + self.temp_k_ss * (
             D / (2 * self.k) + (1 / D) * d_hyp1f1(0.5, D / 2, self.k, iteration=self.max_hy1f1_iter)) + \
              (D / (2 * self.k) + (zeta / D) * d_hyp1f1(0.5, D / 2, zeta * self.k, iteration=self.max_hy1f1_iter))
示例#3
0
    def caclulate_log_lik_x(self, x):

        D = self.D
        E_k = digamma(self.u) - np.log(self.v)
        kdk1 = d_hyp1f1(0.5,
                        D / 2,
                        self.zeta * self.k,
                        iteration=self.max_hy1f1_iter)
        kdk2 = d_hyp1f1(1.5, (D + 2) / 2,
                        self.zeta * self.k,
                        iteration=self.max_hy1f1_iter) * kdk1
        kdk3 = d_hyp1f1(0.5, D / 2, self.k, iteration=self.max_hy1f1_iter)
        temp = (1 / D * kdk1 + self.zeta * self.k *
                (3 / ((D + 2) * D) * kdk2 -
                 (1 / (D**2)) * kdk1 * kdk1)) * self.k * (E_k + np.log(
                     self.zeta) - np.log(self.prior['zeta'] * self.k))
        log_lik_x = gammaln(
            D / 2) - (D / 2) * np.log(2 * np.pi) + (D / 2) * E_k - np.log(
                (self.k**(D / 2)) * hyp1f1(0.5, D / 2, self.k)
            ) - (D / 2 / self.k + 1 / D * kdk3) * (
                self.u / self.v - self.k) + self.k / D * kdk1 + temp * (x.dot(
                    self.xi.T)**2)
        return log_lik_x