CEBL  2.1
Decision.hpp
Go to the documentation of this file.
1 /*
2 * CEBL : CSU EEG Brain-Computer Interface Lab
3 *
4 * Author: Jeshua Bratman - jeshuabratman@gmail.com
5 *
6 * This file is part of CEBL.
7 *
8 * CEBL is free software; you can redistribute it and/or modify it.
9 * We only ask that if you use our code that you cite the source in
10 * your project or publication.
11 *
12 * EEG Group (www.cs.colostate.edu/eeg)
13 * Department of Computer Science
14 * Colorado State University
15 *
16 */
17 
27 #ifndef DECISION_H
28 #define DECISION_H
29 
30 #include <vector>
31 #include "Plugin.hpp"
32 
33 
34 namespace CEBL
35 {
36 
37  class Decision : public Plugin
38  {
39  protected:
41  public:
42  virtual ~Decision()
43  {
44  num_classes = 3;
45  }
46 
47 
51  virtual void init(int num_classes)
52  {
53  this->num_classes = num_classes;
54  };
55 
56 
60  virtual void updateWithClassification(ublas::vector<int> classes)
61  {
62  for(unsigned i=0; i<classes.size();i++)
63  updateWithClassification(classes[i]);
64  }
65 
67  void updateWithProbabilities(std::vector<std::vector<double> > probs)
68  {
69  for(unsigned i=0; i<probs.size();i++)
70  updateWithProbabilities(probs.at(i));
71  }
72 
78  virtual void updateWithClassification(int cls)
79  {
80  std::vector<double> probs;
81  for(int j=0;j<num_classes;j++)
82  {
83  if(j==cls)
84  probs.push_back(1.0);
85  else
86  probs.push_back(0.0);
87  }
89  }
90 
91  //------------------------------------------------------------
92  // PURE VIRTUAL FUNCTIONS BELOW
93 
94 
100  virtual void updateWithProbabilities(std::vector<double> probs) = 0;
101 
102 
107  virtual std::vector<double> decideClasses() = 0;
108 
109 
110  };
111 }
112 
113 
114 
115 #endif