calculate precision and recall