vigra - RandomForestOptions Class Reference

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

## Detailed Description

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

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

## Member Function Documentation

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

The number of trees.

Default: 255

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.

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`

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

Use bootstrap sampling.

Default: true

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)

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`

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)

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

Value of the node complexity termination criterion.

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

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)

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

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).

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.

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.11.1 (Fri May 19 2017)