Skip to content

Instantly share code, notes, and snippets.

@hongthaiphi
Created September 21, 2016 15:37
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 hongthaiphi/a2bef91bced0715927b00a4d4c5be1af to your computer and use it in GitHub Desktop.
Save hongthaiphi/a2bef91bced0715927b00a4d4c5be1af to your computer and use it in GitHub Desktop.
def evaluate_recall(y, y_test, k=1):
num_examples = float(len(y))
num_correct = 0
for predictions, label in zip(y, y_test):
if label in predictions[:k]:
num_correct += 1
return num_correct/num_examples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment