(workload, algorithm="")
| 375 | |
| 376 | # 2D plot all |
| 377 | def plot_all_2d(workload, algorithm=""): |
| 378 | # df = load_and_prepare_data(llvm_samples_path / f"LLVM_{workload}.json") |
| 379 | # df = load_and_prepare_data(gcc_samples_path / f"GCC_{workload}.json") |
| 380 | # df = load_data(workload, algorithm, 65535) |
| 381 | df = load_and_prepare_data(dbms_samples_path / f"DBMS_{workload}.json") |
| 382 | df_normalized = (df - df.min()) / (df.max() - df.min()) |
| 383 | df_normalized = df |
| 384 | |
| 385 | # Create a 2D scatter plot |
| 386 | fig = plt.figure() |
| 387 | ax = fig.add_subplot(111) |
| 388 | ax.set_title(f"All samples for {workload}") |
| 389 | ax.set_xlabel(objectives[0]) |
| 390 | ax.set_ylabel(objectives[1]) |
| 391 | |
| 392 | # Scatter plot for Pareto front |
| 393 | points = df_normalized[objectives] |
| 394 | |
| 395 | # Convert Series to NumPy array before plotting |
| 396 | x_values = points[objectives[0]].values |
| 397 | y_values = points[objectives[1]].values |
| 398 | |
| 399 | ax.scatter(x_values, y_values, c='b', marker='o') |
| 400 | |
| 401 | # Save the plot as a file |
| 402 | file_path = package_path / "demo" / "comparison" / "pngs" / f"{target}_{workload}.png" |
| 403 | plt.savefig(file_path) |
| 404 | plt.close(fig) # Close the plot to free memory |
| 405 | |
| 406 | if __name__ == "__main__": |
| 407 | # workloads = load_workloads() |
no test coverage detected