Created
November 21, 2016 18:22
-
-
Save Logrus/16412952fc890f16f289de3d8e08fd2c to your computer and use it in GitHub Desktop.
plot_loss_py.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cat *log | grep -o ".Loss.[0-9]*\.[0-9]*" | grep -o "[0-9]*\.[0-9]*" > loss_values.txt | |
num=51 | |
if [ $# -eq 1 ]; then | |
num=$1 | |
fi | |
python -c "import numpy as np; from scipy.signal import savgol_filter; y=np.loadtxt('loss_values.txt'); yh=savgol_filter(y, $num, 3); np.savetxt('smoothed_values.txt',yh);" | |
( | |
gnuplot <<- EOF | |
set terminal jpeg | |
set xlabel "Iterations" | |
set ylabel "Loss" | |
set style line 1 lt 1 pt 1 lw 2 lc rgb "blue" | |
plot "smoothed_values.txt" ls 1 | |
EOF | |
) > smoothed_loss.jpg | |
xdg-open smoothed_loss.jpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment