private void PopulateDataSets()
{
foreach (UserDataSet uData in dataset)
{
//1-construct/prune the 'ToTrain' collection for training the Classifier
//add all training samples into the 'ToTrain' collection.
//sort training samples into classes
foreach (GestureSample sample in uData.TrainingSamples)
if (Config.GesturesToUse.Contains(sample.Gesture))
ToTrain[sample.Gesture].Add(sample);
}
//randomely remove excess samples from the 'ToTrain' collection until it meets the specified setting in the experiment configuration.
//the removed excess samples are put in the 'ToRecognize_Training' for the experiment.
Random randGenerator = new Random((int)DateTime.Now.Ticks);
foreach (GestureType gesture in Config.GesturesToUse)
{
while ((ToTrain[gesture].Count - Config.NumTrainingSamples) != 0)
{
int randomIndex = randGenerator.Next() % ToTrain[gesture].Count;
ToRecognize_Training[gesture].Add(ToTrain[gesture].ElementAt(randomIndex));
ToTrain[gesture].RemoveAt(randomIndex);
}
}
}