def estimate_from_weights(log_ais_w):
 ais_w = T.vector()
 max_ais_w = T.max(ais_w)
 dlogz = (T.log(T.mean(T.exp((ais_w - max_ais_w)))) + max_ais_w)
 log_mean = theano.function([ais_w], dlogz, allow_input_downcast=False)
 dlogz = log_mean(log_ais_w)
 m = numpy.max(log_ais_w)
 var_dlogz = (((log_ais_w.shape[0] * numpy.sum(numpy.exp((2 * (log_ais_w - m))))) / (numpy.sum(numpy.exp((log_ais_w - m))) ** 2)) - 1.0)
 return (dlogz, var_dlogz)

def estimate_from_weights ( log_ais_w ) : ais_w = T . vector ( ) max_ais_w = T . max ( ais_w ) dlogz = ( T . log ( T . mean ( T . exp ( ( ais_w - max_ais_w ) ) ) ) + max_ais_w ) log_mean = theano . function ( [ ais_w ] , dlogz , allow_input_downcast = False ) dlogz = log_mean ( log_ais_w ) m = numpy . max ( log_ais_w ) var_dlogz = ( ( ( log_ais_w . shape [ 0 ] * numpy . sum ( numpy . exp ( ( 2 * ( log_ais_w - m ) ) ) ) ) / ( numpy . sum ( numpy . exp ( ( log_ais_w - m ) ) ) ** 2 ) ) - 1.0 ) return ( dlogz , var_dlogz )
safely compute the log-average of the ais-weights parameters log_ais_w : theano .