Skip to content

Instantly share code, notes, and snippets.

@Seanny123
Created April 26, 2016 16:56
Show Gist options
  • Save Seanny123/43c58cbd88b01ca2d20458d77d18e680 to your computer and use it in GitHub Desktop.
Save Seanny123/43c58cbd88b01ca2d20458d77d18e680 to your computer and use it in GitHub Desktop.
Simple script for parsing Keras training console output and putting it into a Pandas dataframe
import pandas as pd
import numpy as np
from collections import OrderedDict
import re
import ipdb
terms = OrderedDict([
("loss", []),
("acc", []),
("val_loss", []),
("val_acc", [])
])
with open("result", "r") as fi:
lines = fi.readlines()
for li in lines:
if "60000/60000" in li:
res = re.findall("\d*\.\d*", li)
r_i = 0
for term, val in terms.iteritems():
val.append(res[r_i])
r_i += 1
pd.DataFrame(terms)
ipdb.set_trace()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment