Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update README.

  • Loading branch information...
commit b71874b519ba3b986deecc45fab8e05281a76a4c 1 parent 045ea92
@lmjohns3 authored
Showing with 27 additions and 13 deletions.
  1. +27 −13 README.md
View
40 README.md
@@ -31,14 +31,14 @@ in a log file as the experiments run. Here's a snippet from an example log file:
All of those "training accuracy" lines hidden in there will give us a good idea
of how well the algorithm is performing. To get a quick plot of them:
- cat ~/Experiments/tagger-beam1.log | py-grep-plot -r 'training accuracy: ([.\d]+)'
+ cat ~/Experiments/tagger-beam1.log | py-grep-plot -m 'training accuracy: (\S+)'
If you have your matplotlib configured with an interactive backend, you should
see a nice little plot appear.
The general usage of the script is
- py-grep-plot [--regex RE] < FILE
+ py-grep-plot [--match RE] < FILE
Basically, you provide a bunch of data on stdin, and, optionally, a regular
expression that specifies how to extract data from the files. The plotting
@@ -53,32 +53,46 @@ values will be plotted on the ordinate, in data-file order. If you want explicit
control over the abscissa, just include another match group in your regular
expression:
- nl ~/Experiments/tagger-beam1.log | py-grep-plot -r '^(\d+) .* training accuracy: ([.\d]+)'
+ nl ~/Experiments/tagger-beam1.log | py-grep-plot -m '^(\d+) .* training accuracy: (\S+)'
(The `nl` utility numbers the lines of the input file.)
If you provide three match groups per line, the first is plotted along the
abscissa, the second along the ordinate, and the third gives the size of an
-error bar along the ordinate.
+error bar along the ordinate. Use the `--fill-error` flag to plot error regions
+using a shaded polygon instead of bars on the data points.
+
+To get even more sophisticated, name your match groups to specify them in an
+alternate order. For instance, if your log file had `0.33 +/- 0.01` you could
+include error bars like so:
+
+ nl ~/Experiments/tagger-beam1.log | py-grep-plot -m \
+ '^(?P<x>\d+) .* training accuracy: (?P<y>\S+) ... (?P<ey>\S+)'
+
+You can specify match groups for `x`, `y`, `ex` (error in the abscissa) and `ey`
+(error in the ordinate).
### Multiple series
You can also provide multiple input files, and the script will show multiple
data series on the same plot:
- py-grep-plot [--regex RE] FILE...
+ py-grep-plot [--match RE] FILE...
-Each file will use the same regular expression for matching data.
+By default, each file will use the same regular expression for matching data.
#### Multiple series from one file
-If you're working with a shell like bash, you can do some rad stuff to get
-multiple series out of one file. For instance, let's say you have one log file
-that contains `training accuracy: XX` and `evaluation accuracy: XX` lines that
-you'd like to plot. You can use the nifty subshell redirection operator to sort
-these two data sources:
+Alternatively, you can specify just one data file and multiple regular
+expressions. For instance, let's say you have one log file that contains
+`training accuracy: XX` and `evaluation accuracy: XX` lines that you'd like to
+plot. You can grab these lines and put them in separate series on your plot:
+
+ py-grep-plot -m 'training accuracy: (\S+)' 'evaluation accuracy: (\S+)' < training.log
- py-grep-plot -r 'accuracy: (\d+)' <(grep 'training acc' file) <(grep 'evaluation acc' file)
+In this case, it's probably easier to pass input to the script using a shell
+redirection, because the `-m` option will slurp up anything that comes after it
+(that's not itself a flag).
### Smoothing
@@ -98,7 +112,7 @@ overview.
(The MIT License)
-Copyright (c) 2011-2012 Leif Johnson <leif@leifjohnson.net>
+Copyright (c) 2011-2013 Leif Johnson <leif@leifjohnson.net>
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the 'Software'), to deal in
Please sign in to comment.
Something went wrong with that request. Please try again.