コード例 #1
0
 def __save_output__(self,batch_index,outputs):
     """
     Serialize the output of the rbm.
     
     @param batch_index: Index of the batch.
     @param outputs: The output probabilitites of the rbm
     """
     
     s.dump(outputs.tolist() , open(env_paths.get_rbm_output_path(str(self.num_hid),batch_index,self.layer_index), "wb" ) )
コード例 #2
0
    def __get_input_data__(self, batch_index, first_layer):
        """
        Retrieve the word-count matrix from HDD.

        @param batch_index: Index of the batch.

        @return: The word-count matrix corresponding to the batch_index.
        """
        if first_layer:
            return DataPreparation.data_processing.get_bag_of_words_matrix(self.batches[batch_index])
        return array(s.load(open(env_paths.get_rbm_output_path(self.num_vis, batch_index, self.layer_index - 1), "rb")))
コード例 #3
0
    def __save_output__(self, batch_index, outputs):
        """
        Serialize the output of the rbm.
        
        @param batch_index: Index of the batch.
        @param outputs: The output probabilitites of the rbm
        """

        s.dump(
            outputs.tolist(),
            open(
                env_paths.get_rbm_output_path(str(self.num_hid), batch_index,
                                              self.layer_index), "wb"))
コード例 #4
0
    def __get_input_data__(self, batch_index, first_layer):
        """
        Retrieve the word-count matrix from HDD.

        @param batch_index: Index of the batch.

        @return: The word-count matrix corresponding to the batch_index.
        """
        if first_layer:
            return DataPreparation.data_processing.get_bag_of_words_matrix(
                self.batches[batch_index])
        return array(
            s.load(
                open(
                    env_paths.get_rbm_output_path(self.num_vis, batch_index,
                                                  self.layer_index - 1),
                    "rb")))