#! /bin/sh

if test -s ntalk.train
then
	echo "Found ntalk.train"
else
	echo "Creating training set..."
	ntalk.list
	echo "Done"
fi
	
echo "Performance Test..."
time ntalk -f 100000
echo ""

echo "Once thru ntalk.train = 5603 iterations (once for every letter)"
echo "Going 30 times thru training set (~168,000 iterations)"
time ntalk -l -N -s 14000 -I 28000
mv Network.save ntalk5.dump
echo "I saved the state after 5 passes in: ntalk5.dump"
time ntalk -l -N -I 140000  ntalk5.dump
mv Network.save ntalk30.dump
echo "I saved the state after 30 pases in: ntalk30.dump"

echo ""
echo "Let's see how well it does after 5 passes"
Performance ntalk5.dump ntalk.train `cat ntalk.train | wc -l`

echo ""
echo "Let's see how well it does after 30 passes"
Performance ntalk30.dump ntalk.train `cat ntalk.train | wc -l`

echo ""
echo "Let's see how well it does after 30 passes"
echo "ON THE WHOLE DATABASE!!! (be patient)"
Performance ntalk30.dump ntalk.data `cat ntalk.data | wc -l`

echo ""
echo "Okay, let's continue training ON THE WHOLE DATABASE!!! (be patient)"
echo "Gotta recompile with new data file in user_init.c"
touch user_init.c
/bin/cp data.h user.h
bpmake
/bin/cp train.h user.h

echo ""
echo "Once thru ntalk.data = 146943 iterations (once for every letter)"
echo "Going 5 times thru WHOLE DATABASE (~750,000 iterations)"
echo "BE PATIENT!!!"
time ntalk -l -N -s 50000 -I 750000 ntalk30.dump
mv Network.save ntalk.final.dump

echo ""
echo "Let's see how well it does after 5 passes"
echo "ON THE WHOLE DATABASE!!! (be patient)"
Performance ntalk.final.dump ntalk.data `cat ntalk.data | wc -l`



