Created
September 27, 2023 21:36
-
-
Save Xevion/1b5c971e88ac51521c133cc7e04ecdff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def score(distribution): | |
count = len(distribution) | |
deviation = [abs(1 / count - d) for d in distribution] | |
avg_deviation = sum(deviation) / count | |
return 1 - sum(deviation) / count | |
print(score([1 / 5 for _ in range(5)])) | |
print(score([0.12, 0.33, 0.55])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment