state_dataset

Datasets of fixed-state labeled time series.

class pysatl_cpd.data.dataset.state_dataset.StateDataset(timeseries, *, state=None)[source]

Bases: IDataset[DataT, NoChangeSeriesAnnotation], Generic

Dataset of fixed-state series without change points.

All series in this dataset share a common state and have no change points within them. Typically created from a larger Dataset by slicing fixed-state segments.

Parameters:
__init__(timeseries, *, state=None)[source]
Parameters:
Return type:

None

property state: StateDescriptor

Return the fixed state descriptor for this dataset.

Returns:

State descriptor for all timeseries in the dataset.

Return type:

state

classmethod from_dataset(dataset, slice_length, *, state, keep_remainder=False)[source]

Create a StateDataset from a Dataset by filtering and slicing.

Parameters:
  • dataset (Dataset[TypeVar(DataT), Any]) – Source dataset to extract state segments from.

  • slice_length (int) – Length of each slice to create.

  • state (StateDescriptor) – State to filter segments by.

  • keep_remainder (bool) – Whether to keep remainder as final slice.

Returns:

New StateDataset with sliced timeseries.

Return type:

StateDataset[TypeVar(DataT)]

Raises:

ValueError – If slice_length is not positive, or no segments are found for the given state.