Commit 4e504dbc authored by Florian RICHOUX's avatar Florian RICHOUX

Script for spotting min val_loss

Former-commit-id: 7a6eb308
parent 587f7cfb
import sys
def usage():
print("Usage: {} FILE".format(sys.argv[0]))
def extract_min_loss(data):
lines = open(data, 'r')
min_loss = 999
epoch = ""
val_acc = ""
for line in lines.readlines():
if "val_loss" in line:
loss = float(line.split(", val_loss=")[1])
if loss < min_loss:
min_loss = loss
epoch = line.split(":")[0]
if epoch in line and "val_acc" in line:
val_acc = line.split(", val_acc=")[1]
return epoch, min_loss, val_acc
if __name__ == '__main__':
if len(sys.argv) != 2:
epoch, val_loss, val_acc = extract_min_loss( sys.argv[1] )
print("Epoch: {}, val_loss={}, val_acc={}".format( epoch, val_loss, val_acc ) )
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