#NEWLINE# def energy_functional( self , V , model , obs ) : #NEWLINE# #INDENT# '\n        Return value is a scalar\n\n        Parameters\n        ----------\n        V : WRITEME\n        model : WRITEME\n        obs : WRITEME\n\n        Returns\n        -------\n        WRITEME\n        ' #NEWLINE# needed_stats = S3C . expected_log_prob_vhs_needed_stats ( ) #NEWLINE# stats = SufficientStatistics . from_observations ( needed_stats = needed_stats , V = V , ** obs ) #NEWLINE# H_hat = obs [ 'H_hat' ] #NEWLINE# S_hat = obs [ 'S_hat' ] #NEWLINE# var_s0_hat = obs [ 'var_s0_hat' ] #NEWLINE# var_s1_hat = obs [ 'var_s1_hat' ] #NEWLINE# entropy_term = model . entropy_hs ( H_hat = H_hat , var_s0_hat = var_s0_hat , var_s1_hat = var_s1_hat ) . mean ( ) #NEWLINE# likelihood_term = model . expected_log_prob_vhs ( stats , H_hat = H_hat , S_hat = S_hat ) #NEWLINE# energy_functional = ( entropy_term + energy_functional ) #NEWLINE# return energy_functional