KEY
- Type of groupsINSTANCE
- Type of instancespublic class NamedGroupSampler<KEY,INSTANCE> extends Object implements Sampler<GroupedDataset<KEY,? extends ListDataset<INSTANCE>,INSTANCE>>
GroupedDataset
. Groups are
chosen by selecting pre-determined keys.Constructor and Description |
---|
NamedGroupSampler(Collection<KEY> keys)
Construct the sample to extract the given 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,
Collection<KEY> keys)
Sample a dataset by selecting only the given group keys.
|
public NamedGroupSampler(Collection<KEY> keys)
keys
- the group keys to sample.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, Collection<KEY> keys)
dataset
- the dataset to samplekeys
- the group keys to sample.