ECOCPAK v0.9
|
00001 // Copyright (C) 2011 the authors listed below 00002 // http://ecocpak.sourceforge.net 00003 // 00004 // Authors: 00005 // - Dimitrios Bouzas (bouzas at ieee dot org) 00006 // - Nikolaos Arvanitopoulos (niarvani at ieee dot org) 00007 // - Anastasios Tefas (tefas at aiia dot csd dot auth dot gr) 00008 // 00009 // This file is part of the ECOC PAK C++ library. It is 00010 // provided without any warranty of fitness for any purpose. 00011 // 00012 // You can redistribute this file and/or modify it under 00013 // the terms of the GNU Lesser General Public License (LGPL) 00014 // as published by the Free Software Foundation, either 00015 // version 3 of the License or (at your option) any later 00016 // version. 00017 // (see http://www.opensource.org/licenses for more info) 00018 00019 00022 00023 00024 00025 #ifndef _THRESHOLD_H_ 00026 #define _THRESHOLD_H_ 00027 00028 00029 00030 #include <armadillo> 00031 using namespace arma; 00032 00033 00034 00038 class Threshold 00039 { 00040 public: 00041 00042 // --- Ctors & dtors --- // 00043 00044 // Default constructor 00045 Threshold(); 00046 00047 // User defined constructor 00048 Threshold(const double p, const u32 s, const double im); 00049 00050 // Copy constructor 00051 Threshold(const Threshold& t); 00052 00053 // Default destructor 00054 ~Threshold(); 00055 00056 // --- Accessors --- // 00057 00058 // returns minimum cluster's size threshold 00059 unsigned int Size() const; 00060 00061 // returns performance threshold 00062 double Performance() const; 00063 00064 // returns improvement threshold 00065 double Improvement() const; 00066 00067 // --- Mutators --- // 00068 00069 // sets size threshold 00070 Threshold& setSize(const u32 s); 00071 00072 // sets performance threshold 00073 Threshold& setPerformance(const double p); 00074 00075 // sets improvements threshold 00076 Threshold& setImprovement(const double im); 00077 00078 private: 00079 00080 // Minimum size for of a subset to be clustered 00081 u32 size; 00082 00083 // The minimum error desired for each binary problem 00084 double performance; 00085 00086 // Impovement of the splited subset regarding the previous ones 00087 double improvement; 00088 }; 00089 00090 00091 // --- Ctors & dtors --- // 00092 00093 00099 Threshold::Threshold() 00100 : 00101 size(0), 00102 performance(0.0), 00103 improvement(0.0) 00104 { 00105 00106 } 00107 00108 00109 00117 Threshold::Threshold 00118 ( 00119 const double p, 00120 const u32 s, 00121 const double im 00122 ) 00123 : 00124 performance(p), 00125 size(s), 00126 improvement(im) 00127 { 00128 00129 } 00130 00131 00132 00138 Threshold::Threshold 00139 ( 00140 const Threshold& t 00141 ) 00142 { 00143 size = t.Size(); 00144 performance = t.Performance(); 00145 improvement = t.Improvement(); 00146 } 00147 00148 00149 00152 Threshold::~Threshold () 00153 { 00154 // does nothing 00155 } 00156 00157 00158 // --- Accessors --- // 00159 00160 00169 inline 00170 unsigned int 00171 Threshold::Size() const 00172 { 00173 return size; 00174 } 00175 00176 00177 00186 inline 00187 double 00188 Threshold::Performance() const 00189 { 00190 return performance; 00191 } 00192 00193 00194 00203 inline 00204 double 00205 Threshold::Improvement() const 00206 { 00207 return improvement; 00208 } 00209 00210 00211 // --- Mutators --- // 00212 00213 00222 inline 00223 Threshold& 00224 Threshold::setSize 00225 ( 00226 const u32 s 00227 ) 00228 { 00229 size = s; 00230 return *this; 00231 } 00232 00233 00234 00243 inline 00244 Threshold& 00245 Threshold::setPerformance 00246 ( 00247 const double p 00248 ) 00249 { 00250 performance = p; 00251 return *this; 00252 } 00253 00254 00255 00264 inline 00265 Threshold& 00266 Threshold::setImprovement 00267 ( 00268 const double im 00269 ) 00270 { 00271 improvement = im; 00272 return *this; 00273 } 00274 00275 00276 00277 #endif 00278 00279 00280