dataset

Concrete dataset implementation for labeled time series.

class pysatl_cpd.data.dataset.dataset.Dataset(timeseries)[source]

Bases: IDataset, Generic

Collection of labeled time series for benchmarking.

This class provides a backend-independent collection of labeled data with methods for filtering by annotation, segments, and bisegments, as well as train/test splitting.

Parameters:

timeseries (Sequence[LabeledData[TypeVar(DataT), TypeVar(AnnotationT, bound= TimeseriesAnnotation)]]) – Sequence of labeled data instances.

__init__(timeseries)[source]
Parameters:

timeseries (Sequence[LabeledData[DataT, AnnotationT]])

Return type:

None

filter_by_annotation(annotation_filter)[source]

Filter dataset by annotation.

Parameters:

annotation_filter (Callable[[TimeseriesAnnotation], bool] | None) – Function that takes an Annotation and returns True to include the labeled data.

Returns:

New dataset with filtered timeseries.

Return type:

Dataset[TypeVar(DataT), TypeVar(AnnotationT, bound= TimeseriesAnnotation)]

filter_by_segments(segment_filter=None)[source]

Filter dataset by segment criteria.

Returns a new dataset where each timeseries is replaced with segments matching the filter, merged into new timeseries.

Parameters:

segment_filter (Callable[[SegmentInfo], bool] | None) – Function that takes a SegmentInfo and returns True to include the segment.

Returns:

New dataset with segments matching the filter.

Return type:

Dataset[TypeVar(DataT), SegmentAnnotation]

filter_by_bisegments(bisegment_filter=None)[source]

Filter dataset by bisegment criteria.

Returns a new dataset with all bisegments matching the filter.

Parameters:

bisegment_filter (Callable[[BisegmentInfo], bool] | None) – Function that takes a tuple of (current_segment, next_segment) and returns True to include the bisegment.

Returns:

New dataset with bisegments matching the filter.

Return type:

Dataset[TypeVar(DataT), BisegmentAnnotation]