#NEWLINE# def random_design_matrix( self , batch_size , theano_rng = None , H_sample = None , S_sample = None , full_sample = True , return_all = False ) : #NEWLINE# #INDENT# '\n        .. todo::\n\n            WRITEME\n\n        Parameters\n        ----------\n        H_sample: a matrix of values of H, optional\n            if none is provided, samples one from the prior\n            (H_sample is used if you want to see what samples due\n            to specific hidden units look like, or when sampling\n            from a larger model that s3c is part of)\n        ' #NEWLINE# if ( theano_rng is None ) : #NEWLINE# #INDENT# assert ( H_sample is not None ) #NEWLINE# assert ( S_sample is not None ) #NEWLINE# assert ( full_sample == False ) #NEWLINE# #UNINDENT# if ( not hasattr ( self , 'p' ) ) : #NEWLINE# #INDENT# self . make_pseudoparams ( ) #NEWLINE# #UNINDENT# hid_shape = ( batch_size , self . nhid ) #NEWLINE# if ( H_sample is None ) : #NEWLINE# #INDENT# H_sample = theano_rng . binomial ( size = hid_shape , n = 1 , p = self . p , dtype = self . W . dtype ) #NEWLINE# #UNINDENT# assert ( H_sample . dtype == 'float32' ) #NEWLINE# if hasattr ( H_sample , '__array__' ) : #NEWLINE# #INDENT# assert ( len ( H_sample . shape ) == 2 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# assert ( len ( H_sample . type . broadcastable ) == 2 ) #NEWLINE# #UNINDENT# if ( S_sample is None ) : #NEWLINE# #INDENT# S_sample = theano_rng . normal ( size = hid_shape , avg = self . mu , std = T . sqrt ( ( 1.0 / self . alpha ) ) ) #NEWLINE# #UNINDENT# assert ( S_sample . dtype == 'float32' ) #NEWLINE# final_hs_sample = ( H_sample * S_sample ) #NEWLINE# assert ( len ( final_hs_sample . type . broadcastable ) == 2 ) #NEWLINE# V_mean = T . dot ( final_hs_sample , self . W . T ) #NEWLINE# if ( not full_sample ) : #NEWLINE# #INDENT# warnings . warn ( 'showing conditional means (given sampled h and s) on visible units rather than true samples' ) #NEWLINE# if return_all : #NEWLINE# #INDENT# return ( H_sample , S_sample , V_mean ) #NEWLINE# #UNINDENT# return V_mean #NEWLINE# #UNINDENT# V_sample = theano_rng . normal ( size = V_mean . shape , avg = V_mean , std = T . sqrt ( ( 1.0 / self . B ) ) ) #NEWLINE# assert ( V_sample . dtype == 'float32' ) #NEWLINE# if return_all : #NEWLINE# #INDENT# assert ( H_sample is not None ) #NEWLINE# assert ( S_sample is not None ) #NEWLINE# assert ( V_sample is not None ) #NEWLINE# return ( H_sample , S_sample , V_sample ) #NEWLINE# #UNINDENT# return V_sample