original_docstring: 
          Train the rbm provided in the init to fit the given data.
  
          Args:
              epochs (int): The number of times to go over the training set, assumes this number is at least equal to the training set size.
              training (numpy.array): The training set. The shape should match the RBM that the trainer was supplied.
              learning_rate (Optional(float)): RBM's learning_rate, used in hebbian learning.
  
          
docstring: Train the rbm provided in the init to fit the given data.
docstring_tokens: Train the rbm provided in the init to fit the given data .
code: def train(self, epochs, training ,learning_rate = 0.002, logging_freq = None, use_visible_bias = True):
          """
          Train the rbm provided in the init to fit the given data.
  
          Args:
              epochs (int): The number of times to go over the training set, assumes this number is at least equal to the training set size.
              training (numpy.array): The training set. The shape should match the RBM that the trainer was supplied.
              learning_rate (Optional(float)): RBM's learning_rate, used in hebbian learning.
  
          """
          if not use_visible_bias:
              self.rbm.visible_bias = np.zeros(self.rbm.visible_bias.shape)
          if logging_freq:
              self.progess_logger = Progress(self.__class__.__name__, epochs)
              self.progess_logger.set_percentage_update_frequency(logging_freq)
  
          self.rbm.visible = training
          wake_vis = training
          wake_hid = rbm.random_hiddens_for_rbm(self.rbm)
  
          sleep_vis = wake_vis
          sleep_hid = self.sampler.visible_to_hidden(sleep_vis)
  
          for epoch in range(0, epochs):
  
              wake_hid = self.sampler.visible_to_hidden(wake_vis)
              sleep_vis = self.sampler.hidden_to_visible(sleep_hid, return_sigmoid = True) # reconstruction based on training item
              sleep_hid = self.sampler.visible_to_hidden(sleep_vis) # hidden based on reconstruction
  
  
              hebbian_pos = self.__hebbian__(wake_vis, wake_hid)
              hebbian_neg = self.__hebbian__(sleep_vis, sleep_hid)
  
              # weight update
              # TODO: make sure the hids are all different and check mean(1)?????
              self.rbm.weights += learning_rate * (hebbian_pos - hebbian_neg).sum(0).transpose()
  
              # bias updates
              if use_visible_bias:
                  self.rbm.visible_bias = self.rbm.visible_bias + learning_rate * (wake_vis - sleep_vis).sum(0)
                  self.rbm.visible_bias = np.mean(self.rbm.visible_bias) * np.ones(self.rbm.visible_bias.shape)
  
              self.rbm.hidden_bias += learning_rate * (wake_hid - sleep_hid).sum(0)
              # self.rbm.hidden_bias = np.mean(self.rbm.hidden_bias) * np.ones(self.rbm.hidden_bias.shape)
  
              if self.progess_logger:
                  self.progess_logger.set_completed_units(epoch)
  
          self.rbm.hidden = wake_hid
code_tokens: def train ( self , epochs , training , learning_rate = 0.002 , logging_freq = None , use_visible_bias = True ) : if not use_visible_bias : self . rbm . visible_bias = np . zeros ( self . rbm . visible_bias . shape ) if logging_freq : self . progess_logger = Progress ( self . __class__ . __name__ , epochs ) self . progess_logger . set_percentage_update_frequency ( logging_freq ) self . rbm . visible = training wake_vis = training wake_hid = rbm . random_hiddens_for_rbm ( self . rbm ) sleep_vis = wake_vis sleep_hid = self . sampler . visible_to_hidden ( sleep_vis ) for epoch in range ( 0 , epochs ) : wake_hid = self . sampler . visible_to_hidden ( wake_vis ) sleep_vis = self . sampler . hidden_to_visible ( sleep_hid , return_sigmoid = True ) sleep_hid = self . sampler . visible_to_hidden ( sleep_vis ) hebbian_pos = self . __hebbian__ ( wake_vis , wake_hid ) hebbian_neg = self . __hebbian__ ( sleep_vis , sleep_hid ) self . rbm . weights += learning_rate * ( hebbian_pos - hebbian_neg ) . sum ( 0 ) . transpose ( ) if use_visible_bias : self . rbm . visible_bias = self . rbm . visible_bias + learning_rate * ( wake_vis - sleep_vis ) . sum ( 0 ) self . rbm . visible_bias = np . mean ( self . rbm . visible_bias ) * np . ones ( self . rbm . visible_bias . shape ) self . rbm . hidden_bias += learning_rate * ( wake_hid - sleep_hid ) . sum ( 0 ) if self . progess_logger : self . progess_logger . set_completed_units ( epoch ) self . rbm . hidden = wake_hid
short_docstring: Train the rbm provided in the init to fit the given data.
short_docstring_tokens: Train the rbm provided in the init to fit the given data .
comment: """
          Train the rbm provided in the init to fit the given data.
  
          Args:
              epochs (int): The number of times to go over the training set, assumes this number is at least equal to the training set size.
              training (numpy.array): The training set. The shape should match the RBM that the trainer was supplied.
              learning_rate (Optional(float)): RBM's learning_rate, used in hebbian learning.
  
          """$SEP$# reconstruction based on training item$SEP$# hidden based on reconstruction$SEP$# weight update$SEP$# TODO: make sure the hids are all different and check mean(1)?????$SEP$# bias updates$SEP$# self.rbm.hidden_bias = np.mean(self.rbm.hidden_bias) * np.ones(self.rbm.hidden_bias.shape)