def load_finetuning_output_txt(self): txt = open(env_paths.get_dbn_output_txt_path(), "r") while True: line = txt.readline() if not line: break self.output_txt.append(line)
def load_finetuning_output_txt(self): txt = open(env_paths.get_dbn_output_txt_path(),"r") while True: line = txt.readline() if not line: break self.output_txt.append(line)
def save_output(self, finetuning = True): """ Save the output of the progress of the training process for the pretraining or the finetuning. @param finetuning: If finetuning is True, the error for finetuning should be saved and vice versa. """ p = env_paths.get_dbn_output_txt_path() if finetuning else env_paths.get_rbm_output_txt_path() out = open(p,"w") for elem in self.output_txt: out.write(elem+"\n") out.close() self.output_txt = []
def save_output(self, finetuning=True): """ Save the output of the progress of the training process for the pretraining or the finetuning. @param finetuning: If finetuning is True, the error for finetuning should be saved and vice versa. """ p = env_paths.get_dbn_output_txt_path( ) if finetuning else env_paths.get_rbm_output_txt_path() out = open(p, "w") for elem in self.output_txt: out.write(elem + "\n") out.close() self.output_txt = []
def save_dbn(weight_matrices,fine_tuning_error_train,fine_tuning_error_test,output = None): """ Save the deep belief network into serialized files. @param weight_matrices: the weight matrices of the deep belief network. """ s.dump([w.tolist() for w in weight_matrices] , open( env_paths.get_dbn_weight_path(), "wb" ) ) s.dump(fine_tuning_error_train , open( env_paths.get_dbn_training_error_path(), "wb" ) ) s.dump(fine_tuning_error_test , open( env_paths.get_dbn_test_error_path(), "wb" ) ) if not output == None: out = open(env_paths.get_dbn_output_txt_path(),"w") for elem in output: out.write(elem+"\n") out.close()
def save_dbn(weight_matrices, fine_tuning_error_train, fine_tuning_error_test, output=None): """ Save the deep belief network into serialized files. @param weight_matrices: the weight matrices of the deep belief network. """ s.dump([w.tolist() for w in weight_matrices], open(env_paths.get_dbn_weight_path(), "wb")) s.dump(fine_tuning_error_train, open(env_paths.get_dbn_training_error_path(), "wb")) s.dump(fine_tuning_error_test, open(env_paths.get_dbn_test_error_path(), "wb")) if not output == None: out = open(env_paths.get_dbn_output_txt_path(), "w") for elem in output: out.write(elem + "\n") out.close()