mlrl.common.cython.instance_sampling module

@author: Michael Rapp (michael.rapp.ml@gmail.com)

class mlrl.common.cython.instance_sampling.ExampleWiseStratifiedInstanceSamplingConfig

Bases: object

Allows to configure a method for selecting a subset of the available training examples using stratification, where distinct label vectors are treated as individual classes.

get_sample_size() float

Returns the fraction of examples that are included in a sample.

Returns:

The fraction of examples that are included in a sample

set_sample_size(sample_size: float) ExampleWiseStratifiedInstanceSamplingConfig

Sets the fraction of examples that should be included in a sample.

Parameters:

sample_size – The fraction of examples that should be included in a sample, e.g., a value of 0.6 corresponds to 60 % of the available training examples. Must be in (0, 1)

Returns:

An ExampleWiseStratifiedInstanceSamplingConfig that allows further configuration of the method for sampling instances

class mlrl.common.cython.instance_sampling.InstanceSamplingWithReplacementConfig

Bases: object

Allows to configure a method for selecting a subset of the available training examples with replacement.

get_sample_size() float

Returns the fraction of examples that are included in a sample.

Returns:

The fraction of examples that are included in a sample

set_sample_size(sample_size: float) InstanceSamplingWithReplacementConfig

Sets the fraction of examples that should be included in a sample.

Parameters:

sample_size – The fraction of examples that should be included in a sample, e.g., a value of 0.6 corresponds to 60 % of the available training examples. Must be in (0, 1)

Returns:

An InstanceSamplingWithReplacementConfig that allows further configuration of the method for sampling instances

class mlrl.common.cython.instance_sampling.InstanceSamplingWithoutReplacementConfig

Bases: object

Allows to configure a method for selecting a subset of the available training examples without replacement.

get_sample_size() float

Returns the fraction of examples that are included in a sample.

Returns:

The fraction of examples that are included in a sample

set_sample_size(sample_size: float) InstanceSamplingWithoutReplacementConfig

Sets the fraction of examples that should be included in a sample.

Parameters:

sample_size – The fraction of examples that should be included in a sample, e.g., a value of 0.6 corresponds to 60 % of the available training examples. Must be in (0, 1)

Returns:

An InstanceSamplingWithoutReplacementConfig that allows further configuration of the method for sampling instances

class mlrl.common.cython.instance_sampling.LabelWiseStratifiedInstanceSamplingConfig

Bases: object

Allows to configure a method for selecting a subset of the available training examples using stratification, such that for each label the proportion of relevant and irrelevant examples is maintained.

get_sample_size() float

Returns the fraction of examples that are included in a sample.

Returns:

The fraction of examples that are included in a sample

set_sample_size(sample_size: float) LabelWiseStratifiedInstanceSamplingConfig

Sets the fraction of examples that should be included in a sample.

Parameters:

sample_size – The fraction of examples that should be included in a sample, e.g., a value of 0.6 corresponds to 60 % of the available training examples. Must be in (0, 1)

Returns:

A LabelWiseStratifiedInstanceSamplingConfig that allows further configuration of the method for sampling instances