runtime.py 文件源码

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

项目:entity_binding 作者: JasperGuo 项目源码 文件源码
def log(self, file, batch, predictions, is_detail=False):
        with open(file, "a") as f:
            string = ""
            for t, p, qid, cv, table_id in zip(batch.ground_truth, predictions, batch.questions_ids, batch.cell_value_length, batch.table_map_ids):
                result = np.sum(np.abs(np.array(p) - np.array(t)), axis=-1)
                string += "=======================\n"
                string += ("id: " + str(qid) + "\n")
                string += ("tid: " + str(table_id) + "\n")
                string += ("max_column: " + str(len(cv)) + "\n")
                string += ("max_cell_value_per_col: " + str(len(cv[0])) + "\n")
                string += ("t: " + (', '.join([str(i) for i in t])) + "\n")
                string += ("p: " + (', '.join([str(i) for i in p])) + "\n")
                string += ("Result: " + str(result == 0) + "\n")
                # string += ("s: " + str(scores) + "\n")
            f.write(string)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号