KEY
- Type of groupsINSTANCE
- Type of instancespublic class GroupedUniformRandomisedSampler<KEY,INSTANCE> extends Object implements Sampler<GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE>>
StratifiedGroupedUniformRandomisedSampler
to achieve that).Constructor and Description |
---|
GroupedUniformRandomisedSampler(double percentage)
Construct a
GroupedUniformRandomisedSampler with the given
percentage of instances to select. |
GroupedUniformRandomisedSampler(double percentage,
boolean withReplacement)
Construct a
GroupedUniformRandomisedSampler with the given
percentage of instances to select, using with with-replacement or
without-replacement sampling. |
GroupedUniformRandomisedSampler(int number)
Construct a
GroupedUniformRandomisedSampler with the given number
of instances to select. |
GroupedUniformRandomisedSampler(int number,
boolean withReplacement)
Construct a
GroupedUniformRandomisedSampler with the given number
of instances to select, using with with-replacement or
without-replacement sampling. |
Modifier and Type | Method and Description |
---|---|
GroupedDataset<KEY,ListDataset<INSTANCE>,INSTANCE> |
sample(GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE> dataset)
Perform the sampling operation on the given data
and return the sampled dataset.
|
static <KEY,INSTANCE> |
sample(GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE> dataset,
double percentage)
Sample a dataset with the given percentage of instances to select.
|
static <KEY,INSTANCE> |
sample(GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE> dataset,
double percentage,
boolean withReplacement)
Sample a dataset with the given percentage of instances to select, using
with with-replacement or without-replacement sampling.
|
static <KEY,INSTANCE> |
sample(GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE> dataset,
int number)
Sample a dataset with the given number of instances to select.
|
static <KEY,INSTANCE> |
sample(GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE> dataset,
int number,
boolean withReplacement)
Sample a dataset with the given number of instances to select, using with
with-replacement or without-replacement sampling.
|
public GroupedUniformRandomisedSampler(double percentage)
GroupedUniformRandomisedSampler
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 GroupedUniformRandomisedSampler(double percentage, boolean withReplacement)
GroupedUniformRandomisedSampler
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 GroupedUniformRandomisedSampler(int number)
GroupedUniformRandomisedSampler
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 GroupedUniformRandomisedSampler(int number, boolean withReplacement)
GroupedUniformRandomisedSampler
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 GroupedDataset<KEY,ListDataset<INSTANCE>,INSTANCE> sample(GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE> dataset)
Sampler
sample
in interface Sampler<GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE>>
dataset
- the dataset to samplepublic static <KEY,INSTANCE> GroupedDataset<KEY,ListDataset<INSTANCE>,INSTANCE> sample(GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE> dataset, double percentage)
dataset
- the dataset to samplepercentage
- percentage of instances to selectpublic static <KEY,INSTANCE> GroupedDataset<KEY,ListDataset<INSTANCE>,INSTANCE> sample(GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE> dataset, double percentage, boolean withReplacement)
dataset
- the dataset to samplepercentage
- percentage of instances to selectwithReplacement
- should the sampling be performed with replacement (true); or
without replacement (false).public static <KEY,INSTANCE> GroupedDataset<KEY,ListDataset<INSTANCE>,INSTANCE> sample(GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE> dataset, int number)
dataset
- the dataset to samplenumber
- number of instances to selectpublic static <KEY,INSTANCE> GroupedDataset<KEY,ListDataset<INSTANCE>,INSTANCE> sample(GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE> dataset, int number, boolean withReplacement)
dataset
- the dataset to samplenumber
- number of instances to selectwithReplacement
- should the sampling be performed with replacement (true); or
without replacement (false).