예제 #1
0
def calc_results(precision_list, recall_list, pmids_pos_neg, feature_sources):
    (aggregate_pos_fd, aggregate_neg_fd, number_of_positive_texts) = coveyquery.get_aggregate_freq_dists(feature_sources, pmids_pos_neg, obj=None)
    results = {}
    for precision in precision_list:
        results[precision] = {}
        for recall in recall_list:
            (recall_tokens, valid_tokens, precision_tokens) = coveyquery.do_recall_precision_calcs(aggregate_pos_fd, aggregate_neg_fd, number_of_positive_texts, recall, precision)
            print("\n** Precision: %.2f, Recall: %.2f, N_precision: %4d"  %(precision, recall, len(precision_tokens)))
            print " ".join(precision_tokens)
            results[precision][recall] = precision_tokens
    return(results)
예제 #2
0
def show_feature_performance(pmids_pos_neg, feature_sources, min_recall=0.1, min_precision=0.1, sort_by="Pr"):
    (aggregate_pos_fd, aggregate_neg_fd, number_of_positive_texts) = coveyquery.get_aggregate_freq_dists(feature_sources, pmids_pos_neg, obj=None)
    tuples = coveyquery.get_precision_recall_tuples(aggregate_pos_fd, aggregate_neg_fd, number_of_positive_texts, min_recall, min_precision)
    sorted_tuples = coveyquery.sort_by_fmeasure(tuples)
    coveyquery.print_tuples(sorted_tuples, max=None, sort=sort_by)
    return(sorted_tuples)