source: trunk/lib/classifier/NCC.h @ 456

Last change on this file since 456 was 456, checked in by Markus Ringnér, 16 years ago

Updated to use DataViews?

File size: 1.3 KB
Line 
1// $Id$
2
3#ifndef _theplu_classifier_ncc_
4#define _theplu_classifier_ncc_
5
6#include <c++_tools/classifier/DataView.h>
7#include <c++_tools/gslapi/matrix.h>
8#include <c++_tools/statistics/Score.h>
9
10#include <map>
11
12namespace theplu {
13namespace classifier { 
14
15  class Score;
16
17  ///
18  /// Class for Nearest Centroid Classification
19  ///
20
21  class NCC
22  {
23 
24  public:
25    ///
26    /// Default constructor (not implemented)
27    ///
28    NCC();
29
30    ///
31    /// Constructor taking the training data and the target vector as
32    /// input. Performs the training of the NCC.
33    ///
34    NCC(const DataView&, const gslapi::vector&);
35
36    ///
37    /// @todo Copy constructor.
38    ///
39    NCC(const NCC&);
40
41    ///
42    /// @todo The istream constructor.
43    ///
44    NCC(std::istream&);
45         
46    const gslapi::matrix& centroids(void) const {return centroids_;}
47
48    const std::map<double,u_int>& classes(void) const {return classes_;}
49   
50
51    ///
52    /// Calculate the scores to each centroid for a test sample
53    ///
54    void predict(const gslapi::vector&, statistics::Score&, 
55                 gslapi::vector&);
56   
57  private:
58    gslapi::matrix centroids_;
59    std::map<double,u_int> classes_;
60  };
61
62  ///
63  /// The output operator for the NCC class.
64  ///
65  std::ostream& operator<< (std::ostream&, const NCC&);
66 
67 
68}} // of namespace classifier and namespace theplu
69
70#endif
Note: See TracBrowser for help on using the repository browser.