Created
February 12, 2020 15:56
-
-
Save samarthbhargav/bdc2e7214633fb915edc318c3e72d991 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
index_sets = {1, 2} | |
list_of_metrics = [ | |
("ERR", err), | |
("MAP", average_precision), | |
("Recall@1",recall_at_1), | |
("Recall@5", recall_at_5), | |
("Recall@10", recall_at_10), | |
("Precision@1", precision_at_1), | |
("Precision@5", precision_at_5), | |
("Precision@10", precision_at_10)] | |
list_of_search_fns = [ | |
("NaiveQL", naive_ql_search), | |
("QL", ql_search), | |
("BM25", bm25_search), | |
("BOW", bow_search), | |
("TF-IDF", tfidf_search) | |
] | |
results = {} | |
for index_set in index_sets: | |
results[index_set] = {} | |
print(f"Index: {index_set}") | |
for search_fn_name, search_fn in list_of_search_fns: | |
print(f"\tEvaluating Search Function: {search_fn_name}") | |
results[index_set][search_fn_name] = {} | |
for metric_name, metric_fn in list_of_metrics: | |
r = evaluate_search_fn(search_fn, metric_fn, index_set).mean() | |
print(f"\t\tMetric: {metric_name}: {r}") | |
results[index_set][search_fn_name][metric_name] = r | |
print() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment