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 theil, mpr and tau to metrics #138

Merged
merged 1 commit into from
Jan 16, 2024
Merged

Add theil, mpr and tau to metrics #138

merged 1 commit into from
Jan 16, 2024

Conversation

LadyChristina
Copy link
Member

@LadyChristina LadyChristina commented Jan 15, 2024

All Submissions:

  • Have you followed the guidelines in our Contributing documentation?
  • Have you verified that there aren't any other open Pull Requests for the same update/change?
  • Does the Pull Request pass all tests?

Description

Added 3 additional metrics:

  • Theil index
  • Max power ratio
  • Tau-decentralization index

Checklist

New Metric Support Submissions:

  • Did you put the metric's script under consensus_decentralization/metrics?
  • Did you name the metric's main function of the script compute_{metric name}?
  • Did you import the metric's main function to consensus_decentralization/analyze.py?
  • Did you add the new metric (and possible parameter values) to config.yaml?
  • Did you write unit tests for the new metric?
  • Did you document the new metric in the documentation pages?

def compute_tau_index(blocks_per_entity, threshold):
"""
Calculates the tau-decentralization index of a distribution of blocks
:param blocks_per_entity: a dictionary with entities and the blocks they have produced
Copy link
Member

Choose a reason for hiding this comment

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

Is this sorted? If so you can avoid making a copy and then finding the max each time (which is O(n) ).

Copy link
Member Author

Choose a reason for hiding this comment

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

No I don't think this dictionary is sorted

@LadyChristina LadyChristina merged commit abbd977 into main Jan 16, 2024
1 check passed
@LadyChristina LadyChristina deleted the more_metrics branch January 16, 2024 17:25
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