tslearn.utils.ts_size¶
- tslearn.utils.ts_size(ts, be=None)[source]¶
Returns actual time series size.
Final timesteps that have NaN values for all dimensions will be removed from the count. Infinity and negative infinity ar considered valid time series values.
- Parameters:
- tsarray-like
A time series.
- beBackend object or string or None
Backend. If be is an instance of the class NumPyBackend or the string “numpy”, the NumPy backend is used. If be is an instance of the class PyTorchBackend or the string “pytorch”, the PyTorch backend is used. If be is None, the backend is determined by the input arrays. See our dedicated user-guide page for more information.
- Returns:
- int
Actual size of the time series.
Examples
>>> ts_size([1, 2, 3, numpy.nan]) 3 >>> ts_size([1, numpy.nan]) 1 >>> ts_size([numpy.nan]) 0 >>> ts_size([[1, 2], ... [2, 3], ... [3, 4], ... [numpy.nan, 2], ... [numpy.nan, numpy.nan]]) 4 >>> ts_size([numpy.nan, 3, numpy.inf, numpy.nan]) 3
Examples using tslearn.utils.ts_size
¶
Learning Shapelets