remove_cycle_edges_by_hierarchy.py 文件源码

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

项目:breaking_cycles_in_noisy_hierarchies 作者: zhenv5 项目源码 文件源码
def breaking_cycles_by_hierarchy_performance(graph_file,gt_file,players_score_name):

    from measures import report_performance
    if players_score_name != "ensembling":
        players_score_dict  = computing_hierarchy(graph_file,players_score_name)
        e1,e2,e3,e4 = remove_cycle_edges_by_hierarchy(graph_file,players_score_dict,players_score_name)

        if players_score_name == "pagerank":
            report_performance(gt_file,e1,"PR")
            return

        if players_score_name == "socialagony":
            note = "SA_"
        elif players_score_name == "trueskill":
            note = "TS_"

        report_performance(gt_file,e1, note+"G")
        report_performance(gt_file,e2, note+"F")
        report_performance(gt_file,e3, note+"B")
        report_performance(gt_file,e4, note+"Voting")
    else:
        players_score_dict  = computing_hierarchy(graph_file,"socialagony")
        e1,e2,e3,e4 = remove_cycle_edges_by_hierarchy(graph_file,players_score_dict,"socialagony")
        report_performance(gt_file,e1,  "SA_G")
        write_pairs_to_file(e1,graph_file[:len(graph_file)-6] + "_removed_by_SA-G.edges")
        report_performance(gt_file,e2,  "SA_F")
        write_pairs_to_file(e2,graph_file[:len(graph_file)-6] + "_removed_by_SA-F.edges")
        report_performance(gt_file,e3,  "SA_B")
        write_pairs_to_file(e3,graph_file[:len(graph_file)-6] + "_removed_by_SA-B.edges")
        report_performance(gt_file,e4,  "SA_Voting")
        write_pairs_to_file(e4,graph_file[:len(graph_file)-6] + "_removed_by_SA-Voting.edges")

        players_score_dict  = computing_hierarchy(graph_file,"trueskill")
        e5,e6,e7,e8 = remove_cycle_edges_by_hierarchy(graph_file,players_score_dict,"trueskill")
        report_performance(gt_file,e5,  "TS_G")
        write_pairs_to_file(e5,graph_file[:len(graph_file)-6] + "_removed_by_TS-G.edges")
        report_performance(gt_file,e6,  "TS_F")
        write_pairs_to_file(e6,graph_file[:len(graph_file)-6] + "_removed_by_TS-F.edges")
        report_performance(gt_file,e7,  "TS_B")
        write_pairs_to_file(e7,graph_file[:len(graph_file)-6] + "_removed_by_TS-B.edges")
        report_performance(gt_file,e8,  "TS_Voting")
        write_pairs_to_file(e7,graph_file[:len(graph_file)-6] + "_removed_by_TS-Voting.edges")

        e9 = remove_cycle_edges_by_voting(graph_file,[set(e1),set(e2),set(e3),set(e5),set(e6),set(e7)])
        report_performance(gt_file,e9,"H_Voting")
        write_pairs_to_file(e9,graph_file[:len(graph_file)-6] + "_removed_by_H-Voting.edges")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号