| 6 | |
| 7 | |
| 8 | def plot_3d(): |
| 9 | fig = plt.figure() |
| 10 | ax = fig.add_subplot(111, projection='3d') |
| 11 | for jsonl_file in os.listdir('./'): |
| 12 | |
| 13 | if not jsonl_file.endswith('.jsonl'): |
| 14 | continue |
| 15 | |
| 16 | if not 'chunk_size' in jsonl_file: |
| 17 | continue |
| 18 | |
| 19 | x = [] |
| 20 | y = [] |
| 21 | z = [] |
| 22 | print(jsonl_file) |
| 23 | |
| 24 | datas = [] |
| 25 | with open(jsonl_file) as f: |
| 26 | for json_str in f: |
| 27 | json_obj = json.loads(json_str) |
| 28 | datas.append(json_obj) |
| 29 | |
| 30 | datas.sort(key=lambda x: x['throttle']) |
| 31 | |
| 32 | for data in datas: |
| 33 | chunk_size = data['chunk_size'] |
| 34 | throttle = data['throttle'] |
| 35 | f1 = data['f1'] |
| 36 | |
| 37 | x.append(chunk_size) |
| 38 | y.append(throttle) |
| 39 | z.append(f1) |
| 40 | |
| 41 | # 绘制3D曲线 |
| 42 | ax.plot(x, y, z) |
| 43 | |
| 44 | # 添加标题和标签 |
| 45 | ax.set_title('3D Line Plot') |
| 46 | ax.set_xlabel('chunk_size') |
| 47 | ax.set_ylabel('throttle') |
| 48 | ax.set_zlabel('f1') |
| 49 | |
| 50 | # 显示图形 |
| 51 | plt.show() |
| 52 | |
| 53 | |
| 54 | def plot_cross_splitter(): |