Turbo-BrainVoyager v3.2

# SVM Access Functions

Since version 3.2 TBV provides access to classification output values calculated during real-time SVM classification. The tGetCurrentClassifierOutput() function provides both a single integral value informing which class is predicted at the current time point as well as a detailed vector of float values that can be used for custom classifier-based neurofeedback. The latter information is returned in a vector since the number of values depend on the number of classes used for classification (see below). It is, thus, important to call the tGetNumberOfClasses() function to ensure that the right number of values is used to prepare an array with sufficient size for retrieving the output values.

inttGetNumberOfClasses()

Provides the number of classes for which values are provided. In case that the real-time SVM classifier is not used, this function returns -3; in case that the real-time SVM classifier dialog is open but the classifier is not producing incremental output, this function returns -2; if the classifier is working but no output has been generated yet, this function returns 0. You only should use the tGetCurrentClassifierOutput() function (see below) if this function returns a positive value. Based on the returned (positive) value (assigned to e.g. variable *n_classes*), the size of the array needed for the tGetCurrentClassifierOutput() function can be calculated as the number of pair comparisons *n_pairs*:

*n_pairs* = *n_classes* * (*n_classes* - 1) / 2

inttGetCurrentClassifierOutput(float *output_array)

Provides results during real-time SVM classification for the current time point. The function returns an integral value indicating which class is predicted, i.e. which class label has been assigned to the current brain activity pattern. Note that the returned value is 1-based, i.e. if the first class is predicted, value 1 is returned, if the second class is predicted, value 2 is returned and so on. In addition to returning the predicted class, the function also fills a provided float array with detailed classification values. Since the SVM procedure internally finds the predicted class ("winner") by comparing the results obtained for all possible unique pairs of classes, the array needs to be large enough to receive all pairwise classification results (for calculation, see above). In case of a two-class problem, the array will contain only one entry for the pair "1 against 2" or "1-2". For multi-class (> 2) problems, the order of pairs will be starting with all pairs containing class 1 on the left side, then all remaining pairs that have class 2 on the left side and so on. For a 3-class problem, the order would be "1-2", "1-3", "2-3" and for a 4-class problem, the order would be "1-2", "1-3", "1-4", "2-3", "2-4" and "3-4". A positive value for a pair indicates that the class on the left side has "won" whereas a negative value indicates that the class on the right side has "won" the respective pairwise comparison; the size of the value(s) may be used to calculate a continuous value as a feedback signal.

As with the tGetNumberOfClasses() function, this function returns value -3 in case that the real-time SVM classifier is not open and -2 in case that the real-time SVM classifier dialog is open but the classifier is not producing incremental output. The function returns value -1 if the SVM dialog is used but no output data is available for the current time point. Only access the provided output_array if the returned value of the function is a positive number. Use the tGetNumberOfClasses() function to retrieve the number of classes from which you can calculate the number of pairs (see above) to determine the necessary size of the array used to receive the pairwise classification values. Consult the SVM Plugin sample code for an example how to use the SVM access functions.

Copyright © 2014 Rainer Goebel. All rights reserved.