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

Use StackedSparseArray for MetadataMatch sparse equal_match #642

Merged
merged 9 commits into from
May 17, 2024

Conversation

zargham-ahmad
Copy link
Collaborator

@zargham-ahmad zargham-ahmad commented May 10, 2024

This PR includes the following:

  • slightly refactored and updated MetadataMatch matrix function to also use StackedSparseArray for equal_match matching_type when array_type is sparse

closes #544

@zargham-ahmad zargham-ahmad changed the title Use StackedSparseArray for MetadataMatch equal_match Use StackedSparseArray for MetadataMatch equal_match sparse array_type May 10, 2024
@zargham-ahmad zargham-ahmad changed the title Use StackedSparseArray for MetadataMatch equal_match sparse array_type Use StackedSparseArray for MetadataMatch equal_match sparse array_type May 10, 2024
@zargham-ahmad zargham-ahmad changed the title Use StackedSparseArray for MetadataMatch equal_match sparse array_type Use StackedSparseArray for MetadataMatch equal_match sparse array_type May 10, 2024
@zargham-ahmad zargham-ahmad changed the title Use StackedSparseArray for MetadataMatch equal_match sparse array_type Use StackedSparseArray for MetadataMatch sparse equal_match May 10, 2024
Copy link
Collaborator

@niekdejonge niekdejonge left a comment

Choose a reason for hiding this comment

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

Looks good to me @zargham-ahmad thanks!

@niekdejonge
Copy link
Collaborator

Not completely related to this PR, but I did not look at the MetadataMatch class before, the difference between "equal_match" and "difference" was not fully clear to me at first glance. Can you maybe add a bit of extra docstring here @zargham-ahmad? And maybe we should also give a warning if a tolerance is given, but matching_type is set to "equal_match".

Comment on lines +133 to +135
if array_type not in ["numpy", "sparse"]:
raise ValueError("array_type must be 'numpy' or 'sparse'.")

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good addition - this should be covered by a unit test though to make sure this specification is tracked.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

test added in 24a8ecb

matchms/similarity/MetadataMatch.py Show resolved Hide resolved
@zargham-ahmad
Copy link
Collaborator Author

Not completely related to this PR, but I did not look at the MetadataMatch class before, the difference between "equal_match" and "difference" was not fully clear to me at first glance. Can you maybe add a bit of extra docstring here @zargham-ahmad? And maybe we should also give a warning if a tolerance is given, but matching_type is set to "equal_match".

done in 24a8ecb

@niekdejonge
Copy link
Collaborator

@zargham-ahmad Thanks for the additions. Is it ready to be merged? If so feel free to merge, or if you don't have the rights, let me know :)

@zargham-ahmad
Copy link
Collaborator Author

@zargham-ahmad Thanks for the additions. Is it ready to be merged? If so feel free to merge, or if you don't have the rights, let me know :)

Yes, it is ready. Please merge it.

@niekdejonge niekdejonge merged commit 116dc1c into matchms:master May 17, 2024
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.

MetadataMatch with "sparse" flag still allocates whole matrix
3 participants