MCPcopy Create free account
hub / github.com/COLA-Laboratory/TransOPT / plot_pareto_front

Function plot_pareto_front

demo/comparison/analysis_plot.py:311–342  ·  view source on GitHub ↗
(workload)

Source from the content-addressed store, hash-verified

309
310
311def plot_pareto_front(workload):
312 # df = load_and_prepare_data(gcc_samples_path / f"GCC_{workload}.json")
313 # df = load_and_prepare_data(llvm_samples_path / f"LLVM_{workload}.json")
314 df = load_data(workload, "ParEGO", 65535)
315 df_normalized = (df - df.min()) / (df.max() - df.min())
316 _, pareto_indices = find_pareto_front(df_normalized[objectives].values, return_index=True)
317
318 # Retrieve Pareto points
319 points = df_normalized.iloc[pareto_indices][objectives]
320
321 # Create a 3D scatter plot
322 fig = plt.figure()
323 ax = fig.add_subplot(111, projection='3d')
324 ax.set_title(f"Pareto Front for {workload}")
325 ax.set_xlabel(objectives[0])
326 ax.set_ylabel(objectives[1])
327 ax.set_zlabel(objectives[2])
328
329 # # Scatter plot for Pareto front
330 # points = df_normalized[objectives]
331
332 # Convert Series to NumPy array before plotting
333 x_values = points[objectives[0]].values
334 y_values = points[objectives[1]].values
335 z_values = points[objectives[2]].values
336
337 ax.scatter(x_values, y_values, z_values, c='b', marker='o')
338
339 # Save the plot as a file
340 file_path = package_path / "demo" / "comparison" / "pngs" / f"{target}_pf_{workload}.png"
341 plt.savefig(file_path)
342 plt.close(fig) # Close the plot to free memory
343
344
345def plot_all(workload, algorithm=""):

Callers

nothing calls this directly

Calls 3

find_pareto_frontFunction · 0.90
closeMethod · 0.80
load_dataFunction · 0.70

Tested by

no test coverage detected