def neg_sampling(W_list, b_list, nsamples, beta=1.0, pa_bias=None, marginalize_odd=True, theano_rng=None):
 depth = len(b_list)
 new_nsamples = [nsamples[i] for i in xrange(depth)]
 _sample_even_odd(W_list, b_list, new_nsamples, beta, odd=marginalize_odd)
 _activation_even_odd(W_list, b_list, new_nsamples, beta, odd=(not marginalize_odd))
 new_nsamples[(not marginalize_odd)] += (pa_bias * (1.0 - beta))
 for i in xrange((not marginalize_odd), depth, 2):
  new_nsamples[i] = T.nnet.sigmoid(new_nsamples[i])
  new_nsamples[i] = theano_rng.binomial(size=nsamples[i].get_value().shape, n=1, p=new_nsamples[i], dtype=floatX)
 return new_nsamples

def neg_sampling ( W_list , b_list , nsamples , beta = 1.0 , pa_bias = None , marginalize_odd = True , theano_rng = None ) : depth = len ( b_list ) new_nsamples = [ nsamples [ i ] for i in xrange ( depth ) ] _sample_even_odd ( W_list , b_list , new_nsamples , beta , odd = marginalize_odd ) _activation_even_odd ( W_list , b_list , new_nsamples , beta , odd = ( not marginalize_odd ) ) new_nsamples [ ( not marginalize_odd ) ] += ( pa_bias * ( 1.0 - beta ) ) for i in xrange ( ( not marginalize_odd ) , depth , 2 ) : new_nsamples [ i ] = T . nnet . sigmoid ( new_nsamples [ i ] ) new_nsamples [ i ] = theano_rng . binomial ( size = nsamples [ i ] . get_value ( ) . shape , n = 1 , p = new_nsamples [ i ] , dtype = floatX ) return new_nsamples
generate a sample from the intermediate distribution defined at inverse temperature beta .