File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -770,9 +770,12 @@ def _init_subsampling(self,x):
770
770
/ _size * self .hn_nus [k ]
771
771
+ np .identity (self .c_degree ) * 1.0E-5 ) # avoid singular matrix
772
772
self .hn_w_mats [k ] = np .linalg .inv (self .hn_w_mats_inv [k ])
773
- self ._calc_q_pi_char ()
774
773
self ._calc_q_lambda_char ()
775
774
775
+ def _init_rho_r (self ):
776
+ self ._ln_rho [:] = 0.0
777
+ self .r_vecs [:] = 1 / self .c_num_classes
778
+
776
779
def update_posterior (
777
780
self ,
778
781
x ,
@@ -818,6 +821,8 @@ def update_posterior(
818
821
819
822
convergence_flag = True
820
823
for i in range (num_init ):
824
+ self .reset_hn_params ()
825
+ self ._init_rho_r ()
821
826
if init_type == 'subsampling' :
822
827
self ._init_subsampling (x )
823
828
self ._update_q_z (x )
Original file line number Diff line number Diff line change 11
11
lambda_mats = np .array ([[[6.25 ]],[[6.25 ]],[[100 ]]])
12
12
)
13
13
14
- x ,z = gen_model .gen_sample (1000 )
14
+ x ,z = gen_model .gen_sample (300 )
15
15
16
16
learn_model = gaussianmixture .LearnModel (3 ,1 )
17
- learn_model .update_posterior (x )
17
+ learn_model .update_posterior (x )#,init_type='random_responsibility')
18
18
learn_model .visualize_posterior ()
You can’t perform that action at this time.
0 commit comments