#NEWLINE# def resample_C( self , sigma_prop = 0.01 , n_steps = 10 ) : #NEWLINE# #INDENT# def log_joint_C( C ) : #NEWLINE# #INDENT# ll = 0 #NEWLINE# for states in self . states_list : #NEWLINE# #INDENT# z = states . stateseq #NEWLINE# psi = ( z . dot ( C . T ) + self . mu ) #NEWLINE# pi = psi_to_pi ( psi ) #NEWLINE# ll += np . nansum ( ( states . data * np . log ( pi ) ) ) #NEWLINE# #UNINDENT# ll += ( ( ( - 0.5 ) * ( C ** 2 ) ) / self . sigma_C ) . sum ( ) #NEWLINE# return ll #NEWLINE# #UNINDENT# def propose_C( C ) : #NEWLINE# #INDENT# noise = ( sigma_prop * np . random . randn ( * C . shape ) ) #NEWLINE# return ( C + noise ) #NEWLINE# #UNINDENT# def q( C , Chat ) : #NEWLINE# #INDENT# return 0 #NEWLINE# #UNINDENT# self . C = mh ( self . C , log_joint_C , q , propose_C , steps = n_steps ) [ ( - 1 ) ]