#!/bin/sh


# Note: The data is Type1 files of IEEE single precision
# floats (32 bits) generated on a Sun workstation. This
# example MAY not run on your platform

echo "Lets look at some of the data"
abcd/abcd -d a16.df < show_a.cmd
abcd/abcd -d b16.df < show_b.cmd
abcd/abcd -d c16.df < show_c.cmd
abcd/abcd -d d16.df < show_d.cmd
gnuplot show_abcd.gnu


echo "Big Network"

# performance (just go forward)
echo "Performance Test..."
time abcd/abcd -d characters.df -f 1000

# learn
echo ""
echo "Learn..."
time abcd/abcd -l -s 1000 -t 200 500 0.2 -d characters.df -F abcd

# test
echo "Test..."
abcd/abcd abcd.Finished -d characters.df -E -P 0.4

# produce files for plotting weights
abcd/abcd < abcd/abcd.cmd

# plot with gnuplot 3.0
gnuplot abcd/abcd.gnu

echo "Simple Network"

# performance (just go forward)
echo "Performance Test..."
time simple/simple -d characters.df -f 1000

# learn
echo ""
echo "Learn..."
time simple/simple -l -s 1000 -t 200 500 0.2 -d characters.df -F simple

# test
echo "Test..."
simple/simple simple.Finished -d characters.df -E -P 0.4

# produce files for plotting weights
simple/simple < simple/simple.cmd

# plot with gnuplot 3.0
gnuplot simple/simple.gnu

echo
echo
echo
echo "Now we will analyze the data with the DataReduce utility."
echo "First we will run a principal components analysis of the"
echo "data to see if projection thru the first few components"
echo "gives any seperation, then we will repeat the process using"
echo "canonical discriminate (Fisher space) analysis."
echo
echo "The DataReduce utility is an interactive tool. However,"
echo "in this case a program will supply the input. After this"
echo "analysis you can re-run DataReduce interactively."

echo
echo "Now we will run pca."
echo "Type <cr> when ready"
read user_input

echo "Running: YourPcaResponses | DataReduce characters.df 16 16 4 1"
echo
YourPcaResponses | DataReduce characters.df 16 16 4 1

echo
echo "Now we will run cda."
echo "Type <cr> when ready"
read user_input

echo "Running: YourCdaResponses | DataReduce characters.df 16 16 4 1"
echo
YourCdaResponses | DataReduce characters.df 16 16 4 1

echo "Type <cr> when ready kill plots"
read user_input
for p in `ps | grep gnuplot | awk '{print $1}'`
do
	echo "Killing $p" ; kill -9 $p ;
done

/bin/rm -f ./rm_me*

echo ; echo ;
echo 'To re-run the analyses interactively, type: DataReduce characters.df 16 16 4 1'
echo ; echo ;
