TimeSeries Tansform module

causalai.data.transforms.time_series

class causalai.data.transforms.time_series.DifferenceTransform(order: int = 1)

Transform time series data by taking the difference between two time steps that are a certain interval apart specified by the argument order

__init__(order: int = 1)
Parameters:

order (int) -- the interval at which two time steps are chosen for taking a difference

fit(*data: List[ndarray]) None

dummy function, since difference transform does not have any parameters to store

Parameters:

data (ndarray) -- Numpy array of shape (observations N, variables D)

transform(*data: List[ndarray]) List[ndarray] | ndarray

Function that returns the transformed data array list using the transform learned using the fit function

Parameters:

data (ndarray) -- Numpy array of shape (observations N, variables D)

Returns:

transformed data

Return type:

ndarray or list of ndarray

class causalai.data.transforms.time_series.StandardizeTransform(with_mean: bool = True, with_std: bool = True)

Transform time series data by subtracting mean and dividing by standard deviation

__init__(with_mean: bool = True, with_std: bool = True)
Parameters:
  • with_mean (bool) -- subtract mean from data if True

  • with_std (bool) -- scale data by its standard deviation if True

fit(*data: List[ndarray]) None

Function that transforms the data arrays and stores any transformation parameter associated with the transform as a class attribute (i.e., mean, variance). StandardScaler ignores any NaN values along a column when computing column mean and standard deviation.

Parameters:

data (ndarray) -- Numpy array of shape (observations N, variables D)

transform(*data: List[ndarray]) List[ndarray] | ndarray

Function that returns the transformed data array list using the transform learned using the fit function

Parameters:

data (ndarray) -- Numpy array of shape (observations N, variables D)

Returns:

transformed data

Return type:

ndarray or list of ndarray