void CheckBufferAndPredict() { //Ensure the buffer is full for (int i = 0; i < buffer.Length; i++) { if (buffer[i] == null) { return; } } //If the predictor is in its prediction state, predict and pass on the result if (trainingId == ID_PREDICT) { var prediction = predictor.Predict(buffer); if (prediction != NO_PREDICTION) { Logger.Log(string.Format("Predicted: {0}", prediction)); Add(new TrainedEvent(prediction)); } } //Otherwise add the data to the training data set at the corresponding label else { predictor.AddTrainingData(trainingId, buffer); } //Reset the buffer buffer = new EEGEvent[types.Length]; }