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

wasserstein distance return type float #386

Merged
merged 1 commit into from
Oct 1, 2023
Merged

Conversation

eroell
Copy link
Contributor

@eroell eroell commented Sep 28, 2023

PR Checklist

  • Referenced issue is linked
  • If you've fixed a bug or added code that should be tested, add tests!

Description of changes
Return type of Wasserstein Distance is now float

Additional context
Fixes issue #385.
The mypy check for another not related distance metric is still failling, as before

Copy link
Collaborator

@stefanpeidli stefanpeidli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Previous output was of type jaxlib.xla_extension.ArrayImpl.

@stefanpeidli
Copy link
Collaborator

@eroell
Thanks for the PR!

@Zethson
I've added a test that catches similar output type errors for future distances as well.
Also solved the mypy warning you were reporting, reason was a type hint you suggested (was too general unfortunately, so I had to reverse that change). Now passes for me.

@Zethson
Copy link
Member

Zethson commented Oct 1, 2023

<3

@Zethson Zethson merged commit 3bd9e56 into main Oct 1, 2023
2 of 6 checks passed
wxicu added a commit that referenced this pull request Oct 16, 2023
…o dev_metadata

* 'dev_metadata' of https://github.com/theislab/pertpy:
  Documentation examples (#391)
  [pre-commit.ci] pre-commit autoupdate (#395)
  Speed up tests by subsampling (#398)
  Installation Apple Silicon (#393)
  Add new distances (#304)
  Fix cinema OT test (#392)
  [pre-commit.ci] pre-commit autoupdate (#390)
  wasserstein distance return type float (#386)
  fix naming of example data in doc examples (#387)
  Add test for test_distances.py Catches error as reported in Issue #385.
  Fix mypy warning for distances Type hint for `groups` reverted, Iterable is too general.
@Zethson Zethson deleted the wasserstein-return-type branch December 28, 2023 10:22
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.

3 participants