INSTANCE
- Type of instancespublic class UniformRandomisedSampler<INSTANCE> extends Object implements Sampler<ListDataset<INSTANCE>>
ListDataset
s. Both sampling
with and without replacement are supported. The sampler returns a "view" on
top of the input dataset that selects a predefined fraction of the data.Constructor and Description |
---|
UniformRandomisedSampler(double percentage)
Construct a
UniformRandomisedSampler with the given percentage of
instances to select. |
UniformRandomisedSampler(double percentage,
boolean withReplacement)
Construct a
UniformRandomisedSampler with the given percentage of
instances to select, using with with-replacement or without-replacement
sampling. |
UniformRandomisedSampler(int number)
Construct a
UniformRandomisedSampler with the given number of
instances to select. |
UniformRandomisedSampler(int number,
boolean withReplacement)
Construct a
UniformRandomisedSampler with the given number of
instances to select, using with with-replacement or without-replacement
sampling. |
Modifier and Type | Method and Description |
---|---|
ListDataset<INSTANCE> |
sample(ListDataset<INSTANCE> dataset)
Perform the sampling operation on the given data
and return the sampled dataset.
|
public UniformRandomisedSampler(double percentage)
UniformRandomisedSampler
with the given percentage of
instances to select. By default, the sampling is without replacement
(i.e. an instance can only be selected once).percentage
- percentage of instances to selectpublic UniformRandomisedSampler(double percentage, boolean withReplacement)
UniformRandomisedSampler
with the given percentage of
instances to select, using with with-replacement or without-replacement
sampling.percentage
- percentage of instances to selectwithReplacement
- should the sampling be performed with replacement (true); or
without replacement (false).public UniformRandomisedSampler(int number)
UniformRandomisedSampler
with the given number of
instances to select. By default, the sampling is without replacement
(i.e. an instance can only be selected once).number
- number of instances to selectpublic UniformRandomisedSampler(int number, boolean withReplacement)
UniformRandomisedSampler
with the given number of
instances to select, using with with-replacement or without-replacement
sampling.number
- number of instances to selectwithReplacement
- should the sampling be performed with replacement (true); or
without replacement (false).public ListDataset<INSTANCE> sample(ListDataset<INSTANCE> dataset)
Sampler
sample
in interface Sampler<ListDataset<INSTANCE>>
dataset
- the dataset to sample