123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128 |
- namespace OBJREC
- {
-
- /** implementation of random set forests for regression */
- class RegRandomForests : public RegressionAlgorithm
- {
- protected:
- /** vector containing all decision trees for regression */
- std::vector<RegressionTree *> forest;
-
- int number_of_trees;
-
- double features_per_tree;
-
- double samples_per_tree;
-
- double minimum_error_reduction;
-
- const NICE::Config *conf;
-
- std::string confsection;
-
- RegressionTreeBuilder *builder;
-
- bool enableOutOfBagEstimates;
-
-
- std::vector<std::pair<double, double> > oobResults;
-
- double predict ( const NICE::Vector & x,
- const std::vector<int> & outofbagtrees );
-
- void calcOutOfBagEstimates ( std::vector< std::vector<int> > & outofbagtrees,
- NICE::VVector x,
- NICE::Vector y );
-
- std::vector<std::vector<int> > exselection;
-
- public:
-
-
- RegRandomForests ( const NICE::Config *conf,
- std::string section );
-
-
- RegRandomForests ();
-
-
- virtual ~RegRandomForests();
-
-
- void teach ( const NICE::VVector & x, const NICE::Vector & y );
-
-
- double predict ( const NICE::Vector & x );
-
- void getLeafNodes ( NICE::Vector x,
- std::vector<RegressionNode *> & leafNodes,
- int depth = 100000 );
-
-
- void getAllLeafNodes ( std::vector<RegressionNode *> & leafNodes );
-
- void indexDescendants ( std::map<RegressionNode *, std::pair<long, int> > & index ) const;
-
- void resetCounters ();
-
-
- virtual RegRandomForests *clone ( void ) const
- {
- fthrow ( NICE::Exception, "clone() not yet implemented!\n" );
- }
-
-
- std::vector<std::pair<double, double> > & getOutOfBagResults ()
- {
- return oobResults;
- };
-
-
- void setComplexity ( int size );
-
-
- void restore ( std::istream & is, int format = 0 );
- void store ( std::ostream & os, int format = 0 ) const;
- void clear ();
- };
-
- }
|