Skip to content

Commit 33028ba

Browse files
committed
Delete reset_hn_params and overwrite_h0_params
1 parent 1b47a2a commit 33028ba

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

bayesml/gaussianmixture/_gaussianmixture.py

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -632,25 +632,7 @@ def get_hn_params(self):
632632
"hn_kappas":self.hn_kappas,
633633
"hn_nus":self.hn_nus,
634634
"hn_w_mats":self.hn_w_mats}
635-
636-
def reset_hn_params(self):
637-
"""Reset the hyperparameters of the posterior distribution to their initial values.
638635

639-
They are reset to `self.h0_alpha_vec`, `self.h0_m_vecs`, `self.h0_kappas`, `self.h0_nus` and `self.h0_w_mats`.
640-
Note that the parameters of the predictive distribution are also calculated from them.
641-
"""
642-
self.hn_alpha_vec[:] = self.h0_alpha_vec
643-
self.hn_m_vecs[:] = self.h0_m_vecs
644-
self.hn_kappas[:] = self.h0_kappas
645-
self.hn_nus[:] = self.h0_nus
646-
self.hn_w_mats[:] = self.h0_w_mats
647-
self.hn_w_mats_inv = np.linalg.inv(self.hn_w_mats)
648-
649-
self._calc_q_pi_char()
650-
self._calc_q_lambda_char()
651-
652-
self.calc_pred_dist()
653-
654636
def calc_prior_char(self):
655637
self._ln_c_h0_alpha = gammaln(self.h0_alpha_vec.sum()) - gammaln(self.h0_alpha_vec).sum()
656638
self._ln_b_h0_w_nus = (
@@ -661,22 +643,6 @@ def calc_prior_char(self):
661643
axis=1) * 2.0
662644
) / 2.0
663645

664-
def overwrite_h0_params(self):
665-
"""Overwrite the initial values of the hyperparameters of the posterior distribution by the learned values.
666-
667-
They are overwitten by `self.hn_alpha_vec`, `self.hn_m_vecs`, `self.hn_kappas`, `self.hn_nus` and `self.hn_w_mats`.
668-
Note that the parameters of the predictive distribution are also calculated from them.
669-
"""
670-
self.h0_alpha_vec[:] = self.hn_alpha_vec
671-
self.h0_m_vecs[:] = self.hn_m_vecs
672-
self.h0_kappas[:] = self.hn_kappas
673-
self.h0_nus[:] = self.hn_nus
674-
self.h0_w_mats[:] = self.hn_w_mats
675-
self.h0_w_mats_inv = np.linalg.inv(self.h0_w_mats)
676-
677-
self.calc_prior_char()
678-
self.reset_hn_params()
679-
680646
def calc_vl(self):
681647
# E[ln p(X|Z,mu,Lambda)]
682648
self._vl_p_x = np.sum(

0 commit comments

Comments
 (0)