Go to the documentation of this file.00001
00007 #ifndef _FACTOREDMODEL_HH_
00008 #define _FACTOREDMODEL_HH_
00009
00010 #include "../Models/C45Tree.hh"
00011 #include "../Models/M5Tree.hh"
00012 #include "../Models/LinearSplitsTree.hh"
00013 #include "../Models/Stump.hh"
00014 #include "../Models/MultipleClassifiers.hh"
00015 #include "../Models/SepPlanExplore.hh"
00016
00017 #include <rl_common/Random.h>
00018 #include <rl_common/core.hh>
00019 #include <vector>
00020
00021
00023 class FactoredModel: public MDPModel {
00024 public:
00025
00044 FactoredModel(int id, int numactions, int M, int modelType,
00045 int predType, int nModels, float treeThreshold,
00046 const std::vector<float> &featRange, float rRange,
00047 bool needConf, bool dep, bool relTrans, float featPct,
00048 bool stoch, bool episodic, Random rng = Random());
00049
00051 FactoredModel(const FactoredModel &);
00052
00053 virtual ~FactoredModel();
00054
00055 virtual bool updateWithExperiences(std::vector<experience> &instances);
00056 virtual bool updateWithExperience(experience &e);
00057
00059 bool initMDPModel(int nfactors);
00060 virtual float getStateActionInfo(const std::vector<float> &state, int act, StateActionInfo* retval);
00061 virtual FactoredModel* getCopy();
00062
00064 float getSingleSAInfo(const std::vector<float> &state, int act, StateActionInfo* retval);
00065
00067 void addFactorProb(float* probs, std::vector<float>* next, std::vector<float> x, StateActionInfo* retval, int index, std::vector< std::map<float,float> > predictions, float* confSum);
00068
00070 void setTreeParams(float margin, float forestPct, float minRatio);
00071
00073 std::vector<float> addVec(const std::vector<float> &a, const std::vector<float> &b);
00074
00076 std::vector<float> subVec(const std::vector<float> &a, const std::vector<float> &b);
00077
00078 private:
00079
00081 std::vector<Classifier*> outputModels;
00082
00084 Classifier* rewardModel;
00085
00087 Classifier* terminalModel;
00088
00089 int id;
00090 int nfactors;
00091 const int nact;
00092 const int M;
00093 const int modelType;
00094 const int predType;
00095 const int nModels;
00096 const int treeBuildType;
00097 const float treeThresh;
00098
00099 const std::vector<float> featRange;
00100 const float rRange;
00101
00102 const bool needConf;
00103 const bool dep;
00104 const bool relTrans;
00105 const float FEAT_PCT;
00106 const bool stoch;
00107 const bool episodic;
00108 Random rng;
00109
00110 float EXP_PCT;
00111
00112 bool MODEL_DEBUG;
00113 bool COPYDEBUG;
00114
00115 };
00116
00117
00118
00119 #endif