yat  0.10.4pre
NBC.h
1 #ifndef _theplu_yat_classifier_nbc_
2 #define _theplu_yat_classifier_nbc_
3 
4 // $Id: NBC.h 2119 2009-12-12 23:11:43Z peter $
5 
6 /*
7  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
8  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2008 Jari Häkkinen, Peter Johansson, Markus Ringnér
10 
11  This file is part of the yat library, http://dev.thep.lu.se/yat
12 
13  The yat library is free software; you can redistribute it and/or
14  modify it under the terms of the GNU General Public License as
15  published by the Free Software Foundation; either version 3 of the
16  License, or (at your option) any later version.
17 
18  The yat library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  General Public License for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with yat. If not, see <http://www.gnu.org/licenses/>.
25 */
26 
27 #include "SupervisedClassifier.h"
28 #include "yat/utility/Matrix.h"
29 
30 namespace theplu {
31 namespace yat {
32 namespace classifier {
33 
34  class MatrixLookup;
35  class MatrixLookupWeighted;
36  class Target;
37 
46  class NBC : public SupervisedClassifier
47  {
48 
49  public:
53  NBC(void);
54 
55 
59  virtual ~NBC();
60 
61 
62  NBC* make_classifier(void) const;
63 
74  void train(const MatrixLookup&, const Target&);
75 
88  void train(const MatrixLookupWeighted&, const Target&);
89 
110  void predict(const MatrixLookup& data, utility::Matrix& result) const;
111 
133  void predict(const MatrixLookupWeighted& data,utility::Matrix& result) const;
134 
135 
136  private:
137  void standardize_lnP(utility::Matrix& prediction) const;
138 
139  utility::Matrix centroids_;
140  utility::Matrix sigma2_;
141 
142  double sum_logsigma(size_t i) const;
143 
144 
145  };
146 
147 }}} // of namespace classifier, yat, and theplu
148 
149 #endif

Generated on Mon Nov 11 2013 09:41:44 for yat by  doxygen 1.8.1