9 #ifndef CLASSIFIER_THRESHOLD_HEADER
10 #define CLASSIFIER_THRESHOLD_HEADER
12 #include "EstimatedGaussianDistribution.h"
41 void *GetDistribution(
int target)
const;
48 inline float SquareDistance(
const float *a,
const float *b,
int N)
const {
50 for (
int i = 0; i < N; i++) {
51 d += (a[i] - b[i]) * (a[i] - b[i]);
63 if (posSamples != NULL)
65 if (negSamples != NULL)
71 posSamples->Update(feature.data);
73 negSamples->Update(feature.data);
77 float dPos = SquareDistance(feature.data, posSamples->mean, N);
78 float dNeg = SquareDistance(feature.data, negSamples->mean, N);
79 if (dPos == 0.0f && dNeg == 0.0f) {
82 return dPos < dNeg ? 1 : -1;
void Update(const Feature &feature, int target)
Definition: ClassifierThreshold.h:69
void Reset()
Definition: ClassifierThreshold.h:92
Definition: EstimatedGaussianDistribution.h:10
Definition: ClassifierThreshold.h:15
int Classify(const Feature &feature) const
Definition: ClassifierThreshold.h:76