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

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

Refs #318

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date ID
File size: 2.3 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 DataLookup2D;
41  class MatrixLookup;
42  class MatrixLookupWeighted;
43  class Target;
44
45  ///
46  /// @brief Interface class for supervised classifiers
47  ///
48
49  class SupervisedClassifier
50  {
51   
52  public:
53    ///
54    /// @brief Constructor
55    ///
56    SupervisedClassifier(void);
57   
58
59    ///
60    /// @brief Destructor
61    ///
62    virtual ~SupervisedClassifier(void);
63
64
65    ///
66    /// An interface for making new classifier objects. This function
67    /// allows for specification at run-time of which classifier to
68    /// instatiate (see 'Prototype' in Design Patterns).
69    ///
70    /// @note Returns a dynamically allocated SupervisedClassifier, which has
71    /// to be deleted by the caller to avoid memory leaks.
72    ///
73    virtual SupervisedClassifier* 
74    make_classifier() const =0;
75   
76
77
78    ///
79    /// Generate output values for a data set
80    ///
81    virtual void predict(const DataLookup2D&, utility::Matrix&) const =0;   
82
83
84    ///
85    /// Train the classifier.
86    ///
87    virtual void train(const MatrixLookup&, const Target&)=0;
88
89    ///
90    /// Train the classifier.
91    ///
92    virtual void train(const MatrixLookupWeighted&, const Target&)=0;
93
94   
95  protected:
96   
97    /// true if classifier successfully trained
98    bool trained_;   
99   
100  }; 
101 
102}}} // of namespace classifier, yat, and theplu
103
104#endif
Note: See TracBrowser for help on using the repository browser.