GestureRecognitionToolkit
Version: 0.1.0
The Gesture Recognition Toolkit (GRT) is a cross-platform, open-source, c++ machine learning library for real-time gesture recognition.
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
SoftmaxModel.h
Go to the documentation of this file.
1
29
#ifndef GRT_SOFTMAX_MODEL_HEADER
30
#define GRT_SOFTMAX_MODEL_HEADER
31
32
#include "../../CoreModules/Classifier.h"
33
34
GRT_BEGIN_NAMESPACE
35
36
class
SoftmaxModel
{
37
public
:
38
SoftmaxModel
(){
39
classLabel = 0;
40
N = 0;
41
}
42
~
SoftmaxModel
(){
43
44
}
45
46
bool
init(UINT classLabel,UINT N){
47
this->classLabel = classLabel;
48
this->N = N;
49
50
//Resize the weights
51
w.clear();
52
w.
resize
(N);
53
54
//Randomize the weights
55
Random
rand;
56
for
(UINT i=0; i<N; i++){
57
w[i] = rand.
getRandomNumberUniform
(-0.1,0.1);
58
}
59
w0 = rand.
getRandomNumberUniform
(-0.1,0.1);
60
61
return
true
;
62
}
63
64
Float compute(
const
VectorFloat
&x){
65
Float sum = w0;
66
for
(UINT i=0; i<N; i++){
67
sum += x[i]*w[i];
68
}
69
return
(1.0 / (1.0+exp(-sum)));
70
}
71
72
UINT classLabel;
73
UINT N;
//The number of dimensions
74
VectorFloat
w;
//The coefficents
75
Float w0;
76
77
};
78
79
GRT_END_NAMESPACE
80
81
#endif //SoftmaxModel
82
Random
Definition:
Random.h:40
Vector::resize
virtual bool resize(const unsigned int size)
Definition:
Vector.h:133
SoftmaxModel
Definition:
SoftmaxModel.h:36
VectorFloat
Definition:
VectorFloat.h:33
Random::getRandomNumberUniform
Float getRandomNumberUniform(Float minRange=0.0, Float maxRange=1.0)
Definition:
Random.h:198
GRT
ClassificationModules
Softmax
SoftmaxModel.h
Generated on Sun Feb 21 2016 20:06:27 for GestureRecognitionToolkit by
1.8.11