Exemple #1
0
 public void Reset()
 {
     af7.Clear();
     af8.Clear();
     tp9.Clear();
     tp10.Clear();
     TrainingValues.Clear();
     AlphaTrainingValues.Clear();
     trainer  = null;
     training = false;
     readingsMean.Clear();
     status = EyesStatus.NONE;
     ignore = SKIP;
 }
Exemple #2
0
        private void RunFFT()
        {
            readingsMean.Clear();

            for (int i = 0; i < af7.Count; i++)
            {
                readingsMean.Add(af7[i] + tp9[i] + tp10[i] + af8[i] / FEATURE_COUNT);
            }

            CalculateFFT(readingsMean, FFTResults);
            CalculateFFT(af7, AF7FFT);
            CalculateFFT(af8, AF8FFT);
            CalculateFFT(tp9, TP9FFT);
            CalculateFFT(tp10, TP10FFT);

            if (!Training || (Training && ignore == 0))
            {
                TrainingValue trainingValue = new TrainingValue((int)Status, FEATURE_COUNT);
                trainingValue.Features[0] = PSD(TP9FFT, FREQ_STEP);
                trainingValue.Features[1] = PSD(AF7FFT, FREQ_STEP);
                trainingValue.Features[2] = PSD(AF8FFT, FREQ_STEP);
                trainingValue.Features[3] = PSD(TP10FFT, FREQ_STEP);

                if (!Training && trainer != null && trainer.Trained)
                {
                    Status = (EyesStatus)trainer.Predict(trainingValue);
                }

                if (training || keepTrainingData)
                {
                    TrainingValues.Add(trainingValue);
                }
            }
            else if (Training && ignore != 0)
            {
                ignore--;
            }
        }