Main Page | Class List | File List | Class Members

random_forest.h

Go to the documentation of this file.
00001 00006 #ifndef _RANDOM_FOREST_H_ 00007 #define _RANDOM_FOREST_H_ 00008 00009 #include <vector> 00010 00011 using namespace std; 00012 00013 namespace librf { 00014 00015 class Instance; 00016 class InstanceSet; 00017 class Tree; 00023 class RandomForest { 00024 public: 00026 RandomForest(); 00028 RandomForest(const InstanceSet& set, 00029 int num_trees, 00030 int K, 00031 int max_depth); 00032 ~RandomForest(); 00034 // int predict(const Instance& c) const; 00036 // float predict_prob(const Instance& c) const; 00038 int predict(const InstanceSet& set, int instance_no) const; 00040 float predict_prob(const InstanceSet& set, int instance_no, int label) const; 00042 float testing_accuracy(const InstanceSet& testset) const; 00044 float training_accuracy() const; 00046 float oob_accuracy() const; 00048 void variable_importance(vector< pair<float, int> >* ranking, 00049 unsigned int* seed) const; 00051 void read(istream& i); 00053 void write(ostream& o); 00055 void print() const; 00056 private: 00057 const InstanceSet& set_; // training data set 00058 vector<Tree*> trees_; // component trees in the forest 00059 int max_depth_; // maximum depth of trees 00060 int K_; // random vars to try per split 00061 }; 00062 00063 } // namespace 00064 #endif

Generated on Mon Jan 8 23:19:06 2007 for librf by doxygen 1.3.7