timesead.data.statistics
Functions
|
Extract data matrix from dataset. |
|
Compute whiten matrix of dataset. |
Compute statistics of each feature. |
|
Compute the mean and standard deviation of each feature. |
|
|
|
|
|
|
Computes the positions of anomalies in the dataset. |
|
Computes the length of each anomalous window in the dataset. |
|
Compute the total amount of time steps in the dataset (normal + anormal) |
Module Contents
- timesead.data.statistics.get_data_all(dataset: torch.utils.data.Dataset, take_fd: bool = False) torch.Tensor
Extract data matrix from dataset.
- Parameters:
dataset (torch.utils.data.Dataset take_id: bool) – Time-series dataset. take_fd: flag, to take first differences.
take_fd (bool)
- Returns:
data matrix
- Return type:
- timesead.data.statistics.compute_whiten_matrix(dataset: torch.utils.data.Dataset, take_fd: bool = False) torch.Tensor
Compute whiten matrix of dataset.
- Parameters:
dataset (torch.utils.data.Dataset) – Time-series dataset.
take_fd (bool)
- Returns:
whiten matrix
- Return type:
- timesead.data.statistics.compute_feature_statistics(dataset: torch.utils.data.Dataset, take_fd: bool = False) Tuple[torch.Tensor | None, torch.Tensor | None, torch.Tensor | None, torch.Tensor | None, torch.Tensor, torch.Tensor]
Compute statistics of each feature.
- Parameters:
dataset (torch.utils.data.Dataset) – Time-series dataset.
take_fd (bool)
- Returns:
Normal mean, normal std, anomaly mean, anomaly std, minimum, and maximum
- Return type:
Tuple[Optional[torch.Tensor], Optional[torch.Tensor], Optional[torch.Tensor], Optional[torch.Tensor], torch.Tensor, torch.Tensor]
- timesead.data.statistics.compute_feature_mean_std(dataset: timesead.data.dataset.BaseTSDataset, take_fd: bool = False) Tuple[torch.Tensor | None, torch.Tensor | None, torch.Tensor | None, torch.Tensor | None]
Compute the mean and standard deviation of each feature. :param dataset: Time-series dataset. :type dataset: torch.utils.data.Dataset :return: Normal mean, normal std, anomaly mean, anomaly std :rtype: Tuple[Optional[torch.Tensor], Optional[torch.Tensor], Optional[torch.Tensor], Optional[torch.Tensor]]
- Parameters:
dataset (timesead.data.dataset.BaseTSDataset)
take_fd (bool)
- Return type:
Tuple[Optional[torch.Tensor], Optional[torch.Tensor], Optional[torch.Tensor], Optional[torch.Tensor]]
- timesead.data.statistics.compute_ts_statisitcs(timeseries: torch.Tensor, targets: torch.Tensor, dim_order: str = 'tf') Tuple[torch.Tensor | None, torch.Tensor | None, torch.Tensor | None, torch.Tensor | None, torch.Tensor, torch.Tensor]
- Parameters:
timeseries (torch.Tensor)
targets (torch.Tensor)
dim_order (str)
- Return type:
Tuple[Optional[torch.Tensor], Optional[torch.Tensor], Optional[torch.Tensor], Optional[torch.Tensor], torch.Tensor, torch.Tensor]
- timesead.data.statistics.training_means(dataset)
- timesead.data.statistics.compute_anomaly_positions(dataset: torch.utils.data.Dataset) List[int]
Computes the positions of anomalies in the dataset.
- Parameters:
dataset (torch.utils.data.Dataset) – Dataset to compute the statistics of.
- Returns:
List of all the relative positions of anomalies in the dataset.
- Return type:
List[int]
- timesead.data.statistics.compute_anomaly_lengths(dataset: torch.utils.data.Dataset) List[int]
Computes the length of each anomalous window in the dataset.
- Parameters:
dataset (torch.utils.data.Dataset) – Dataset to compute the statistics of.
- Returns:
List of lengths of anomalies in the dataset.
- Return type:
List[int]
- timesead.data.statistics.compute_total_time_steps(dataset: torch.utils.data.Dataset) int
Compute the total amount of time steps in the dataset (normal + anormal)
- Parameters:
dataset (torch.utils.data.Dataset) – Dataset to compute the statistics of.
- Returns:
Number of time steps in the dataset
- Return type: