Go to the documentation of this file.00001
00006 #ifndef _MULTCLASS_HH_
00007 #define _MULTCLASS_HH_
00008
00009 #include "../Models/C45Tree.hh"
00010 #include "../Models/M5Tree.hh"
00011 #include "../Models/LinearSplitsTree.hh"
00012
00013 #include "../Models/Stump.hh"
00014
00015 #include <rl_common/Random.h>
00016 #include <rl_common/core.hh>
00017 #include <vector>
00018 #include <set>
00019 #include <map>
00020
00022 class MultipleClassifiers: public Classifier {
00023
00024 public:
00025
00039 MultipleClassifiers(int id, int modelType, int predType, int nModels,
00040 int trainMode, int trainFreq,
00041 float featPct, float expPct, float treeThreshold,
00042 bool stoch, float featRange, Random rng);
00043
00045 MultipleClassifiers(const MultipleClassifiers&);
00046 virtual MultipleClassifiers* getCopy();
00047
00048 ~MultipleClassifiers();
00049
00050 virtual bool trainInstances(std::vector<classPair> &instances);
00051 virtual bool trainInstance(classPair &instance);
00052 virtual void testInstance(const std::vector<float> &input, std::map<float, float>* retval);
00053 virtual float getConf(const std::vector<float> &s);
00054
00056 void updateModelAccuracy(int i, const std::vector<float> &input, float out);
00057
00059 void initModels();
00060
00062 float klDivergence(const std::vector<float> &input);
00063
00065 float variance(const std::vector<float> &input);
00066
00067 bool STDEBUG;
00068 bool PRED_DEBUG;
00069 bool ACC_DEBUG;
00070 bool CONF_DEBUG;
00071 bool COPYDEBUG;
00072
00074 std::vector<Classifier*> models;
00075
00076 private:
00077
00078 const int id;
00079 const int modelType;
00080 const int predType;
00081 const int nModels;
00082 const int mode;
00083 const int freq;
00084 float featPct;
00085 float expPct;
00086 const float treeThresh;
00087 const bool stoch;
00088 const bool addNoise;
00089 const float featRange;
00090
00091 Random rng;
00092
00093 std::vector<float> accuracy;
00094 int nsteps;
00095 std::vector<std::map<float, float> >infos;
00096
00097 };
00098
00099
00100 #endif
00101