source: trunk/yat/classifier/SupervisedClassifier.h @ 1160

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

Fixes #333

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 2.5 KB
Line 
1#ifndef _theplu_yat_classifier_supervisedclassifier_
2#define _theplu_yat_classifier_supervisedclassifier_
3
4// $Id$
5
6/*
7  Copyright (C) 2005 Markus Ringnér
8  Copyright (C) 2006 Jari Häkkinen, Markus Ringnér, Peter Johansson
9  Copyright (C) 2007 Peter Johansson
10
11  This file is part of the yat library, http://trac.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 2 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 this program; if not, write to the Free Software
25  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26  02111-1307, USA.
27*/
28
29#include <stddef.h>
30
31namespace theplu {
32namespace yat {
33
34  namespace utility {
35    class Matrix;
36  }
37
38namespace classifier { 
39
40  class MatrixLookup;
41  class MatrixLookupWeighted;
42  class Target;
43
44  ///
45  /// @brief Interface class for supervised classifiers
46  ///
47
48  class SupervisedClassifier
49  {
50   
51  public:
52    ///
53    /// @brief Constructor
54    ///
55    SupervisedClassifier(void);
56   
57
58    ///
59    /// @brief Destructor
60    ///
61    virtual ~SupervisedClassifier(void);
62
63
64    ///
65    /// An interface for making new classifier objects. This function
66    /// allows for specification at run-time of which classifier to
67    /// instatiate (see 'Prototype' in Design Patterns).
68    ///
69    /// @note Returns a dynamically allocated SupervisedClassifier, which has
70    /// to be deleted by the caller to avoid memory leaks.
71    ///
72    virtual SupervisedClassifier* 
73    make_classifier() const =0;
74   
75
76
77    ///
78    /// Generate output values for a data set
79    ///
80    virtual void predict(const MatrixLookup&, utility::Matrix&) const =0;   
81
82    ///
83    /// Generate output values for a weighted data set
84    ///
85    virtual void predict(const MatrixLookupWeighted&, utility::Matrix&) const =0;   
86
87
88    ///
89    /// Train the classifier.
90    ///
91    virtual void train(const MatrixLookup&, const Target&)=0;
92
93    ///
94    /// Train the classifier.
95    ///
96    virtual void train(const MatrixLookupWeighted&, const Target&)=0;
97
98   
99  protected:
100   
101    /// true if classifier successfully trained
102    bool trained_;   
103   
104  }; 
105 
106}}} // of namespace classifier, yat, and theplu
107
108#endif
Note: See TracBrowser for help on using the repository browser.