tslearn-team / tslearn

The machine learning toolkit for time series analysis in Python
https://tslearn.readthedocs.io
BSD 2-Clause "Simplified" License
2.92k stars 342 forks source link

Added method to compute dtw distance using custom metric without the path #452

Open sw241395 opened 1 year ago

sw241395 commented 1 year ago

Added in a method too compute the DTW distance between 2 time series using a custom metric but not generate the path.

Overall computing DTW can be quite a slow process, so i though if you was only interested in the distance then you could help speed up the code buy not creating the path. I have tried to keep it consistent with the rest of the code but happy to made stylistic changes if needed.

Overall still new to contributing to open source so happy to make any changes and feedback is always appreciated.

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.02 :tada:

Comparison is base (d8c1930) 94.57% compared to head (08e068e) 94.60%.

:exclamation: Current head 08e068e differs from pull request most recent head 71a92e6. Consider uploading reports for the commit 71a92e6 to get more accurate results

:exclamation: Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #452 +/- ## ========================================== + Coverage 94.57% 94.60% +0.02% ========================================== Files 62 62 Lines 4738 4762 +24 ========================================== + Hits 4481 4505 +24 Misses 257 257 ``` | [Impacted Files](https://app.codecov.io/gh/tslearn-team/tslearn/pull/452?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tslearn-team) | Coverage Δ | | |---|---|---| | [tslearn/metrics/\_\_init\_\_.py](https://app.codecov.io/gh/tslearn-team/tslearn/pull/452?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tslearn-team#diff-dHNsZWFybi9tZXRyaWNzL19faW5pdF9fLnB5) | `100.00% <ø> (ø)` | | | [tslearn/metrics/dtw\_variants.py](https://app.codecov.io/gh/tslearn-team/tslearn/pull/452?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tslearn-team#diff-dHNsZWFybi9tZXRyaWNzL2R0d192YXJpYW50cy5weQ==) | `97.19% <100.00%> (+0.08%)` | :arrow_up: | | [tslearn/tests/test\_metrics.py](https://app.codecov.io/gh/tslearn-team/tslearn/pull/452?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=tslearn-team#diff-dHNsZWFybi90ZXN0cy90ZXN0X21ldHJpY3MucHk=) | `100.00% <100.00%> (ø)` | |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

rtavenar commented 1 year ago

Hi @sw241395

Thanks for this suggestion. You are perfectly right that this should be offered as a direct function to the end-user.

Here is my quick feedback:

  1. This looks great (almost ready for integration)
  2. I would rather call the function dtw_from_metric
sw241395 commented 1 year ago

Hello @rtavenar

I have made the change. Hope it all looks ok. Happy to make other changes if needed.