wildboar.utils.variable_len#

Utilities for variable length series.

Module Contents#

Functions#

get_variable_length(x)

Return the length of each time-series.

is_end_of_series(x)

Test element-wise for EoS and return result as a boolean array.

is_variable_length(x)

Test if time-series is variable length.

wildboar.utils.variable_len.get_variable_length(x)[source]#

Return the length of each time-series.

Parameters:
xtime-series

The input.

Returns:
float or ndarray

The lenght of the time series.

Examples

>>> from wildboar.utils.variable_len import get_variable_length
>>> x = np.array(
...     [
...         [[1, 2, 3, eos], [1, 2, eos, eos], [1, 2, 3, 4]],
...         [[1, 2, 3, eos], [1, 2, eos, eos], [1, eos, 3, 4]],
...     ]
... )
>>> get_variable_length(x)
[[3 2 4]
 [3 2 4]]
>>> get_variable_length([1, 2, eos, eos])
2
>>> get_variable_length([[1, 2, eos, eos]])
[2]
wildboar.utils.variable_len.is_end_of_series(x)[source]#

Test element-wise for EoS and return result as a boolean array.

Parameters:
xndarray

Input array.

Returns:
ndarray

Boolean indicator array.

wildboar.utils.variable_len.is_variable_length(x)[source]#

Test if time-series is variable length.

Parameters:
xtime-series

The input.

Returns:
bool

True if time series contains EoS.