Beispiel #1
0
 def __init__(
     self,
     input,
     n_visible=784,
     n_hidden=500,
     W=None,
     hbias=None,
     vbias=None,
     numpy_rng=None,
     transpose=False,
     theano_rng=None,
     weight_decay=0.0002,
 ):
     RBM.__init__(
         self,
         input=input,
         n_visible=n_visible,
         n_hidden=n_hidden,
         W=W,
         hbias=hbias,
         vbias=vbias,
         numpy_rng=numpy_rng,
         theano_rng=theano_rng,
         weight_decay=weight_decay,
     )
    def __init__(self, input=None, n_visible=784, n_hidden=500,
                 W=None, h_bias=None, v_bias=None, numpy_rng=None, theano_rng=None):
        """
        GBRBM constructor. Defines the parameters of the model along with
        basic operations for inferring hidden from visible (and vice-versa).
        It initialize parent class (RBM).

        :param input: None for standalone RBMs or symbolic variable if RBM is part of a larger graph.

        :param n_visible: number of visible units

        :param n_hidden: number of hidden units

        :param W: None for standalone RBMs or symbolic variable pointing to a
        shared weight matrix in case RBM is part of a DBN network; in a DBN,
        the weights are shared between RBMs and layers of a MLP

        :param h_bias: None for standalone RBMs or symbolic variable pointing
        to a shared hidden units bias vector in case RBM is part of a
        different network

        :param v_bias: None for standalone RBMs or a symbolic variable
        pointing to a shared visible units bias
        """
        RBM.__init__(
            self,
            input=input,
            n_visible=n_visible,
            n_hidden=n_hidden,
            W=W, h_bias=h_bias,
            v_bias=v_bias,
            numpy_rng=numpy_rng,
            theano_rng=theano_rng)
    def __init__(
        self,
        input,
        n_in=784,
        n_hidden=500,
        W=None,
        hbias=None,
        vbias=None,
        numpy_rng=None,
        transpose=False,
        activation=T.nnet.sigmoid,
        theano_rng=None,
        name="grbm",
        W_r=None,
        dropout=0,
        dropconnect=0,
    ):

        # initialize parent class (RBM)
        RBM.__init__(
            self,
            input=input,
            n_visible=n_in,
            n_hidden=n_hidden,
            W=W,
            hbias=hbias,
            vbias=vbias,
            numpy_rng=numpy_rng,
            theano_rng=theano_rng,
        )
Beispiel #4
0
    def __init__(self,
                 input,
                 n_in,
                 n_out,
                 rng=None,
                 W=None,
                 vbias=None,
                 hbias=None):
        self.input = input
        self.n_in = n_in
        self.n_out = n_out
        RBM.__init__(self,
                     self.input,
                     n_visible=self.n_in,
                     n_hidden=self.n_out,
                     W=W,
                     vbias=vbias,
                     hbias=hbias)
        if rng is None:
            numpy_rng = np.random.RandomState(1234)
            rng = MRG_RandomStreams(numpy_rng.randint(2**30))

        self.theano_rng = rng

        self.output = self.sample_h_given_v(self.input)[2]

        self.feedbackward = self.gibbs_vhv(self.input)[2]
Beispiel #5
0
    def __init__(self, input, n_in=784, n_hidden=500, \
                 W=None, hbias=None, vbias=None, numpy_rng=None, transpose=False, activation=T.nnet.sigmoid,
                 theano_rng=None, name='grbm', W_r=None, dropout=0, dropconnect=0):

        # initialize parent class (RBM)
        RBM.__init__(self, input=input, n_visible=n_in, n_hidden=n_hidden, \
                     W=W, hbias=hbias, vbias=vbias, numpy_rng=numpy_rng,
                     theano_rng=theano_rng)
Beispiel #6
0
 def __init__(self, input, n_visible=784, n_hidden=500, W=None, hbias=None, vbias=None, numpy_rng=None,
              theano_rng=None):
     # initialize parent class (RBM)
     # RBM.__init__(self, input=input, n_visible=n_in, n_hidden=n_hidden, activation=activation,
     # W=W, hbias=hbias, vbias=vbias, transpose=transpose, numpy_rng=numpy_rng,
     # theano_rng=theano_rng, name=name, dropout=dropout, dropconnect=dropconnect)
     RBM.__init__(self, input=input, n_visible=n_visible, n_hidden=n_hidden, W=W, hbias=hbias, vbias=vbias,
                  numpy_rng=numpy_rng, theano_rng=theano_rng)
Beispiel #7
0
    def __init__(self,
                 n_visible,
                 n_hidden,
                 sample_visible=False,
                 sigma=1,
                 **kwargs):
        self.sample_visible = sample_visible
        self.sigma = sigma

        RBM.__init__(self, n_visible, n_hidden, **kwargs)
Beispiel #8
0
    def __init__(self,
                 input,
                 n_visible=16,
                 n_hidden=20,                 
                 W=None, hbias=None, vbias=None,
                 numpy_rng=None, theano_rng=None):

            # initialize parent class (RBM)
            RBM.__init__(self,
                         input=input,
                         n_visible=n_visible,
                         n_hidden=n_hidden,
                         W=W, hbias=hbias, vbias=vbias,
                         numpy_rng=numpy_rng, theano_rng=theano_rng)
Beispiel #9
0
 def __init__(self,
              input,
              n_hid,
              n_vis,
              Wp=None,
              W=None,
              hbias=None,
              vbias=None):
     # build parameters of Shifted RBM
     RBM.__init__(self,
                  input,
                  n_visible=n_vis,
                  n_hidden=n_hid,
                  W=W,
                  hbias=hbias,
                  vbias=vbias)
Beispiel #10
0
    def __init__(self,
                 n_visible,
                 n_hidden,
                 sample_visible=False,
                 sigma=1,
                 l1=0.0,
                 **kwargs):
        #        self.train_sigma = train_sigma
        #        if train_sigma:
        #            self.sigma = tf.Variable(sigma*tf.ones([n_visible]), dtype=tf.float32)
        #            self.delta_sigma = tf.Variable(tf.zeros([n_visible]), dtype=tf.float32)
        #        else:
        #            self.sigma = sigma

        self.l1 = l1
        self.lr_penalty = 1

        RBM.__init__(self, n_visible, n_hidden, **kwargs)
 def __init__(self, *args, **kwargs):
     RBM.__init__(self, *args, **kwargs)
     self.temp = 1
Beispiel #12
0
 def __init__(self, input, n_visible=784, n_hidden=500, \
              W=None, hbias=None, vbias=None, numpy_rng=None, transpose=False,
              theano_rng=None, weight_decay=0.0002):
         RBM.__init__(self, input=input, n_visible=n_visible, n_hidden=n_hidden, \
                      W=W, hbias=hbias, vbias=vbias, numpy_rng=numpy_rng,
                      theano_rng=theano_rng, weight_decay=weight_decay)
Beispiel #13
0
 def __init__(self, *args, **kwargs):
     RBM.__init__(self, *args, **kwargs)
Beispiel #14
0
 def __init__(self, input, n_visible, n_hidden):
     RBM.__init__(self, input=input, n_visible=n_visible,
                  n_hidden=n_hidden)
Beispiel #15
0
 def __init__(self, input, n_hid, n_vis, Wp=None,
              W=None, hbias=None, vbias=None):
     # build parameters of Shifted RBM
     RBM.__init__(self, input, n_visible=n_vis, n_hidden=n_hid,
                  W=W, hbias=hbias, vbias=vbias)