X-Boost  2.3.8
NaiveDecisionStump.h
Go to the documentation of this file.
1 /* XBoost: Ada-Boost and Friends on Haar/ICF/HOG Features, Library and ToolBox
2  *
3  * Copyright (c) 2008-2014 Paolo Medici <medici@ce.unipr.it>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20 
21 #ifndef _NAIVE_DECISIONSTUMP_H
22 #define _NAIVE_DECISIONSTUMP_H
23 
30 public:
31  typedef int ReturnType;
32 
35 
36 public:
37 
38 
40  template<class DataType>
41  static int evaluate_feature(DataType value)
42  {
43  return (value > DataType(0) ) ? 1 : -1;
44  }
45 
46  static std::string signature() {
47  return "naivestump";
48  }
49 
50 };
51 
52 inline std::istream & operator >> (std::istream & in, NaiveDecisionStump & s)
53 {
54  return in;
55 }
56 
57 inline std::ostream & operator << (std::ostream & out, const NaiveDecisionStump & s)
58 {
59  return out;
60 }
61 
62 #endif
ClassifierType
Definition: Types.h:31
Definition: NaiveDecisionStump.h:29
static int evaluate_feature(DataType value)
convert the feature value to {-1,+1} using 0 as threshold
Definition: NaiveDecisionStump.h:41
a dicrete classifier returns {-1,+1}
Definition: Types.h:32
static const ClassifierType Type
NaiveDecisionStump is a DiscreteClassifier.
Definition: NaiveDecisionStump.h:34