From 0902e31e983e0a63f1bb81c1645491d61bb0dfac Mon Sep 17 00:00:00 2001 From: HuangJintao <1447537163@qq.com> Date: Thu, 7 Sep 2023 22:14:00 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=BA=86=E6=8C=96=E6=8E=98?= =?UTF-8?q?=E5=87=BA=E9=87=8D=E5=A4=8Dmd=E7=9A=84bug=EF=BC=9B=20=E4=BF=AE?= =?UTF-8?q?=E6=94=B9=E5=88=97=E8=A1=A8=E9=81=8D=E5=8E=86=E6=96=B9=E5=BC=8F?= =?UTF-8?q?=EF=BC=8C=E9=81=BF=E5=85=8D=E5=8F=AF=E8=83=BD=E5=87=BA=E7=8E=B0?= =?UTF-8?q?=E7=9A=84=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inference_from_record_pairs.py | 9 ++++----- .../get_support_and_confidence.py | 18 +++++++++--------- 2 files changed, 13 insertions(+), 14 deletions(-) rename inference_from_record_pairs.py => deprecated/inference_from_record_pairs.py (93%) rename get_support_and_confidence.py => script/get_support_and_confidence.py (71%) diff --git a/inference_from_record_pairs.py b/deprecated/inference_from_record_pairs.py similarity index 93% rename from inference_from_record_pairs.py rename to deprecated/inference_from_record_pairs.py index 5efc81f..4d1b96a 100644 --- a/inference_from_record_pairs.py +++ b/deprecated/inference_from_record_pairs.py @@ -3,7 +3,6 @@ import time import Levenshtein import copy - def my_Levenshtein_ratio(str1, str2): return 1 - Levenshtein.distance(str1, str2) / max(len(str1), len(str2)) @@ -131,21 +130,21 @@ def inference_from_record_pairs(path, threshold, target_col): if __name__ == '__main__': # 目前可以仿照这个main函数写 - path = "/home/w/PycharmProjects/py_entitymatching/py_entitymatching/datasets/end-to-end/DBLP-ACM/output/7.6/TP_single_tuple.csv" + path = "input/T_positive_with_id_concat_single_tuple.csv" start = time.time() # 输入:csv文件路径,md左侧相似度阈值,md右侧目标字段 # 输出:2个md列表,列表1中md无violation,列表2中md有violation但confidence满足阈值(0.8) # 例如此处输入参数要求md左侧相似度字段至少为0.7,右侧指向'id'字段 - mds, mds_vio = inference_from_record_pairs(path, 0.7, 'id') + mds, mds_vio = inference_from_record_pairs(path, 0.7, 'id_concat') # 将列表1写入本地,路径需自己修改 - md_path = '/home/w/A-New Folder/8.14/Paper Dataset/TP_md_list.txt' + md_path = 'output/md.txt' with open(md_path, 'w') as f: for _ in mds: f.write(str(_) + '\n') # 将列表2写入本地,路径需自己修改 - vio_path = '/home/w/A-New Folder/8.14/Paper Dataset/TP_vio_list.txt' + vio_path = 'output/vio.txt' with open(vio_path, 'w') as f: for _ in mds_vio: f.write(str(_) + '\n') diff --git a/get_support_and_confidence.py b/script/get_support_and_confidence.py similarity index 71% rename from get_support_and_confidence.py rename to script/get_support_and_confidence.py index ecefada..8a16007 100644 --- a/get_support_and_confidence.py +++ b/script/get_support_and_confidence.py @@ -1,19 +1,19 @@ import time -from multi_process_infer_by_pairs import inference_from_record_pairs -from multi_process_infer_by_pairs import get_mds_metadata +from functions.multi_process_infer_by_pairs import inference_from_record_pairs +from functions.multi_process_infer_by_pairs import get_mds_metadata if __name__ == '__main__': # 目前可以仿照这个main函数写 - path = "/home/w/PycharmProjects/py_entitymatching/py_entitymatching/datasets/end-to-end/Amazon-GoogleProducts/output/8.14/TP_single_tuple.csv" + path = "/home/w/PycharmProjects/matching_dependency/input/T_positive_with_id_concat_single_tuple.csv" start = time.time() # 输入:csv文件路径,md左侧相似度阈值,md右侧目标字段 # 输出:2个md列表,列表1中md无violation,列表2中md有violation但confidence满足阈值(0.8) # 例如此处输入参数要求md左侧相似度字段至少为0.7,右侧指向'id'字段 - mds, mds_vio = inference_from_record_pairs(path, 0.7, 'id') + mds, mds_vio = inference_from_record_pairs(path, 0.1, 'id_concat') # 如果不需要输出support和confidence,去掉下面两行 - mds_meta = get_mds_metadata(mds, path, 'id') - mds_vio_meta = get_mds_metadata(mds_vio, path, 'id') + mds_meta = get_mds_metadata(mds, path, 'id_concat') + mds_vio_meta = get_mds_metadata(mds_vio, path, 'id_concat') # # 若不输出support和confidence,使用以下两块代码 # # 将列表1写入本地,路径需自己修改 @@ -30,7 +30,7 @@ if __name__ == '__main__': # 若输出support和confidence,使用以下两块代码 # 将列表1写入本地,路径需自己修改 - md_path = '/home/w/A-New Folder/8.14/Goods Dataset/TP_md_list.txt' + md_path = "output/md.txt" with open(md_path, 'w') as f: for _ in mds_meta: for i in _.keys(): @@ -38,11 +38,11 @@ if __name__ == '__main__': f.write('\n') # 将列表2写入本地,路径需自己修改 - vio_path = '/home/w/A-New Folder/8.14/Goods Dataset/TP_vio_list.txt' + vio_path = "output/vio.txt" with open(vio_path, 'w') as f: for _ in mds_vio_meta: for i in _.keys(): f.write(i + ':' + str(_[i]) + '\t') f.write('\n') - print(time.time() - start) \ No newline at end of file + print(time.time() - start)