#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.pl -nrec 1000 -noise .1 > mock.dat

#split data into training data and verification data
splitfile.pl 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.pl -a training -b verification -ymax .1 -alpha -batch
convert mse.eps mse.png

#plot target vs. neural network prediction for verification data
hashplot.pl nn_b.dat 2 4 nn_b.eps -xy -s -t 'neural network prediction' -batch
convert nn_b.eps nn_b.png

#plot target vs. svd prediction for verification data
hashplot.pl svd_b.dat 2 4 svd_b.eps -xy -s -t 'linear prediction' -batch
convert svd_b.eps svd_b.png

#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
