re-coded test/training data generation and units.

implementation of test/training data has been generalized. Unit test
now calculates average accuracy across 10 runs.