source: trunk/lib/classifier/SupervisedClassifier.h @ 525

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

Added structure to Supervised classifier and NCC to support ranking inputs with a statistics::Score and using only top-scoring inputs in classification.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 1.5 KB
Line 
1// $Id: SupervisedClassifier.h 525 2006-02-24 16:29:22Z markus $
2
3#ifndef _theplu_classifier_supervisedclassifier_
4#define _theplu_classifier_supervisedclassifier_
5
6#include <cctype>
7
8namespace theplu {
9
10  namespace gslapi {
11    class vector;
12    class matrix;
13  }
14
15  namespace statistics {
16    class Score;
17  }
18
19
20namespace classifier { 
21
22  class DataLookup2D;
23  class InputRanker;  class Target;
24
25
26  ///
27  /// Interface class for supervised classifiers
28  ///
29
30  class SupervisedClassifier
31  {
32   
33  public:
34    ///
35    /// Constructor. Taking a vector of target values.
36    ///
37    SupervisedClassifier(const Target&, statistics::Score* =0, 
38                         const size_t=0);
39   
40    ///
41    /// Destructor
42    ///
43    virtual ~SupervisedClassifier() {};
44
45    ///
46    /// An interface for making new classifier objects. This function
47    /// allows for specification at run-time of which classifier to
48    /// instatiate (see 'Prototype' in Design Patterns).
49    ///
50    /// @Note Returns a dynamically allocated SupervisedClassifier, which has
51    /// to be deleted by the caller to avoid memory leaks.
52    ///
53    virtual SupervisedClassifier* 
54    make_classifier(const DataLookup2D&, const Target&) const =0;
55   
56
57    //
58    // Train the classifier.
59    //
60    virtual bool train()=0;
61
62    ///
63    /// Generate output values for a data set
64    ///
65    virtual void predict(const DataLookup2D&, gslapi::matrix&) const =0;   
66
67   
68  protected:
69   
70    const Target& target_;
71    statistics::Score* score_;
72    classifier::InputRanker* ranker_;
73    size_t nof_inputs_;
74    bool trained_;
75   
76   
77  }; 
78 
79}} // of namespace classifier and namespace theplu
80
81#endif
Note: See TracBrowser for help on using the repository browser.