[ VIGRA Homepage | Function Index | Class Index | Namespaces | File List | Main Page ]

vigra::rf3 Namespace Reference

Random forest version 3. More...

Classes

class  DepthStop
 Random forest 'maximum depth' stop criterion. More...
 
class  EntropyScore
 Functor that computes the entropy score. More...
 
class  GiniScore
 Functor that computes the gini score. More...
 
class  KolmogorovSmirnovScore
 Functor that computes the Kolmogorov-Smirnov score. More...
 
class  NodeComplexityStop
 Random forest 'node complexity' stop criterion. More...
 
class  NumInstancesStop
 Random forest 'number of datapoints' stop criterion. More...
 
class  OOBError
 Compute the out of bag error. More...
 
class  PurityStop
 Random forest 'node purity' stop criterion. More...
 
class  RandomForest
 Random forest version 3. More...
 
class  RandomForestOptions
 Options class for vigra::rf3::RandomForest version 3. More...
 
class  RFStopVisiting
 The default visitor node (= "do nothing"). More...
 
class  RFVisitorBase
 Base class from which all random forest visitors derive. More...
 
class  VariableImportance
 Compute the variable importance. More...
 
struct  VisitorCopy
 

Functions

template<... >
void random_forest (...)
 Train a vigra::rf3::RandomForest classifier.
 

Detailed Description

Random forest version 3.

This namespace contains VIGRA's 3rd version of the random forest classification/regression algorithm. This version is much easier to customize than previous versions because it consequently separates algorithms from the forest representation, following the design of the LEMON graph library.

Function Documentation

◆ random_forest()

template<... >
void random_forest (   ...)

Train a vigra::rf3::RandomForest classifier.

This factory function constructs a vigra::rf3::RandomForest classifier and trains it for the given features and labels. They must be given as a matrix with shape num_instances x num_features and an array with length num_instances respectively. Most training options (such as number of trees in the forest, termination and split criteria, and number of threads for parallel training) are specified via an option object of type vigra::rf3::RandomForestOptions. Optional visitors are typically used to compute the out-of-bag error of the classifier (use vigra::rf3::OOBError) and estimate variable importance on the basis of the Gini gain (use vigra::rf3::VariableImportance). You can also provide a specific random number generator instance, which is especially useful when you want to enforce deterministic algorithm behavior during debugging.

Declaration:

namespace vigra { namespace rf3 {
template <typename FEATURES,
typename LABELS,
FEATURES const & features,
LABELS const & labels,
RANDENGINE & randengine = vigra::MersenneTwister::global()
);
}}
Class for a single RGB value.
Definition rgbvalue.hxx:128
The default visitor node (= "do nothing").
Definition random_forest_visitors.hxx:510
Options class for vigra::rf3::RandomForest version 3.
Definition random_forest_common.hxx:583
Random forest version 3.
Definition random_forest.hxx:69
void random_forest(...)
Train a vigra::rf3::RandomForest classifier.

Usage:

#include <vigra/random_forest_3.hxx>
Namespace: vigra::rf3

using namespace vigra;
int num_instances = ...;
int num_features = ...;
MultiArray<2, double> train_features(Shape2(num_instances, num_features));
... // fill training data matrices
rf3::OOBError oob; // visitor to compute the out-of-bag error
rf3::RandomForestOptions().tree_count(100)
.features_per_node(rf3::RF_SQRT)
.n_threads(4)
rf3::create_visitor(oob));
std::cout << "Random forest training finished with out-of-bag error " << oob.oob_err_ << "\n";
... // fill feature matrix for test data
for(int i=0; i<num_test_instances; ++i)
std::cerr << "Prediction for test instance " << i << ": " << test_labels(i) << "\n";
Class for fixed size vectors.
Definition tinyvector.hxx:1008
Compute the out of bag error.
Definition random_forest_visitors.hxx:173

© Ullrich Köthe (ullrich.koethe@iwr.uni-heidelberg.de)
Heidelberg Collaboratory for Image Processing, University of Heidelberg, Germany

html generated using doxygen and Python
vigra 1.12.2