00001 #ifndef __MonoGaussianClassifier__ 00002 #define __MonoGaussianClassifier__ 00003 00022 #include <math.h> 00023 #include "ASeparateFeatureClassifier.hpp" 00024 00025 class MonoGaussianClassifier : public ASeparateFeatureClassifier 00026 { 00027 protected: 00028 00029 double meanValue; 00030 double sigma; 00031 00032 double root2PI; 00033 00034 protected: 00035 00036 virtual double reducedValue(double feature){ return ((feature-meanValue)/(sigma+1e-12)); } 00037 00038 public: 00039 00040 00041 MonoGaussianClassifier():ASeparateFeatureClassifier(1) 00042 {meanValue=0.0; sigma= 0.0; root2PI= sqrt(2.0*PI);} 00043 virtual ~MonoGaussianClassifier(){} 00044 00045 virtual double distance2(double feature){ double rval= feature-meanValue; return rval*rval; } 00046 00047 // probability 00048 virtual double P(double feature); 00049 00050 // likelihood 00051 virtual double L(double feature); 00052 00053 virtual void output(FILE* file); 00054 00055 virtual void output() 00056 { 00057 printf("A Mono Gaussian Classifier"); 00058 } 00059 }; 00060 00061 #endif