[ 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>`

List of all members.

## 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);

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

## Member Function Documentation

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

Sample from training population with replacement.

Default: true

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

Sample from training population without replacement.

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

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

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

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.9.0 (Tue Nov 6 2012)