#NEWLINE# def free_energy( self , v_sample ) : #NEWLINE# #INDENT# ' Function to compute the free energy ' #NEWLINE# wx_b = ( T . dot ( v_sample , self . W ) + self . hbias ) #NEWLINE# vbias_term = T . dot ( v_sample , self . vbias ) #NEWLINE# hidden_term = T . sum ( T . log ( ( 1 + T . exp ( wx_b ) ) ) , axis = 1 ) #NEWLINE# return ( ( - v_sample ) - vbias_term )