timesead.data.transforms.target_transforms

Classes

ReconstructionTargetTransform

Adds the current inputs as targets for reconstruction objectives.

OneVsRestTargetTransform

Transforms multi-class labels into binary labels for anomaly detection.

PredictionTargetTransform

Adds the last prediction_window points from the current inputs as targets for prediction objectives.

OverlapPredictionTargetTransform

Adds the sequence shifted by offset as the target.

Module Contents

class timesead.data.transforms.target_transforms.ReconstructionTargetTransform(parent: timesead.data.transforms.transform_base.Transform, replace_labels: bool = False)

Bases: timesead.data.transforms.transform_base.Transform

Adds the current inputs as targets for reconstruction objectives.

Parameters:
  • parent (timesead.data.transforms.transform_base.Transform) – Another Transform which is used as the data source for this transform.

  • replace_labels (bool) – Whether the original labels should be replaced by the reconstruction target. If False, the reconstruction target will be added to the tuple of original labels.

replace_labels = False
class timesead.data.transforms.target_transforms.OneVsRestTargetTransform(parent: timesead.data.transforms.transform_base.Transform, normal_class: Any | None = None, anomalous_class: Any | None = None, replace_labels: bool = False)

Bases: timesead.data.transforms.transform_base.Transform

Transforms multi-class labels into binary labels for anomaly detection. “Normal” data points will have label 0, others will have label 1.

Parameters:
  • parent (timesead.data.transforms.transform_base.Transform) – Another Transform which is used as the data source for this Transform.

  • normal_class (Optional[Any]) – The input class label that should be considered normal and will have label 0 in the output.

  • anomalous_class (Optional[Any]) – You can also specify an anomalous class that will have label 1. All other labels will be transformed to 0. Note that you cannot specify both normal_class and anomalous_class.

  • replace_labels (bool) – Whether the original labels should be replaced by the Transform. If False, the additional labels will be added to the tuple of original labels.

replace_labels = False
normal_class = None
anomalous_class = None
class timesead.data.transforms.target_transforms.PredictionTargetTransform(parent: timesead.data.transforms.transform_base.Transform, window_size: int, prediction_horizon: int, replace_labels: bool = False, step_size: int = 1, reverse: bool = False)

Bases: timesead.data.transforms.window_transform.WindowTransform

Adds the last prediction_window points from the current inputs as targets for prediction objectives.

Parameters:
  • parent (timesead.data.transforms.transform_base.Transform) – Another Transform which is used as the data source for this Transform.

  • prediction_horizon (int) – Number of datapoints that should be predicted.

  • replace_labels (bool) – Whether the original labels should be replaced by the prediction target. If False, the prediction target will be added to the tuple of original labels.

  • window_size (int)

  • step_size (int)

  • reverse (bool)

input_window_size
prediction_horizon
replace_labels = False
property seq_len: int | List[int]

This should return the length of each time series. If the time series have different lengths, the return value should be a list that contains the length of each sequence. If all sequences are of equal length, this should return an int.

Return type:

Union[int, List[int]]

class timesead.data.transforms.target_transforms.OverlapPredictionTargetTransform(parent: timesead.data.transforms.transform_base.Transform, offset: int, replace_labels: bool = False)

Bases: timesead.data.transforms.transform_base.Transform

Adds the sequence shifted by offset as the target.

Parameters:
  • parent (timesead.data.transforms.transform_base.Transform) – Another Transform which is used as the data source for this Transform.

  • offset (int) – Number of steps ahead that should be predicted.

  • replace_labels (bool) – Whether the original labels should be replaced by the prediction target. If False, the prediction target will be added to the tuple of original labels.

offset
replace_labels = False
property seq_len: int | List[int]

This should return the length of each time series. If the time series have different lengths, the return value should be a list that contains the length of each sequence. If all sequences are of equal length, this should return an int.

Return type:

Union[int, List[int]]