public class DatasetAdaptors extends Object
Constructor and Description |
---|
DatasetAdaptors() |
Modifier and Type | Method and Description |
---|---|
static <INSTANCE> List<INSTANCE> |
asList(Dataset<INSTANCE> dataset)
Create a
List view of the given dataset. |
static <ANN,INSTANCE> |
flattenListGroupedDataset(GroupedDataset<ANN,? extends ListDataset<List<INSTANCE>>,? extends List<INSTANCE>> dataset)
if you have a grouped dataset where the groups contains lists of feature
objects (i.e.
|
static <ANN,DATASET extends Dataset<INSTANCE>,INSTANCE> |
getGroupedDatasetSubset(GroupedDataset<ANN,DATASET,INSTANCE> data,
ANN... groups)
Takes a grouped dataset and returns a new dataset that contains only
those groups specified.
|
static <ANN,DATASET extends ListDataset<INSTANCE>,INSTANCE> |
getRegroupedDataset(GroupedDataset<ANN,DATASET,INSTANCE> data,
Map<ANN,ANN[]> regroupCriteria)
Takes a grouped dataset and returns a new dataset with the groups
re-shuffled as specified in the regrouping criteria.
|
public DatasetAdaptors()
public static <INSTANCE> List<INSTANCE> asList(Dataset<INSTANCE> dataset)
List
view of the given dataset. If the dataset is a
ListDataset
it is returned, otherwise this method creates a new
List
containing all the instances in the dataset. The list is
populated by iterating through the dataset.INSTANCE
- The type of instances in the datasetdataset
- The dataset.public static <ANN,INSTANCE> GroupedDataset<ANN,ListDataset<INSTANCE>,INSTANCE> flattenListGroupedDataset(GroupedDataset<ANN,? extends ListDataset<List<INSTANCE>>,? extends List<INSTANCE>> dataset)
dataset
- The dataset@SafeVarargs public static <ANN,DATASET extends Dataset<INSTANCE>,INSTANCE> GroupedDataset<ANN,DATASET,INSTANCE> getGroupedDatasetSubset(GroupedDataset<ANN,DATASET,INSTANCE> data, ANN... groups)
data
- The dataset to take the groups fromgroups
- The groups to takepublic static <ANN,DATASET extends ListDataset<INSTANCE>,INSTANCE> GroupedDataset<ANN,ListBackedDataset<INSTANCE>,INSTANCE> getRegroupedDataset(GroupedDataset<ANN,DATASET,INSTANCE> data, Map<ANN,ANN[]> regroupCriteria)
old == GroupedDataset: {G1=[1,2,3],G2=[4,5,6],G3=[7,8,9]}
new = getGroupedDatasetSubset( old, {A->[G1,G3],B->[G2]} )
new == GroupedDataset: {A=[1,2,3,7,8,9],B=[4,5,6]}
If the given groups do not exist in the provided dataset, then they will
be ignored.data
- The dataset to take the groups fromregroupCriteria
- The regrouping criteria