is_univariate

dtaianomaly.utils.is_univariate(X: ndarray) bool[source]

Check if the given time series is univariate.

Check if the given time series consists of only one attribute. This means that the numpy array should be either one-dimiensional, or that the second dimension should have a size of 1.

Parameters:
Xarray-like of shape (n_samples, n_attributes)

The time series data to check if it is univariate.

Returns:
is_univariate: bool

True if and only if the given time series has only one dimension, or if the second dimension of the time series is of size 1.

Examples

>>> from dtaianomaly.utils import is_univariate
>>> is_univariate([1, 2, 3, 4, 5])
True
>>> is_univariate([[1], [2], [3], [4], [5]])
True
>>> is_univariate([[1, 10], [2, 20], [3, 30], [4, 40], [5, 50]])
False