MCPcopy Create free account
hub / github.com/BIT-DataLab/LakeBench / evalute_csv

Function evalute_csv

union/Santos/evaluation.py:91–133  ·  view source on GitHub ↗
(which_benchmark, which_method, topk)

Source from the content-addressed store, hash-verified

89
90
91def evalute_csv(which_benchmark, which_method, topk):
92 if which_benchmark == 0:
93 current_benchmark = 'webtable'
94 groundtruth_path = '/data_ssd/webtable/small_query/ground_truth.csv'
95 elif which_benchmark == 1:
96 current_benchmark = 'opendata'
97 groundtruth_path = '/data_ssd/opendata/small_query/ground_truth.csv'
98 elif which_benchmark == 2:
99 current_benchmark = 'webtable_large'
100 groundtruth_path = '/data_ssd/webtable/large_query/ground_truth.csv'
101 elif which_benchmark == 3:
102 current_benchmark = 'opendata_large'
103 groundtruth_path = '/data/opendata/large_query/ground_truth.csv'
104
105 if which_method == 0:
106 current_method = 'santos'
107 else:
108 current_method = 'tus'
109
110 #result_path = 'result/webtable_benchmark_true_result_by_santos_full_20.csv'
111 result_path = 'result1/' + current_benchmark + '_' + current_method + '_top' + str(topk) + '.csv'
112 df_gt = pd.read_csv(groundtruth_path)
113 df_result = pd.read_csv(result_path)
114 column_data = df_result["query_table"]
115 unique_values = column_data.unique()
116 #对结果里的每个表计算精度,召回率,以及map
117 precisions = []
118 recalls = []
119 save_dict = {}
120 #保存一个字典,key是table name,value是list精度召回,存成json
121 for table in unique_values:
122 precision, recall, len_intersection, len_result, len_gt = calculate_metrics(table, df_result, df_gt)#计算这一个表的精度召回
123 precisions.append(precision)
124 recalls.append(recall)
125 save_dict[table] = (precision ,recall, len_intersection ,len_result, len_gt)
126
127
128 precision = np.mean(precisions)
129 recall = np.mean(recalls)
130
131 save_dict_to_json(save_dict, 'result/webtable_evaluation_5.json')
132 print("Precision:", precision)
133 print("Recall:", recall)
134
135
136def evalute_dict():

Callers 1

evaluation.pyFile · 0.85

Calls 2

calculate_metricsFunction · 0.70
save_dict_to_jsonFunction · 0.70

Tested by

no test coverage detected