(model, folder_path = 'benchmark')
| 191 | |
| 192 | |
| 193 | def cal_max_c_alignment(model, folder_path = 'benchmark'): |
| 194 | file_names = os.listdir(folder_path) |
| 195 | #找出表中最大的列数 |
| 196 | max_c = 0 |
| 197 | for file_name in file_names: |
| 198 | df = pd.read_csv(folder_path+'/'+file_name) |
| 199 | max_c = max(max_c, len(df.columns)) |
| 200 | #使用字典存每个max_c的分布,key是c,value是列表 |
| 201 | max_c_score_dict = {} |
| 202 | for i in range(max_c): |
| 203 | max_c_score_dict[i+1] = [] |
| 204 | |
| 205 | np.random.seed(41) |
| 206 | combinations = list(itertools.combinations(file_names, 2)) |
| 207 | random_numbers = np.random.randint(low=0, high=len(combinations), size=800)#11696 |
| 208 | subset = [combinations[i] for i in random_numbers] |
| 209 | idx = 0 |
| 210 | for pair in subset: |
| 211 | d = alignment_process(pair[0], pair[1], model, 'distribution') |
| 212 | for c, score in d.items(): |
| 213 | max_c_score_dict[c].append(score) |
| 214 | idx += 1 |
| 215 | print(idx) |
| 216 | |
| 217 | for c, l in max_c_score_dict.items(): |
| 218 | file_path = 'alignDistribution/'+str(c)+'_align_distribution.json' |
| 219 | |
| 220 | save_dict_to_json(l, file_path) |
| 221 | |
| 222 | #首先读取所有的表,循环处理,每次处理一个表 |
| 223 | def main(): |
no test coverage detected