Commit 019ecb82 authored by Andrei Roibu's avatar Andrei Roibu
Browse files

deleted labels generator call

parent 3b1b237b
......@@ -72,10 +72,7 @@ class LogWriter():
self.current_iteration = 1
if labels is not None:
self.labels = self.labels_generator(labels)
else:
self.labels = ['rsfMRI']
self.labels = ['rsfMRI']
self.logger = logging.getLogger()
file_handler = logging.FileHandler(
......@@ -135,6 +132,33 @@ class LogWriter():
self.log_writer[phase].add_scalar('loss/epoch', loss, epoch)
def MSE_per_epoch(self, losses, phase, epoch, previous_loss=None):
"""Log function
This function records the loss for every epoch.
Args:
losses (list): Values of all the losses recorded during the training epoch
phase (str): Current run mode or phase
epoch (int): Current epoch value
previous_loss(float): Value of the previous epoch's loss
"""
loss = np.mean(losses)
if phase == 'train':
# loss = losses[-1]
print("MSE for Epoch {} of {} is: {}".format(epoch, phase, loss))
else:
# loss = np.mean(losses)
if previous_loss == None:
print("MSE for Epoch {} of {} is: {}".format(epoch, phase, loss))
else:
print("MSE for Epoch {} of {} is {} and Absolute Change is {}".format(epoch, phase, loss, previous_loss - loss))
self.log_writer[phase].add_scalar('MSE/epoch', loss, epoch)
def close(self):
"""Close the log writer
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment