StreamAD Utilities#
Dataset#
UnivariateDS#
MultivariateDS#
CustomDS#
- class streamad.util.CustomDS(f_path, label=None)[source]#
Bases:
streamad.util.dataset.DS
Load custom dataset. :type f_path:
Union
[str
,ndarray
] :param f_path: Dataset or its path. :type f_path: Union[str, np.ndarray] :type label:Optional
[ndarray
] :param label: Anomaly labels for dataset. Defaults to None. :type label: np.ndarray, optional
Generator#
StreamGenerator#
Math toolkit#
Statistic#
- class streamad.util.StreamStatistic(is_global=True, window_len=10)[source]#
Bases:
object
Data statistics for the streaming data, with supporting max, min, sum, mean, sum of squares, var, std and standard scaler.
- __init__(is_global=True, window_len=10)[source]#
Statistics for the streaming data, with supporting max, min, sum, mean, sum of squares, var, std and standard scaler.
- Parameters
is_global (bool, optional) – For whole stream or a windowed stream. Defaults to True.
window_len (int, optional) – Rolloing window length. Only works when is_global is False. Defaults to 10.
Visualization#
Plot#
- class streamad.util.plot(data, scores, date=None, features=None, label=None)[source]#
Bases:
Plot data, score and ground truth (if exists).
- Parameters
data (np.array) – Original data stream.
scores (np.array) – Anomaly scores of the data stream.
date (np.array, optional) – Timestamp of the data. Defaults to None.
features (np.array, optional) – Features name. Defaults to None.
label (np.array, optional) – Ground truth. Defaults to None.