CEBL
2.1
Main Page
Namespaces
Data Structures
Files
File List
Globals
model
Classifier.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
26
#ifndef CLASSIFIER_H
27
#define CLASSIFIER_H
28
29
#include <vector>
30
31
32
#include "../cppR/cppR.hpp"
33
#include "
Plugin.hpp
"
34
#include "
EEGTrainingData.hpp
"
35
#include "../Param.hpp"
36
37
38
39
namespace
CEBL
40
{
41
class
Classifier
:
public
Plugin
42
{
43
protected
:
44
bool
trained
;
45
bool
compute_probs
;
46
std::vector<std::vector<double> >
probabilities
;
47
//number of classes the classifier is using for classification
48
int
using_classes
;
49
int
using_lags
;
50
//number of classes the classifier is trained on
51
int
trained_classes
;
52
int
trained_lags
;
53
54
public
:
55
Classifier
(){
trained
=
false
;
compute_probs
=
true
;
using_classes
=
using_lags
=
trained_classes
=
trained_lags
=0; }
56
virtual
~Classifier
(){}
57
bool
isTrained
() {
return
trained
; }
58
59
/*
60
* called when training data changes
61
* use_classes is number of classes set to be used in classification
62
*/
63
void
reset
(
CEBL::Param
param)
64
{
65
int
use_classes = param.
getInt
();
66
//save number of classes to use for classification
67
if
(use_classes>=1)
68
using_classes
= use_classes;
69
70
/* lags is currently unused
71
* uncomment if use of lags reimplemented
72
73
int use_lags = (params["lags"]).getInt();
74
if(use_lags>=0)
75
using_lags = use_lags;
76
77
*/
78
}
79
85
virtual
bool
getProbabilitiesFlag
(){
return
compute_probs
; }
86
91
virtual
void
setProbabilitiesFlag
(
bool
flag){
compute_probs
= flag; }
92
93
94
101
virtual
std::vector<std::vector<double> >
getProbabilities
()
102
{
103
return
probabilities
;
104
}
105
106
int
getTrainedClasses
(){
return
trained_classes
; }
107
108
int
getTrainedLags
(){
return
trained_lags
; }
109
110
114
virtual
void
update
(
const
EEGTrainingData
&data)
115
{
116
train
(data);
117
}
118
119
120
//-----------------------------------------------------------------
121
//Functions to override below
122
125
virtual
void
train
(
const
EEGTrainingData
&) = 0;
126
131
virtual
ublas::vector<int>
use
(
const
ublas::matrix<double> &) = 0;
132
133
};
134
135
}
136
137
138
#endif
Generated by
1.8.1.1