2017-08-30 18:58:14 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-08-30 19:12:36 +00:00
|
|
|
if [[ $# -ne 1 ]]; then
|
2017-08-30 18:58:14 +00:00
|
|
|
echo "usage: $0 <DATA.csv>"
|
|
|
|
else
|
2017-08-30 19:12:36 +00:00
|
|
|
data="$1";
|
|
|
|
png="`echo $1 | sed -s "s/\.csv$//"`" # strip ending
|
|
|
|
(cat <<EOD
|
|
|
|
set datafile separator ","
|
2017-08-30 18:58:14 +00:00
|
|
|
f(x)=a*x+b
|
|
|
|
fit f(x) "$data" every ::1 using 2:5 via a,b
|
|
|
|
set terminal png
|
2017-10-24 11:22:20 +00:00
|
|
|
set xlabel 'Regularity'
|
|
|
|
set ylabel 'Iterations'
|
2017-08-30 18:58:14 +00:00
|
|
|
set output "${png}_regularity-vs-steps.png"
|
2017-10-01 18:06:41 +00:00
|
|
|
plot "$data" every ::1 using 2:5 title "data", f(x) title "lin. fit" lc rgb "black"
|
2017-08-30 19:12:36 +00:00
|
|
|
g(x)=aa*x+bb
|
|
|
|
fit g(x) "$data" every ::1 using 4:5 via aa,bb
|
2017-10-24 11:22:20 +00:00
|
|
|
set xlabel 'Improvement potential'
|
|
|
|
set ylabel 'Iterations'
|
2017-08-30 19:12:36 +00:00
|
|
|
set output "${png}_improvement-vs-steps.png"
|
2017-10-01 18:06:41 +00:00
|
|
|
plot "$data" every ::1 using 4:5 title "data", g(x) title "lin. fit" lc rgb "black"
|
2017-08-30 19:12:36 +00:00
|
|
|
h(x)=aaa*x+bbb
|
|
|
|
fit h(x) "$data" every ::1 using 4:6 via aaa,bbb
|
2017-10-24 11:22:20 +00:00
|
|
|
set xlabel 'Improvement potential'
|
|
|
|
set ylabel 'Fitting error'
|
2017-08-30 19:12:36 +00:00
|
|
|
set output "${png}_improvement-vs-evo-error.png"
|
2017-10-01 18:06:41 +00:00
|
|
|
plot "$data" every ::1 using 4:6 title "data", h(x) title "lin. fit" lc rgb "black"
|
2017-08-30 18:58:14 +00:00
|
|
|
EOD
|
2017-08-30 19:12:36 +00:00
|
|
|
) > "${png}.gnuplot.script"
|
|
|
|
gnuplot "${png}.gnuplot.script" 2> "${png}.gnuplot.log"
|
2017-08-30 18:58:14 +00:00
|
|
|
mv fit.log "${png}.gnuplot.fit.log"
|
|
|
|
fi
|