Skip to content

Instantly share code, notes, and snippets.

@timothyrenner
Last active September 13, 2018 15:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save timothyrenner/66f0e5f63a77032c02679d368e9794f7 to your computer and use it in GitHub Desktop.
Save timothyrenner/66f0e5f63a77032c02679d368e9794f7 to your computer and use it in GitHub Desktop.
Average Agreement, Attempt 1
def average_agreement(list1, list2, max_depth):
agreements = []
for depth in range(1, max_depth+1):
set1 = set(list1[:depth])
set2 = set(list2[:depth])
intersection = set1 & set2
agreements.append(2 * len(intersection) / (len(set1) + len(set2)))
return sum(agreements) / len(agreements)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment