Skip to content

Instantly share code, notes, and snippets.

@hongthaiphi
Created September 21, 2016 15:41
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/a0a87d6737780e0c65fa67f3723c0676 to your computer and use it in GitHub Desktop.
Save hongthaiphi/a0a87d6737780e0c65fa67f3723c0676 to your computer and use it in GitHub Desktop.
# Random Predictor
def predict_random(context, utterances):
return np.random.choice(len(utterances), 10, replace=False)
# Evaluate Random predictor
y_random = [predict_random(test_df.Context[x], test_df.iloc[x,1:].values) for x in range(len(test_df))]
y_test = np.zeros(len(y_random))
for n in [1, 2, 5, 10]:
print("Recall @ ({}, 10): {:g}".format(n, evaluate_recall(y_random, y_test, n)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment