hookeai.time_series_data.time_dataset.concatenate_dataset_features

concatenate_dataset_features(dataset, new_feature_label, cat_features_labels, is_remove_features=False)[source]

Concatenate existing features of time series data set into new feature.

The new feature is stored as a torch.Tensor(2d) of shape (sequence_length, n_concat_features) resulting from the concatenation of the existing features tensors along the second dimension.

Parameters:
  • dataset (torch.utils.data.Dataset) – Time series data set. Each sample is stored as a dictionary where each feature (key, str) data is a torch.Tensor(2d) of shape (sequence_length, n_features).

  • new_feature_label (str) – New feature label.

  • cat_features_labels (tuple[str]) – Labels of existing features to be concatenated into new feature. Concatenation is sorted accordingly.

  • is_remove_features (bool, default=False) – If True, then remove concatenated features from data set after concatenating the new feature.

Returns:

dataset – Time series data set. Each sample is stored as a dictionary where each feature (key, str) data is a torch.Tensor(2d) of shape (sequence_length, n_features).

Return type:

torch.utils.data.Dataset