SharpBCI
A multi-threaded brain control interface (BCI) library in C#
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Properties Pages
SharpBCI.Predictor Class Referenceabstract

An IPredictor which uses a 3-dimensional loci of points in the form of an array of EEGEvent's to classify EEG data Uses nearest neighbor predictions with distance computed by the abstract Compute(double[] x, double[] y) function Predictions occur by computing the distance between the incoming sample and all training samples, pulls the k nearest neighbors, and determines the final prediction. More...

Inheritance diagram for SharpBCI.Predictor:
SharpBCI.IPredictor< T > SharpBCI.AggregateKNNCorrelationPredictor SharpBCI.AggregateKNNDTWPredictor

Public Member Functions

 Predictor (int channels, int k, double thresholdProb, EEGDataType[] bands)
 
void AddTrainingData (int id, EEGEvent[] events)
 
void ClearTrainingData ()
 Clears all training data stored within the predictor Essentially a reset of the entire prediction system Use between changing environments and/or participants. More...
 
void SetChannelWeights (double[] newWeights)
 
void SetBandWeights (double[] newWeights)
 
int Predict (EEGEvent[] events)
 
List< KeyValuePair< int, double > > ComputeDistances (double[][] data)
 
int Vote (List< KeyValuePair< int, double >> distances)
 
- Public Member Functions inherited from SharpBCI.IPredictor< T >
void AddTrainingData (int label, T data)
 Add data to labeled training data set. More...
 
int Predict (T test)
 Makes a prediction from the underlying model based off the new data. More...
 

Public Attributes

const int NO_PREDICTION = -1
 see AggregatePredictionPipeable.NO_PREDICTION More...
 

Protected Member Functions

abstract double Compute (double[] x, double[] y)
 

Protected Attributes

readonly Dictionary
< EEGDataType, int > 
bandLookup = new Dictionary<EEGDataType, int>()
 Dictionary which maps EEGDataTypes to integers for easy indexing into the buffer. More...
 
readonly Dictionary< int, List
< double[][]> > 
trainingData = new Dictionary<int, List<double[][]>>()
 Dictionary storing all training data. More...
 
readonly EEGDataType[] bands
 List of EEGDataTypes that the predictor expects for its training and predictions. More...
 
readonly int channels
 Number of channels on the headset, as reported by. More...
 
readonly int k
 A non-negative non-zero integer representing the number of results from KNN algorithm. More...
 
readonly double thresholdProb
 A double between 0-1 indicating the probability threshhold below which predictions will be thrown out. More...
 
double[] bandWeights
 
double[] channelWeights
 

Detailed Description

An IPredictor which uses a 3-dimensional loci of points in the form of an array of EEGEvent's to classify EEG data Uses nearest neighbor predictions with distance computed by the abstract Compute(double[] x, double[] y) function Predictions occur by computing the distance between the incoming sample and all training samples, pulls the k nearest neighbors, and determines the final prediction.

Constructor & Destructor Documentation

SharpBCI.Predictor.Predictor ( int  channels,
int  k,
double  thresholdProb,
EEGDataType[]  bands 
)

Member Function Documentation

void SharpBCI.Predictor.AddTrainingData ( int  id,
EEGEvent[]  events 
)
void SharpBCI.Predictor.ClearTrainingData ( )

Clears all training data stored within the predictor Essentially a reset of the entire prediction system Use between changing environments and/or participants.

Implements SharpBCI.IPredictor< T >.

abstract double SharpBCI.Predictor.Compute ( double[]  x,
double[]  y 
)
protectedpure virtual
List<KeyValuePair<int, double> > SharpBCI.Predictor.ComputeDistances ( double  data[][])
int SharpBCI.Predictor.Predict ( EEGEvent[]  events)
void SharpBCI.Predictor.SetBandWeights ( double[]  newWeights)
void SharpBCI.Predictor.SetChannelWeights ( double[]  newWeights)
int SharpBCI.Predictor.Vote ( List< KeyValuePair< int, double >>  distances)

Member Data Documentation

readonly Dictionary<EEGDataType, int> SharpBCI.Predictor.bandLookup = new Dictionary<EEGDataType, int>()
protected

Dictionary which maps EEGDataTypes to integers for easy indexing into the buffer.

readonly EEGDataType [] SharpBCI.Predictor.bands
protected

List of EEGDataTypes that the predictor expects for its training and predictions.

double [] SharpBCI.Predictor.bandWeights
protected
readonly int SharpBCI.Predictor.channels
protected

Number of channels on the headset, as reported by.

See Also
SharpBCIAdapter
double [] SharpBCI.Predictor.channelWeights
protected
readonly int SharpBCI.Predictor.k
protected

A non-negative non-zero integer representing the number of results from KNN algorithm.

https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm

const int SharpBCI.Predictor.NO_PREDICTION = -1
readonly double SharpBCI.Predictor.thresholdProb
protected

A double between 0-1 indicating the probability threshhold below which predictions will be thrown out.

readonly Dictionary<int, List<double[][]> > SharpBCI.Predictor.trainingData = new Dictionary<int, List<double[][]>>()
protected

Dictionary storing all training data.

Key is the label of the value's data Value is a list of data associated with this label


The documentation for this class was generated from the following file: