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

SamplerOptions Class Reference
Machine Learning

Options object for the Sampler class. More...

`#include <vigra/sampling.hxx>`

## Public Member Functions

SamplerOptions & | sampleProportion (double proportion)
| Determine the number of samples to draw as a proportion of the total number. That is, we draw `count = totalCount * proportion` samples. This option is overridden when an absolute count is specified by sampleSize().
SamplerOptions & | sampleSize (unsigned int size)
| Draw the given number of samples. If stratifiedSampling is true, the size is equally distributed across all strata (e.g. `size / strataCount` samples are taken from each stratum, subject to rounding).
SamplerOptions & | stratified (bool in=true)
| Draw equally many samples from each "stratum". A stratum is a group of like entities, e.g. pixels belonging to the same object class. This is useful to create balanced samples when the class probabilities are very unbalanced (e.g. when there are many background and few foreground pixels). Stratified sampling thus avoids that a trained classifier is biased towards the majority class.
SamplerOptions & | withoutReplacement (bool in=true)
| Sample from training population without replacement.
SamplerOptions & | withReplacement (bool in=true)
| Sample from training population with replacement.

## Detailed Description

Options object for the Sampler class.

Usage:

SamplerOptions opt = SamplerOptions()
.withReplacement()
.sampleProportion(0.5);
vigra::RGBValue
Class for a single RGB value.
Definition rgbvalue.hxx:128
vigra::SamplerOptions
Options object for the Sampler class.
Definition sampling.hxx:64
vigra::SamplerOptions::withReplacement
SamplerOptions & withReplacement(bool in=true)
Sample from training population with replacement.
Definition sampling.hxx:83
vigra::SamplerOptions::sampleProportion
SamplerOptions & sampleProportion(double proportion)
Determine the number of samples to draw as a proportion of the total number. That is,...
Definition sampling.hxx:123

Note that the return value of all methods is `*this` which makes concatenating of options as above possible.

## Member Function Documentation

## ◆ withReplacement()

SamplerOptions & withReplacement | ( | bool | in = `true` | ) |

Sample from training population with replacement.

Default: true

## ◆ withoutReplacement()

SamplerOptions & withoutReplacement | ( | bool | in = `true` | ) |

Sample from training population without replacement.

Default (if you don't call this function): false

## ◆ sampleSize()

SamplerOptions & sampleSize | ( | unsigned int | size | ) |

Draw the given number of samples. If stratifiedSampling is true, the size is equally distributed across all strata (e.g. `size / strataCount` samples are taken from each stratum, subject to rounding).

Default: 0 (i.e. determine the count by means of sampleProportion())

## ◆ sampleProportion()

SamplerOptions & sampleProportion | ( | double | proportion | ) |

Determine the number of samples to draw as a proportion of the total number. That is, we draw `count = totalCount * proportion` samples. This option is overridden when an absolute count is specified by sampleSize().

If stratifiedSampling is true, the count is equally distributed across all strata (e.g. `totalCount * proportion / strataCount` samples are taken from each stratum).

Default: 1.0

## ◆ stratified()

SamplerOptions & stratified | ( | bool | in = `true` | ) |

Draw equally many samples from each "stratum". A stratum is a group of like entities, e.g. pixels belonging to the same object class. This is useful to create balanced samples when the class probabilities are very unbalanced (e.g. when there are many background and few foreground pixels). Stratified sampling thus avoids that a trained classifier is biased towards the majority class.

Default (if you don't call this function): false

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

- vigra/sampling.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