-for n in 2 12; do
- ./dyncnn.lua --heavy --dataDir=./data/10p-mg/ \
- --learningStateFile="${DYNCNN_RESULT_DIR}"/epoch_01000_model \
- --resultDir="${DYNCNN_RESULT_DIR}" \
- --noLog \
- --exampleInternals=${n}
-done
+######################################################################
+# Plot the loss curves if gnuplot is here
+
+if [[ $(which gnuplot) ]]; then
+ cat <<EOF
+***************************************************************************
+ Plots the loss curves
+***************************************************************************
+EOF
+
+ TERMINAL="pdfcairo color transparent enhanced font \"Times,14\""
+ EXTENSION="pdf"
+
+ gnuplot <<EOF
+set terminal ${TERMINAL}
+set output "${DYNCNN_RUNDIR}/losses.${EXTENSION}"
+set logscale x
+set logscale y
+set size ratio 0.75
+set xlabel "Number of epochs"
+set ylabel "Loss"
+plot '< grep "acc_train_loss" "${DYNCNN_RUNDIR}"/log' using 4:8 with l lw 3 lc rgb '#c0c0ff' title 'Validation loss',\
+ '< grep "acc_train_loss" "${DYNCNN_RUNDIR}"/log' using 4:6 with l lw 1 lc rgb '#000000' title 'Train loss'
+
+EOF
+
+fi