KEY - Type of groupsINSTANCE - Type of instancespublic class GroupSampler<KEY,INSTANCE> extends Object implements Sampler<GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE>>
GroupedDataset. Groups are
either selected randomly or from the first ones returned by the iterator over
the dataset keys.| Constructor and Description |
|---|
GroupSampler(int numGroups,
boolean random)
Construct the sample to extract the given number of groups, either
randomly or by taking them in the order provided by the iterator of
groups.
|
| 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,
int numGroups,
boolean random)
Sample a dataset with the given number of groups to select.
|
public GroupSampler(int numGroups, boolean random)
numGroups - the number of groupsrandom - should the sample groups be chosen randomly?public GroupedDataset<KEY,ListDataset<INSTANCE>,INSTANCE> sample(GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE> dataset)
Samplersample 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, int numGroups, boolean random)
dataset - the dataset to samplenumGroups - the number of groupsrandom - should the sample groups be chosen randomly?