Skip to content
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

Cast the input data to backend option and test functions in metrics for different input data types and different backend options. #479

Merged
merged 12 commits into from
Sep 28, 2023

Conversation

YannCabanes
Copy link
Contributor

@YannCabanes YannCabanes commented Sep 13, 2023

In the functions of the folder tslearn/metrics supporting the backend optional input parameter be, cast the input data to the backend option when possible (using be.array).
Test the functions of the file test_metrics.py for different input data types (list, numpy, pytorch) and different backend options (numpy, pytorch, None). Two nested for loops are used.

Therefore the following generic metric function is tested for different input data types and backend options:

def metric_function(s1, s2, be=None):
    be = instantiate_backend(be, s1, s2)
    s1 = be.array(s1)
    s2 = be.array(s2)
    ...

@codecov-commenter
Copy link

codecov-commenter commented Sep 13, 2023

Codecov Report

Patch coverage: 99.46% and project coverage change: +0.10% 🎉

Comparison is base (cac29f5) 92.79% compared to head (78517d9) 92.90%.

❗ Current head 78517d9 differs from pull request most recent head 7622481. Consider uploading reports for the commit 7622481 to get more accurate results

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #479      +/-   ##
==========================================
+ Coverage   92.79%   92.90%   +0.10%     
==========================================
  Files          67       67              
  Lines        5583     5680      +97     
==========================================
+ Hits         5181     5277      +96     
- Misses        402      403       +1     
Files Changed Coverage Δ
tslearn/tests/test_metrics.py 99.21% <99.36%> (-0.15%) ⬇️
tslearn/backend/__init__.py 100.00% <100.00%> (ø)
tslearn/backend/backend.py 85.71% <100.00%> (+3.89%) ⬆️
tslearn/backend/numpy_backend.py 94.11% <100.00%> (+0.17%) ⬆️
tslearn/backend/pytorch_backend.py 75.98% <100.00%> (+0.35%) ⬆️
tslearn/metrics/dtw_variants.py 95.52% <100.00%> (+0.03%) ⬆️
tslearn/metrics/softdtw_variants.py 93.90% <100.00%> (+0.19%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@YannCabanes YannCabanes changed the title Improve tests for backends. Test functions in metrics for different input data types and different backend options. Sep 20, 2023
@YannCabanes YannCabanes changed the title Test functions in metrics for different input data types and different backend options. Cast the input data to backend option and test functions in metrics for different input data types and different backend options. Sep 20, 2023
@YannCabanes YannCabanes merged commit e7a177c into tslearn-team:main Sep 28, 2023
12 checks passed
YannCabanes added a commit that referenced this pull request Sep 28, 2023
…etrics for different input data types and different backend options. (#479)"

This reverts commit e7a177c.
@YannCabanes YannCabanes deleted the improve-tests-for-backends branch December 21, 2023 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants