openModeller  Version 1.5.0
rf_alg.hh
Go to the documentation of this file.
1 
27 #ifndef _RF_ALGHH_
28 #define _RF_ALGHH_
29 
30 #include <vector>
31 
32 #include <openmodeller/om.hh>
33 #include <openmodeller/Random.hh>
34 
35 #include "librf/instance_set.h"
36 #include "librf/tree.h"
37 
38 /*****************************************/
39 /************* Random Forests ************/
40 
44 class RfAlgorithm : public AlgorithmImpl
45 {
46 public:
47 
48  RfAlgorithm();
49 
50  ~RfAlgorithm();
51 
52  int needNormalization();
53  int initialize();
54  int iterate();
55  float getProgress() const;
56  int done() const;
57 
58  Scalar getValue( const Sample& x ) const;
59  int getConvergence( Scalar * const val ) const;
60 
61 protected:
62 
63  void _sampleToLine( Sample sample, stringstream& ss ) const;
64 
65  void _getConfiguration( ConfigurationPtr& ) const;
66 
68 
69  bool _done;
70 
72 
73  int _k;
74 
76 
78 
79  librf::InstanceSet* _set; // only used for model creation
80 
81  vector<int> _class_weights;
82 
83  vector<librf::Tree*> _trees;
84 };
85 
86 
87 #endif
88 
Random _rand
Definition: rf_alg.hh:77
Scalar getValue(const Sample &x) const
Definition: rf_alg.cpp:375
void _setConfiguration(const ConstConfigurationPtr &)
Definition: rf_alg.cpp:480
int _k
Definition: rf_alg.hh:73
double Scalar
Type of map values.
Definition: om_defs.hh:39
void _getConfiguration(ConfigurationPtr &) const
Definition: rf_alg.cpp:416
vector< librf::Tree * > _trees
Definition: rf_alg.hh:83
int needNormalization()
Definition: rf_alg.cpp:179
librf::InstanceSet * _set
Definition: rf_alg.hh:79
float getProgress() const
Definition: rf_alg.cpp:353
Definition: Random.hh:44
~RfAlgorithm()
Definition: rf_alg.cpp:164
void _sampleToLine(Sample sample, stringstream &ss) const
Definition: rf_alg.cpp:311
vector< int > _class_weights
Definition: rf_alg.hh:81
int _num_trees
Definition: rf_alg.hh:71
int done() const
Definition: rf_alg.cpp:367
int getConvergence(Scalar *const val) const
Definition: rf_alg.cpp:407
int iterate()
Definition: rf_alg.cpp:325
int initialize()
Definition: rf_alg.cpp:187
bool _initialized
Definition: rf_alg.hh:75
bool _done
Definition: rf_alg.hh:69
Definition: Sample.hh:25