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

details RandomForest
[Machine Learning]
VIGRA

#include <vigra/random_forest.hxx>

List of all members.

Public Member Functions

Data Access
data access interface - usage of member objects is deprecated (I like the word deprecated)

ProblemSpec_t const & ext_param () const
 return external parameters for viewing
Options_t const & options () const
 access const random forest options
void set_ext_param (ProblemSpec_t const &in)
 set external parameters
Options_tset_options ()
 access random forest options
DecisionTree_ttree (int index)
 access trees
DecisionTree_t const & tree (int index) const
 access const trees
Learning
Following functions differ in the degree of customization allowed

template<class U, class C1, class U2, class C2>
double learn (MultiArrayView< 2, U, C1 > const &features, MultiArrayView< 2, U2, C2 > const &labels)
 learn on data with default configuration
template<class U, class C1, class U2, class C2, class Visitor_t, class Split_t>
double learn (MultiArrayView< 2, U, C1 > const &features, MultiArrayView< 2, U2, C2 > const &labels, Visitor_t visitor, Split_t split)
template<class U, class C1, class U2, class C2, class Visitor_t>
double learn (MultiArrayView< 2, U, C1 > const &features, MultiArrayView< 2, U2, C2 > const &labels, Visitor_t visitor)
template<class U, class C1, class U2, class C2, class Split_t, class Stop_t, class Visitor_t>
double learn (MultiArrayView< 2, U, C1 > const &features, MultiArrayView< 2, U2, C2 > const &response, Visitor_t visitor, Split_t split, Stop_t stop)
template<class U, class C1, class U2, class C2, class Split_t, class Stop_t, class Visitor_t, class Random_t>
double learn (MultiArrayView< 2, U, C1 > const &features, MultiArrayView< 2, U2, C2 > const &response, Visitor_t visitor, Split_t split, Stop_t stop, Random_t const &random)
 learn on data with custom config and random number generator
template<class U, class C1, class U2, class C2>
double onlineLearn (MultiArrayView< 2, U, C1 > const &features, MultiArrayView< 2, U2, C2 > const &labels, int new_start_index, bool adjust_thresholds=false)
template<class U, class C1, class U2, class C2, class Split_t, class Stop_t, class Visitor_t, class Random_t>
double onlineLearn (MultiArrayView< 2, U, C1 > const &features, MultiArrayView< 2, U2, C2 > const &response, int new_start_index, Visitor_t visitor_, Split_t split_, Stop_t stop_, Random_t &random, bool adjust_thresholds=false)
template<class U, class C1, class U2, class C2>
void reLearnTree (MultiArrayView< 2, U, C1 > const &features, MultiArrayView< 2, U2, C2 > const &labels, int treeId)
template<class U, class C1, class U2, class C2, class Split_t, class Stop_t, class Visitor_t, class Random_t>
void reLearnTree (MultiArrayView< 2, U, C1 > const &features, MultiArrayView< 2, U2, C2 > const &response, int treeId, Visitor_t visitor_, Split_t split_, Stop_t stop_, Random_t &random)
prediction
template<class U, class C>
LabelType predictLabel (MultiArrayView< 2, U, C > const &features, ArrayVectorView< double > prior) const
 predict a label with features and class priors
template<class U, class C>
LabelType predictLabel (MultiArrayView< 2, U, C >const &features)
template<class U, class C, class Stop>
LabelType predictLabel (MultiArrayView< 2, U, C >const &features, Stop &stop) const
 predict a label given a feature.
template<class U, class C1, class T, class C2, class Stop>
void predictLabels (MultiArrayView< 2, U, C1 >const &features, MultiArrayView< 2, T, C2 > &labels, Stop &stop) const
template<class U, class C1, class T, class C2>
void predictLabels (MultiArrayView< 2, U, C1 >const &features, MultiArrayView< 2, T, C2 > &labels) const
 predict multiple labels with given features
template<class U, class C1, class T, class C2>
void predictProbabilities (MultiArrayView< 2, U, C1 >const &features, MultiArrayView< 2, T, C2 > &prob) const
 predict the class probabilities for multiple labels
template<class T1, class T2, class C>
void predictProbabilities (OnlinePredictionSet< T1 > &predictionSet, MultiArrayView< 2, T2, C > &prob)
template<class U, class C1, class T, class C2, class Stop>
void predictProbabilities (MultiArrayView< 2, U, C1 >const &features, MultiArrayView< 2, T, C2 > &prob, Stop &stop) const
 predict the class probabilities for multiple labels
