00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00025 #ifndef MARSYAS_OneRClassifier_H
00026 #define MARSYAS_OneRClassifier_H
00027
00028 #include "MarSystem.h"
00029 #include "WekaData.h"
00030
00031 namespace Marsyas
00032 {
00033
00034 class OneRClassifier: public MarSystem
00035 {
00036 private:
00037
00038
00039 class OneRRule
00040 {
00041 public:
00042
00043 OneRRule(mrs_natural attr, mrs_natural nBreaks, mrs_natural correct)
00044 {
00045 attr_ = attr;
00046 nBreaks_ = nBreaks;
00047 correct_ = correct;
00048
00049
00050
00051 classifications_.resize(nBreaks_);
00052 breakpoints_.resize(nBreaks_-1);
00053 }
00054
00055
00056 ~OneRRule(){}
00057
00058
00059 mrs_natural getCorrect()const{return correct_;};
00060
00061
00062 inline std::vector<mrs_natural>& getClassifications(){return classifications_;}
00063 inline std::vector<mrs_real>& getBreakpoints(){return breakpoints_;}
00064
00065
00066 inline mrs_natural getnBreaks()const{return nBreaks_;}
00067
00068
00069 inline mrs_natural getAttr()const{return attr_;}
00070
00071 private:
00072
00073 mrs_natural attr_;
00074 mrs_natural nBreaks_;
00075 mrs_natural correct_;
00076
00077 std::vector<mrs_natural>classifications_;
00078 std::vector<mrs_real>breakpoints_;
00079 };
00080
00081 private:
00082 void addControls();
00083 void myUpdate(MarControlPtr sender);
00084
00085
00086
00087 WekaData instances_;
00088
00089
00090 OneRRule *newRule(mrs_natural attr, mrs_natural nLabels);
00091
00092
00093 mrs_natural Predict(const realvec& in);
00094
00095
00096 void Build(mrs_natural nLabels);
00097
00098
00099 OneRRule *rule_;
00100
00101
00102 static const mrs_natural minBucketSize_ = 6;
00103
00104
00105
00106
00107
00108
00109 bool lastModePredict_;
00110 mrs_realvec row_;
00111 public:
00112 OneRClassifier(const std::string name);
00113 ~OneRClassifier();
00114
00115 MarSystem *clone() const;
00116 void myProcess(realvec& in, realvec& out);
00117 };
00118
00119 }
00120 #endif
00121