Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Andrei-Claudiu Roibu
BrainMapper
Commits
019ecb82
Commit
019ecb82
authored
Jul 15, 2020
by
Andrei Roibu
Browse files
deleted labels generator call
parent
3b1b237b
Changes
1
Hide whitespace changes
Inline
Side-by-side
utils/data_logging_utils.py
View file @
019ecb82
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment