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

Add stats features #518

Merged
merged 5 commits into from
Mar 3, 2024
Merged

Add stats features #518

merged 5 commits into from
Mar 3, 2024

Conversation

nwlandry
Copy link
Collaborator

@nwlandry nwlandry commented Mar 2, 2024

Partially addresses #514.

Copy link

codecov bot commented Mar 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.05%. Comparing base (0f6b389) to head (75bdd77).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #518      +/-   ##
==========================================
+ Coverage   92.03%   92.05%   +0.01%     
==========================================
  Files          60       60              
  Lines        4370     4378       +8     
==========================================
+ Hits         4022     4030       +8     
  Misses        348      348              

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

xgi/stats/__init__.py Outdated Show resolved Hide resolved
xgi/stats/__init__.py Outdated Show resolved Hide resolved
@maximelucas
Copy link
Collaborator

Looks good thanks Nich! Do you think there's a way to use numpy's argmin/max to get all indices rather than just the first? Would we want that?

@nwlandry
Copy link
Collaborator Author

nwlandry commented Mar 3, 2024

Looks good thanks Nich! Do you think there's a way to use numpy's argmin/max to get all indices rather than just the first? Would we want that?

That could be good, but unfortunately numpy does the same thing (returns the first max/min). I can look more into it though!

@nwlandry
Copy link
Collaborator Author

nwlandry commented Mar 3, 2024

I found this: https://stackoverflow.com/questions/25762332/how-to-get-all-the-keys-with-the-same-highest-value, but I'm not sure if we want to return an iterate. Let me know what you think!

@maximelucas
Copy link
Collaborator

maximelucas commented Mar 3, 2024

That could be good, but unfortunately numpy does the same thing (returns the first max/min). I can look more into it though!

Ah true, my bad.

but I'm not sure if we want to return an iterate. Let me know what you think!

Yea I'm not sure either honestly. Maybe let's keep it as it is for now (it's pretty standard to return just the first occurrence), and see later? You documented it so it should be okay for now.

Ultimately, say we're looking for the nodes that have minimum degree. We might want to get all of them, not just the first. If we don't implement this by default, would there be a way to do it by hand by iterating for the user? And if we return all of them by default, we should check for format consistency with other stats to avoid potential problems.

@nwlandry
Copy link
Collaborator Author

nwlandry commented Mar 3, 2024

That could be good, but unfortunately numpy does the same thing (returns the first max/min). I can look more into it though!

Ah true, my bad.

but I'm not sure if we want to return an iterate. Let me know what you think!

Yea I'm not sure either honestly. Maybe let's keep it as it is for now (it's pretty standard to return just the first occurrence), and see later? You documented it so it should be okay for now.

Ultimately, say we're looking for the nodes that have minimum degree. We might want to get all of them, not just the first. If we don't implement this by default, would there be a way to do it by hand by iterating for the user? And if we return all of them by default, we should check for format consistency with other stats to avoid potential problems.

I think that we can accomplish this in two ways: (1) add the ability to argsort() and (2) make a recipe to show how to get all max IDs. I added a note to #514 and opened Issue #520 corresponding to the recipe.

@nwlandry nwlandry merged commit b6201d6 into main Mar 3, 2024
24 checks passed
@nwlandry nwlandry deleted the stats-features branch March 3, 2024 15:03
@nwlandry nwlandry linked an issue Mar 11, 2024 that may be closed by this pull request
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.

Add more statistics functionality
2 participants