-
Notifications
You must be signed in to change notification settings - Fork 181
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Wrong initialization of bounded cost matrix for some elastic distances #1810
Comments
thanks for that @chrisholder and I will take a look |
Great find Ill be sure to give this a look today! Thanks @albertoazzari |
If you're okay with it, I can do a pull request to address the bug. |
@chrisholder do you already have something for this? If not, we would be glad if you could make a pull request for it @albertoazzari |
PR above fixes this issue thanks for finding it! I ran the example you gave above and the answer is now 44.0
|
Thanks for all the effort and for fixing the bug :) |
Describe the bug
When using the banded version in some of the elastic distances functions with parameter window < 1.0, the current initialization of the cost matrix is incorrect. It is now filled with all zeros except the first row and column, which are filled with +inf (with the exception of the cell 0,0). This should be instead filled with +inf.
This leads to an incorrect output of the distances because when computing a cell of the matrix, the algorithm takes as a possibility, i.e. cost_matrix[.,.], a value of 0 in a neighboring cell outside the band instead of +inf.
The list of distances affected by this is the following:
Notes:
LCSS should not be modified due to the fact that the correct initial value is 0.0.
Steps/Code to reproduce the bug
Expected results
Due to this window constraint, it can only use the value on the diagonal, choosing to produce a mismatch for each entry.
Aeon result is 8.0, while the expected result should be 44.0.
Basically:
Actual results
Versions
System:
python: 3.12.4 (main, Jun 8 2024, 18:29:57) [GCC 11.4.0]
executable: /.venv/bin/python
machine: Linux-6.5.0-41-generic-x86_64-with-glibc2.35
Python dependencies:
pip: 24.1.2
setuptools: None
scikit-learn: 1.4.2
aeon: 0.10.0
statsmodels: None
numpy: 1.26.4
scipy: 1.12.0
pandas: 2.0.3
matplotlib: None
joblib: 1.4.2
numba: 0.59.1
pmdarima: None
tsfresh: None
The text was updated successfully, but these errors were encountered: