get_dimension
- dtaianomaly.utils.get_dimension(X: ndarray) int[source]
Get the dimension of the given time series.
Return the number of attributes in the given time series. This is either the size of the second dimension, or the 1 if the given array is one-dimensional.
- Parameters:
- Xarray-like of shape (n_samples, n_attributes)
The time series data to get the dimension from.
- Returns:
- int
The number of attributes in the given time series.
Examples
>>> from dtaianomaly.utils import get_dimension >>> get_dimension([1, 2, 3, 4, 5]) 1 >>> get_dimension([[1], [2], [3], [4], [5]]) 1 >>> get_dimension([[1, 10], [2, 20], [3, 30], [4, 40], [5, 50]]) 2 >>> get_dimension([[1, 10, 100], [2, 20, 200], [3, 30, 300], [4, 40, 400], [5, 50, 500]]) 3