timesead.data.transforms.transform_base

Classes

Transform

Base class for all transforms.

Module Contents

class timesead.data.transforms.transform_base.Transform(parent: Transform | None)

Bases: abc.ABC

Base class for all transforms. A Transform processes one (or several) data points and outputs them. Transforms can be chained in a pull-based pipeline.

Parameters:

parent (Optional[Transform]) – Another Transform which is used as the data source for this Transform. Can be None in the case of a source.

parent
get_datapoint(item: int) Tuple[Tuple[torch.Tensor, Ellipsis], Tuple[torch.Tensor, Ellipsis]]

Returns a datapoint (in our case this is a sequence) from this transform.

Parameters:

item (int) – Must be 0<=item<len(self)

Returns:

A datapoint of the form (inputs, targets), where inputs and targets are tuples of tensors.

Return type:

Tuple[Tuple[torch.Tensor, Ellipsis], Tuple[torch.Tensor, Ellipsis]]

__len__() int | None

This should return the number of available sequences after the transformation.

Return type:

Optional[int]

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]]

property num_features: int | Tuple[int, Ellipsis]

Number of features of each datapoint. This can also be a tuple if the data has more than one feature dimension.

Return type:

Union[int, Tuple[int, Ellipsis]]