00001 #ifndef _theplu_yat_classifier_nbc_
00002 #define _theplu_yat_classifier_nbc_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "SupervisedClassifier.h"
00028 #include "yat/utility/Matrix.h"
00029
00030 namespace theplu {
00031 namespace yat {
00032 namespace classifier {
00033
00034 class MatrixLookup;
00035 class MatrixLookupWeighted;
00036 class Target;
00037
00046 class NBC : public SupervisedClassifier
00047 {
00048
00049 public:
00053 NBC(void);
00054
00055
00059 virtual ~NBC();
00060
00061
00062 NBC* make_classifier(void) const;
00063
00074 void train(const MatrixLookup&, const Target&);
00075
00088 void train(const MatrixLookupWeighted&, const Target&);
00089
00110 void predict(const MatrixLookup& data, utility::Matrix& result) const;
00111
00133 void predict(const MatrixLookupWeighted& data,utility::Matrix& result) const;
00134
00135
00136 private:
00137 void standardize_lnP(utility::Matrix& prediction) const;
00138
00139 utility::Matrix centroids_;
00140 utility::Matrix sigma2_;
00141
00142 double sum_logsigma(size_t i) const;
00143
00144
00145 };
00146
00147 }}}
00148
00149 #endif