#makes a temporary directory
mkdir out

# output is dumped to c.w.d., so change to out
cd out

#make the mock data,
# using -nrec 1000 will make pix seen on web page
../make_mock_data.py --nrec 1000 --noise .1 > mock.dat

#split data into training data and verification data
#splitfile.pl mock.dat 1 1
splitfile.py mock.dat 1 1

#run the neural network program
nn < ../mock.input

#run the singular value decomposition program for linear fit
svd < ../mock.input

#plot a history of the training session, which is in mse.dat
mseplot.py nn_mse.dat mse.svg -t 'm.s.e. history' --yl 'm.s.e.'  --xl 'data passes'
inkscape -e mse.png mse.svg

#plot target vs. neural network prediction for verification data
hashplot.py nn_b.dat nn_b.svg --cx 2 --cy 4 -t 'neural network prediction' --xl 'target value' --yl 'predicted value'
inkscape -e nn_b.png nn_b.svg

#plot target vs. svd prediction for verification data
hashplot.py svd_b.dat svd_b.svg --cx 2 --cy 4 -t 'linear prediction' --xl 'target value' --yl 'predicted value'
inkscape -e svd_b.png svd_b.svg

#Give a report of mean square of (prediction-target) and 
#mean square of target. this info is tucked away as comments
#in the target|prediction output files.
grep 'mse=' nn_*.dat svd_*.dat

#display the history of mse to monitor
display mse.png
