Skip to main content

Sample

Synopsis

This operator creates a sample from an ExampleSet by selecting examples randomly. The size of a sample can be specified on absolute, relative and probability basis.

Description

This operator is similar to the <reference key="operator.filter_examples">Filter Examples</reference> operator in principle that it takes an ExampleSet as input and delivers a subset of the ExampleSet as output. The difference is this that the Filter Examples operator filters examples on the basis of specified conditions. But the Sample operator focuses on the number of examples and class distribution in the resultant sample. Moreover, the samples are generated randomly. The number of examples in the sample can be specified on absolute, relative or probability basis depending on the setting of the sample parameter. The class distribution of the sample can be controlled by the balance data parameter.

Input

example set input

This input port expects an ExampleSet. It is output of the Retrieve operator in the attached Example Process.

Output

example set output

A randomized sample of the input ExampleSet is output of this port.

original

ExampleSet that was given as input is passed without changing to the output through this port. This is usually used to reuse the same ExampleSet in further operators or to view the ExampleSet in the Results Workspace.

Parameters

Sample

This parameter determines how the amount of data is specified.

  • absolute: If the sample parameter is set to 'absolute' the sample is created of an exactly specified number of examples. The required number of examples is specified in the sample size parameter.
  • relative: If the sample parameter is set to 'relative' the sample is created as a fraction of the total number of examples in the input ExampleSet. The required ratio of examples is specified in the sample ratio parameter.
  • probability: If the sample parameter is set to 'probability' the sample is created of probability basis. The required probability is specified in the sample probability parameter.

Balance data

You can set this parameter to true if you need to sample differently for examples of a certain class. If this parameter is set to true, sample size, sample ratio and sample probability parameters are replaced by sample size per class, sample ratio per class and sample probability per class parameters respectively. These parameters allow you to specify different sample sizes for different values of the label attribute.

Sample size

This parameter specifies the exact number of examples which should be sampled. This parameter is only available when the sample parameter is set to 'absolute' and the balance data parameter is not set to true.

Sample ratio

This parameter specifies the fraction of examples which should be sampled. This parameter is only available when the sample parameter is set to 'relative' and the balance data parameter is not set to true.

Sample probability

This parameter specifies the sample probability for each example. This parameter is only available when the sample parameter is set to 'probability' and the balance data parameter is not set to true.

Sample size per class

This parameter specifies the absolute sample size per class. This parameter is only available when the sample parameter is set to 'absolute' and the balance data parameter is set to true.

Sample ratio per class

This parameter specifies the fraction of examples per class. This parameter is only available when the sample parameter is set to 'relative' and the balance data parameter is set to true.

Sample probability per class

This parameter specifies the probability of examples per class. This parameter is only available when the sample parameter is set to 'probability' and the balance data parameter is set to true.

Use local random seed

This parameter indicates if a local random seed should be used for randomizing examples of the sample. Using the same value of local random seed will produce the same sample. Changing the value of this parameter changes the way the examples are randomized, thus the sample will have a different set of examples.

Local random seed

This parameter specifies the local random seed. This parameter is only available if the use local random seed parameter is set to true.