| import json | |
| import random | |
| def get_random_indices(array_length, num_indices): | |
| # 确保抽取的数量不超过数组长度 | |
| if num_indices > array_length: | |
| return random.sample(range(array_length), array_length) | |
| # 使用 random.sample 抽取指定数量的索引 | |
| return random.sample(range(array_length), num_indices) | |
| def find_first_non_ac(array): | |
| for element in array: | |
| if element != "AC": | |
| return element | |
| return "AC" | |
| ds = json.load(open("/home/luoxianzhen/yang/data/Ours/TestcaseBench-v28.json", "r", encoding="utf-8")) | |
| rank_dict = {} | |
| for item in ds: | |
| rank_dict[item['tcb_id']] = len(item['wrong_code']) | |
| result_file = "/home/luoxianzhen/yang/eval_wrong_code/ALLmode_results/tcb-claude-sonnet-4-20250514-thinking-lcb-fliter-lcb-rank5-all.json" | |
| result = json.load(open(result_file, "r", encoding="utf-8")) | |
| save_matrix = {} | |
| for k, v in result.items(): | |
| array_length = max([len(code['status']) for code in v['codes']]) | |
| if array_length < rank_dict[k]: | |
| continue | |
| save_matrix[k] = {} | |
| tests_index = get_random_indices(array_length, rank_dict[k]) | |
| for code in v['codes']: | |
| result_str = "" | |
| tests_status = [code['status'][i] for i in tests_index] if max(tests_index) < len(code['status']) else code['status'] | |
| for st in tests_status: | |
| result_str += st[0] | |
| save_matrix[k][f"code{code['code_id']}"] = result_str | |
| json.dump(save_matrix, open("/home/luoxianzhen/yang/data/add_experience/claude4-thinking-matrix.json", "w", encoding="utf-8"), indent=4, ensure_ascii=False) | |
Xet Storage Details
- Size:
- 1.6 kB
- Xet hash:
- 8b9e8280185f4dff1d050e66044caa92e797dfc51839b0181ca06ccc1414a651
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.