Figure Classifiers and artifact detection panel Figure 15 Individual classifier configuration tab Figure Classes panel Figure 17 Individual class configuration tab Figure Image classification tool IEnumerable<EEGDataEntry[]> trials = /* Get trial data from somewhere */; int minCount = trials.Min(t => t.Length); var examples = trials.Select(t => { var means = Channels.Values.Select(ch => t.Select(e => e[ch]).Average()).ToArray(); return new Example(t[0].Marker, t.Take(minCount) .SelectMany(e => e.Select((d, i) => d - means[i])) .Concat(means)); }).ToArray(); Figure 19 Data processing in C# This code example demonstrates many powerful data processing features of C#. The purpose of this code is to convert a sequence (IEnumerable) of trials (each represented by an array of into an array of which can be fed to a classifier. This requires EEGDataEntries) Examples flattening the multi-dimensional data in each trial (some number of entries x 14 worth channel’s of data per entry) into a single sequence of voltage values. Along the way we also want to subtract out the mean voltage value along each channel, and then append these mean values to the end of the feature sequence. Furthermore, since by chance some trials have a few more examples than others, we need to ensure that the resultant example feature sets are trimmed such that the features in each example line up regardless of the length of the original trial. In many popular programming languages, this would require many lines of code with multiple loops. In C#, we require neither. This code may seem arcane at first, but it is easy to break down. The code is peppered with inline anonymous functions (also called lambda functions). These functions are designated with the => operator, which can be interpreted as Thus the anonymous function t => t.Length “goes to”.
Figure Classifiers and artifact detection panel Figure 15 Individual classifier configuration tab Figure Classes panel Figure 17 Individual class configuration tab Figure Image classification tool IEnumerable<EEGDataEntry[]> trials = /* Get trial data from somewhere */; int minCount = trials.Min(t => t.Length); var examples = trials.Select(t => { var means = Channels.Values.Select(ch => t.Select(e => e[ch]).Average()).ToArray(); return new Example(t[0].Marker, t.Take(minCount) .SelectMany(e => e.Select((d, i) => d - means[i])) .Concat(means)); }).ToArray(); Figure 19 Data processing in C# This code example demonstrates many powerful data processing features of C#. The purpose of this code is to convert a sequence (IEnumerable) of trials (each represented by an array of EEGDataEntries) into an array of Examples which can be fed to a classifier. This requires flattening the multi-dimensional data in each trial (some number of entries x 14 channel’s worth of data per entry) into a single sequence of voltage values. Along the way we also want to subtract out the mean voltage value along each channel, and then append these mean values to the end of the feature sequence. Furthermore, since by chance some trials have a few more examples than others, we need to ensure that the resultant example feature sets are trimmed such that the features in each example line up regardless of the length of the original trial. In many popular programming languages, this would require many lines of code with multiple loops. In C#, we require neither. This code may seem arcane at first, but it is easy to break down. The code is peppered with inline anonymous functions (also called lambda functions). These functions are designated with the => operator, which can be interpreted as “goes to”. Thus the anonymous function t => t.Length
ExperimenterReport.docx