def export_histories(self, path):
if not os.path.exists(path):
os.makedirs(path)
i = np.arange(len(self.loss_history)) + 1
z = np.array(zip(i, i*self.batch_size, self.loss_history))
np.savetxt(path + 'loss_history.csv', z, delimiter=',', fmt=[
'%d', '%d', '%f'], header='iteration, n_images, loss')
i = np.arange(len(self.train_acc_history), dtype=np.int)
z = np.array(zip(i, self.train_acc_history))
np.savetxt(path + 'train_acc_history.csv', z, delimiter=',', fmt=[
'%d', '%f'], header='epoch, train_acc')
z = np.array(zip(i, self.val_acc_history))
np.savetxt(path + 'val_acc_history.csv', z, delimiter=',', fmt=[
'%d', '%f'], header='epoch, val_acc')
np.save(path + 'loss', self.loss_history)
np.save(path + 'train_acc_history', self.train_acc_history)
np.save(path + 'val_acc_history', self.val_acc_history)
评论列表
文章目录