Contructors
Note: No copy Constructor specified as no pointers are manipulated in this class

template<class TreeIterator, class WeightIterator>
 RandomForest (int treeCount, TreeIterator trees, WeightIterator weights, ProblemSpec_t const &problem_spec, Options_t const &options=Options_t())
 Create RF from external source.
 RandomForest (Options_t const &options=Options_t(), ProblemSpec_t const &ext_param=ProblemSpec_t())
 default constructor

Protected Attributes

MultiArray< 2, double > garbage_prediction_


Detailed Description

template<class LabelType, class PreprocessorTag>
class vigra::RandomForest< LabelType, PreprocessorTag >

Random Forest class

Template Parameters:
<PrprocessorTag = ClassificationTag> Class used to preprocess the input while learning and predicting. Currently Available: ClassificationTag and RegressionTag. It is recommended to use Splitfunctor::Preprocessor_t while using custom splitfunctors as they may need the data to be in a different format.
See also:
Preprocessor, How to make a Split Functor

Constructor & Destructor Documentation

RandomForest ( Options_t const &  options = Options_t(),
ProblemSpec_t const &  ext_param = ProblemSpec_t() 
)

default constructor

Parameters:
options general options to the Random Forest. Must be of Type Options_t
ext_param problem specific values that can be supplied additionally. (class weights , labels etc)
See also:
ProblemSpec_t
simple usage for classification (regression is not yet supported):
      typedef xxx feature_t \\ replace xxx with whichever type
      typedef yyy label_t   \\ meme chose. 
      MultiArrayView<2, feature_t> f = get_some_features();
      MultiArrayView<2, label_t>   l = get_some_labels)(
      RandomForest<> rf()
      double oob_error = rf.learn(f, l);
      
      MultiArrayView<2, feature_t> pf = get_some_unknown_features();
      MultiArrayView<2, label_t> prediction 
                                      = allocate_space_for_response();
      MultiArrayView<2, double> prob  = allocate_space_for_probability();
      
      rf.predict_labels(pf, prediction);
      rf.predict_probabilities(pf, prob);

  • Default Response/Label type is double

template<class TreeIterator, class WeightIterator>
RandomForest ( int  treeCount,
TreeIterator  trees,
WeightIterator  weights,
ProblemSpec_t const &  problem_spec,
Options_t const &  options = Options_t() 
)

Create RF from external source.

Parameters:
treeCount Number of trees to add.
trees Iterator to a Container where the topology_ data of the trees are stored.
weights iterator to a Container where the parameters_ data of the trees are stored.
problem_spec Extrinsic parameters that specify the problem e.g. ClassCount, featureCount etc.
options (optional) specify options used to train the original Random forest. This parameter is not used anywhere during prediction and thus is optional.
TODO: Note: This constructor may be replaced by a Constructor using NodeProxy iterators to encapsulate the underlying data type.


Member Function Documentation

ProblemSpec_t const& ext_param (  )  const

return external parameters for viewing

Returns:
ProblemSpec_t

template<class U, class C1, class U2, class C2>
double learn ( MultiArrayView< 2, U, C1 > const &  features,
MultiArrayView< 2, U2, C2 > const &  labels 
)

learn on data with default configuration

Parameters:
features a N x M matrix containing N samples with M features
labels a N x D matrix containing the corresponding N labels. Current split functors assume D to be 1 and ignore any additional columns. this is not enforced to allow future support for uncertain labels.
Returns:
out of bag error estimate.
learning is done with:

See also:
GiniSplit, EarlyStoppingStd, OOB_Visitor
  • Randomly seeded random number generator
  • default gini split functor as described by Breiman
  • default The standard early stopping criterion
  • the oob visitor, whose value is returned.

Options_t const& options (  )  const

access const random forest options

Returns:
const Option_t

void set_ext_param ( ProblemSpec_t const &  in  ) 

set external parameters

Parameters:
in external parameters to be set
set external parameters explicitly. If Random Forest has not been trained the preprocessor will either ignore filling values set this way or will throw an exception if values specified manually do not match the value calculated & during the preparation step.
See also:
Option_t::presupplied_ext_param member for further details.

Options_t& set_options (  ) 

access random forest options

Returns:
random forest options


Member Data Documentation

MultiArray<2, double> garbage_prediction_ [mutable, protected]

optimisation for predictLabels


The documentation for this class was generated from the following files:

© 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.7.0 (20 Apr 2010)