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

Last change on this file since 523 was 523, checked in by Peter, 17 years ago

add prediction functions to SVM

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