hookeai.time_series_data.time_dataset.sum_dataset_features

sum_dataset_features(dataset, new_feature_label, sum_features_labels, features_weights=None, is_remove_features=False)[source]

Sum 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_features) resulting from the sum 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.

  • sum_features_labels (tuple[str]) – Labels of existing features to be summed into new feature.

  • features_weights (dict, default=None) – Scalar weights (item, float) multiplied by each existing feature (key, str) in the summing process. If None, then defaults to 1.0 for all features.

  • is_remove_features (bool, default=False) – If True, then remove summed features from data set after computing 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