boss#
- pyts.metrics.boss(x: ArrayLike, y: ArrayLike) float[source]#
Return the BOSS distance between two arrays.
- Parameters:
- xarray-like, shape = (n_timestamps,)
First array.
- yarray-like, shape = (n_timestamps,)
Second array.
- Returns:
- distfloat
The BOSS distance between both arrays.
Notes
The BOSS metric is defined as
\[\begin{split}BOSS(x, y) = \sum_{\substack{i=1\\ x_i > 0}}^n (x_i - y_i)^2\end{split}\]where \(x\) and \(y\) are vectors of non-negative integers. The BOSS distance is not a distance metric as it neither satisfies the symmetry condition nor the triangle inequality.
References
[1]P. Schäfer, “The BOSS is concerned with time series classification in the presence of noise”. Data Mining and Knowledge Discovery, 29(6), 1505-1530 (2015).
Examples
>>> from pyts.metrics import boss >>> x = [0, 5, 5, 3, 4, 5] >>> y = [3, 0, 0, 0, 8, 0] >>> boss(x, y) 10.0 >>> boss(y, x) 5.0