dataeval.selection.Select¶
-
class dataeval.selection.Select(dataset, selections=
None)¶ Dataset wrapper that applies selection criteria for filtering.
Wraps an existing dataset and applies one or more selection filters to create a subset view without modifying the original dataset. Supports chaining multiple selection criteria for complex filtering operations.
- Parameters:¶
- dataset : AnnotatedDataset[_TDatum]¶
Source dataset to wrap and filter. Must implement AnnotatedDataset interface with indexed access to data tuples.
- selections : Selection or Sequence[Selection] or None, default None¶
Selection criteria to apply for filtering the dataset. When None, returns all items from the source dataset. Default None creates unfiltered view for consistent interface.
Examples
>>> from dataeval.selection import ClassFilter, Limit>>> # Apply selection criteria to the dataset >>> selections = [Limit(size=5), ClassFilter(classes=[0, 2])] >>> selected_dataset = Select(dataset, selections=selections)>>> # View selected dataset information >>> print(selected_dataset) Select Dataset -------------- Selections: [Limit(size=5), ClassFilter(classes=[0, 2], filter_detections=True)] Selected Size: 5 ObjectDetectionDataset(n_images=50, classes=['person', 'car', 'boat', 'plane'])Notes
Selection criteria are applied in the order provided, allowing for efficient sequential filtering. The wrapper maintains all metadata and interface compatibility with the original dataset.
-
resolve_indices(indices=
None)¶ Return the list of dataset indices after all selections have been applied.
- Parameters:¶
- indices : int or SourceIndex or Sequence[int | SourceIndex] or None, default None¶
Specific indices from the original dataset to resolve after selection. When None, returns all selected indices.
- Returns:¶
The list of selected indices from the original dataset.
- Return type:¶
list[int]
- property metadata : dataeval.protocols.DatasetMetadata¶
Dataset metadata information including identifier and configuration.