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

RandomForestOptions Class Reference

Options class for vigra::rf3::RandomForest version 3. More...

`#include <vigra/random_forest_3/random_forest_common.hxx>`

## Public Member Functions

RandomForestOptions & | bootstrap_sampling (bool b)
| Use bootstrap sampling.
RandomForestOptions & | class_weights (std::vector< double > const &v)
| Each datapoint is weighted by its class weight. By default, each class has weight 1.
RandomForestOptions & | features_per_node (int p_features_per_node)
| The number of features that are considered when computing the split.
RandomForestOptions & | features_per_node (RandomForestOptionTags p_features_per_node_switch)
| The number of features that are considered when computing the split.
size_t | get_features_per_node (size_t total) const
| Get the actual number of features per node.
RandomForestOptions & | max_depth (size_t d)
| Do not split a node if its depth is greater or equal to max_depth.
RandomForestOptions & | min_num_instances (size_t n)
| Do not split a node if it contains less than min_num_instances data points.
RandomForestOptions & | n_threads (int n)
| The number of threads that are used in training.
RandomForestOptions & | node_complexity_tau (double tau)
| Value of the node complexity termination criterion.
RandomForestOptions & | resample_count (size_t n)
| If resample_count is greater than zero, the split in each node is computed using only resample_count data points.
RandomForestOptions & | split (RandomForestOptionTags p_split)
| The split criterion.
RandomForestOptions & | tree_count (int p_tree_count)
| The number of trees.
RandomForestOptions & | use_stratification (bool b)
| Use stratification when creating the bootstrap samples.

## Detailed Description

Options class for vigra::rf3::RandomForest version 3.

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

## Member Function Documentation

## ◆ tree_count()

RandomForestOptions & tree_count | ( | int | p_tree_count | ) |

The number of trees.

Default: 255

## ◆ features_per_node() [1/2]

RandomForestOptions & features_per_node | ( | int | p_features_per_node | ) |

The number of features that are considered when computing the split.

Parameters

  p_features_per_node | the number of features

Default: use sqrt of the total number of features.

## ◆ features_per_node() [2/2]

RandomForestOptions & features_per_node | ( | RandomForestOptionTags | p_features_per_node_switch | ) |

The number of features that are considered when computing the split.

Parameters

  p_features_per_node_switch | possible values: `vigra::rf3::RF_SQRT` (use square root of total number of features, recommended for classification), `vigra::rf3::RF_LOG` (use logarithm of total number of features, recommended for regression), `vigra::rf3::RF_ALL` (use all features).

Default: `vigra::rf3::RF_SQRT`

## ◆ bootstrap_sampling()

RandomForestOptions & bootstrap_sampling | ( | bool | b | ) |

Use bootstrap sampling.

Default: true

## ◆ resample_count()

RandomForestOptions & resample_count | ( | size_t | n | ) |

If resample_count is greater than zero, the split in each node is computed using only resample_count data points.

Default: n = 0 (don't resample in every node)

## ◆ split()

RandomForestOptions & split | ( | RandomForestOptionTags | p_split | ) |

The split criterion.

Parameters

  p_split | possible values: `vigra::rf3::RF_GINI` (use Gini criterion, vigra::rf3::GiniScorer), `vigra::rf3::RF_ENTROPY` (use entropy criterion, vigra::rf3::EntropyScorer), `vigra::rf3::RF_KSD` (use Kolmogorov-Smirnov criterion, vigra::rf3::KSDScorer).

Default: `vigra::rf3::RF_GINI`

## ◆ max_depth()

RandomForestOptions & max_depth | ( | size_t | d | ) |

Do not split a node if its depth is greater or equal to max_depth.

Default: d = 0 (don't use depth as a termination criterion)

## ◆ node_complexity_tau()

RandomForestOptions & node_complexity_tau | ( | double | tau | ) |

Value of the node complexity termination criterion.

Default: tau = -1 (don't use complexity as a termination criterion)

## ◆ min_num_instances()

RandomForestOptions & min_num_instances | ( | size_t | n | ) |

Do not split a node if it contains less than min_num_instances data points.

Default: n = 1 (don't use instance count as a termination criterion)

## ◆ use_stratification()

RandomForestOptions & use_stratification | ( | bool | b | ) |

Use stratification when creating the bootstrap samples.

That is, preserve the proportion between the number of class instances exactly rather than on average.

Default: false

## ◆ n_threads()

RandomForestOptions & n_threads | ( | int | n | ) |

The number of threads that are used in training.

n = -1 means use number of cores, n = 0 means single-threaded training.

Default: n = -1 (use as many threads as there are cores in the machine).

## ◆ class_weights()

RandomForestOptions & class_weights | ( | std::vector< double > const & | v | ) |

Each datapoint is weighted by its class weight. By default, each class has weight 1.

The classes in the random forest training have to follow a strict ordering. The weights must be given in that order. Example: You have the classes 3, 8 and 5 and use the vector {0.2, 0.3, 0.4} for the class weights. The ordering of the classes is 3, 5, 8, so class 3 will get weight 0.2, class 5 will get weight 0.3 and class 8 will get weight 0.4.

## ◆ get_features_per_node()

size_t get_features_per_node | ( | size_t | total | ) | const

Get the actual number of features per node.

Parameters

  total | the total number of features

This function is normally only called internally before training is started.

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

- vigra/random_forest_3/random_forest_common.hxx

© 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