Open NAThompson opened 8 months ago
Hello @NAThompson,
Thank you for your issue.
Indeed, there is an overflow which can occur if the function gak
is run on long time series which have very few variations.
We have: gak(s1, s2) = unnormalized_gak(s1, s2) / sqrt(unnormalized_gak(s1, s1) * unnormalized_gak(s2, s2))
For example, if s1
is a constant time series (worst possible scenario) of size n
, the function unnormalized_gak(s1, s1)
will return the number of possible warpings to match s1
with itself, each warping being optimal.
This number is equal to the number of paths in a grid of n
rows and n
columns to go from the top left cell to the bottom right cell when the only possible moves are going right, down or diagonally (right and down).
When s1
is a constant time series, unnormalized_gak(s1, s1)
returns a float when n <= 405
an returns inf
when n >= 406
.
If s1
and s2
are both constant time series of size n
, the product unnormalized_gak(s1, s1) * unnormalized_gak(s2, s2)
returns a float when n <= 204
and returns inf
when n >= 205
.
Describe the bug
gak(x,y)
returnsnan
for allx,y
.To Reproduce
Expected behavior
The computation should not return NaN; maybe it needs to be stabilized with the log-sum-exp method?
Environment (please complete the following information):