MCPcopy Create free account
hub / github.com/comaps/comaps / main

Function main

tools/python/booking_hotels_quality.py:66–82  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

64
65
66def main():
67 options = process_options()
68 reference = load_binary_list(options.reference_list)
69 sample = load_score_list(options.sample_list)
70
71 precision, recall, threshold = metrics.precision_recall_curve(reference, sample)
72 aa = zip(precision, recall, threshold)
73 max_by_hmean = max(aa, key=lambda (p, r, t): p*r/(p+r))
74 print("Optimal threshold: {2} for precision: {0} and recall: {1}".format(*max_by_hmean))
75 print("AUC: {0}".format(metrics.roc_auc_score(reference, sample)))
76
77 if options.show:
78 plt.plot(recall, precision)
79 plt.title("Precision/Recall")
80 plt.ylabel("Precision")
81 plt.xlabel("Recall")
82 plt.show()
83
84
85if __name__ == "__main__":

Callers 1

Calls 5

load_binary_listFunction · 0.85
load_score_listFunction · 0.85
formatMethod · 0.80
process_optionsFunction · 0.70
showMethod · 0.45

Tested by

no test coverage detected