(prec, recall, overall_prec, overall_recall, num_to_tag)
Helper method that prints confusion matrix.
Helper method that prints confusion matrix.
Helper method that prints confusion matrix .
def print_confusion_single(prec, recall, overall_prec, overall_recall, num_to_tag):
    """Helper method that prints confusion matrix."""
    logstr=""
    logstr += '{:15}\t{:7}\t{:7}\n'.format('TAG', 'Prec', 'Recall')
    for i, tag in sorted(num_to_tag.items()):
        logstr += '{:15}\t{:2.4f}\t{:2.4f}\n'.format(tag.encode('utf-8'), prec[i], recall[i])
    logstr += '{:15}\t{:2.4f}\t{:2.4f}\n'.format('OVERALL', overall_prec, overall_recall)
    logging.info(logstr)
    print logstr
def print_confusion_single ( prec , recall , overall_prec , overall_recall , num_to_tag ) : logstr = "" logstr += '{:15}\t{:7}\t{:7}\n' . format ( 'TAG' , 'Prec' , 'Recall' ) for i , tag in sorted ( num_to_tag . items ( ) ) : logstr += '{:15}\t{:2.4f}\t{:2.4f}\n' . format ( tag . encode ( 'utf-8' ) , prec [ i ] , recall [ i ] ) logstr += '{:15}\t{:2.4f}\t{:2.4f}\n' . format ( 'OVERALL' , overall_prec , overall_recall ) logging . info ( logstr ) print logstr