Transformations¶
Transformations of the time series intended to be used in a similar fashion to torchvision.
-
class
transforms.
Compose
(transforms)¶ Composes several transforms together.
List of transforms must currently begin with
ToTensor
and end withTarget
.- Args:
- transforms (list of
Transform
objects): list of transforms to compose.
- transforms (list of
- Example:
>>> transforms.Compose([ >>> transforms.ToTensor(), >>> transforms.LogTransform(targets=[0], offset=1.0), >>> transforms.Target(targets=[0]), >>> ])
-
class
transforms.
LogTransform
(targets=None, offset=0.0)¶ Natural logarithm of target covariate + offset.
\[y_i = log_e ( x_i + \mbox{offset} )\]- Args:
- offset (float): amount to add before taking the natural logarithm
- targets (list): list of indices to transform.
- Example:
>>> transforms.LogTransform(targets=[0], offset=1.0)
-
class
transforms.
RemoveLast
(targets=None)¶ Subtract final point in lookback window from all points in example.
- Args:
- targets (list): list of indices to transform.
- Example:
>>> transforms.RemoveLast(targets=[0])
-
class
transforms.
Standardize
(targets=None)¶ Subtract the mean and divide by the standard deviation from the lookback.
- Args:
- targets (list): list of indices to transform.
- Example:
>>> transforms.Standardize(targets=[0])
-
class
transforms.
Target
(targets)¶ Retain only target indices for output.
- Args:
- targets (list): list of indices to retain.
- Example:
>>> transforms.Target(targets=[0])
-
class
transforms.
ToTensor
(device='cpu')¶ Convert
numpy.ndarrays
to tensor.- Args:
- device (str): device on which to load the tensor.
- Example:
>>> transforms.ToTensor(device='cpu')