resultAnalysis.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:jingjuSingingPhraseMatching 作者: ronggong 项目源码 文件源码
def calculateMetrics(list_rank,
                     string_lyricsRecognizer,
                     coef_post_processor,
                     proportion_std,
                     am):
    """
    Calculate matching evaluation metrics
    If HSMMs is evaluated, set coef_post_processor=0

    :param list_rank:
    :param string_lyricsRecognizer:
    :param coef_post_processor:
    :param proportion_std:
    :param am:
    :return:
    """
    mrr = MRR(list_rank)
    top1hit = topXhit(1,list_rank)
    top3hit = topXhit(3,list_rank)
    top5hit = topXhit(5,list_rank)
    top10hit = topXhit(10,list_rank)
    top20hit = topXhit(20,list_rank)
    top100hit = topXhit(100,list_rank)

    # write results into csv
    path_eval = path.join(currentPath,
                          '..',
                          'eval',
                          class_name+'_'+am+'_'+string_lyricsRecognizer+'_'+str(coef_post_processor)+'_'+str(proportion_std)+'.csv')

    with open(path_eval,'wb') as csvfile:
        w = csv.writer(csvfile)
        w.writerow(['MRR',mrr])
        w.writerow(['top 1 hit',top1hit])
        w.writerow(['top 3 hit',top3hit])
        w.writerow(['top 5 hit',top5hit])
        w.writerow(['top 10 hit',top10hit])
        w.writerow(['top 20 hit',top20hit])
        w.writerow(['top 100 hit',top100hit])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号