#NEWLINE# def test_mean_H_given_V( self ) : #NEWLINE# #INDENT# tol = 1e-06 #NEWLINE# rng = N . random . RandomState ( [ 1 , 2 , 3 ] ) #NEWLINE# m = 5 #NEWLINE# Vv = as_floatX ( ( N . zeros ( ( m , self . nv ) ) + rng . randn ( self . nv ) ) ) #NEWLINE# Hv = as_floatX ( ( rng . randn ( m , self . nh ) > 0.0 ) ) #NEWLINE# log_Pv = self . log_P_H_given_V_func ( Hv , Vv ) #NEWLINE# Ev = self . E_func ( Vv , Hv ) #NEWLINE# for i in xrange ( m ) : #NEWLINE# #INDENT# for j in xrange ( ( log_a + 1 ) , m ) : #NEWLINE# #INDENT# log_a = ( log_Pv [ i ] - log_Pv [ j ] ) #NEWLINE# e = ( Ev [ j ] - Ev [ i ] ) #NEWLINE# assert ( abs ( ( e - log_a ) ) < tol )