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 filter_example 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_example 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 (Deprecated) 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 sample.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 sample.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 sample.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 sample.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 sample.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 sample.probability and the balance data parameter is set to true.

use local random seed

This parameter indicates if a use 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.

See Also