Skip to content

Commit

Permalink
feat: save results in CSV file
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonfmir committed Apr 8, 2024
1 parent 2c10c11 commit ccee9b5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/evaluation/lean-pre-dcp/extract_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import matplotlib.pyplot as plt
import numpy as np
import heapq
import csv

def extract_stats_from_file(file_path):
with open(file_path, 'r') as file:
Expand Down Expand Up @@ -167,6 +168,17 @@ def plot_stats1(fn, xs, xs_label, ys, ys_label):
command_times_per_step = np.array([0 if numbers_of_steps[i] == 0 else command_times[i] / numbers_of_steps[i] for i in range(len(command_times))])
print('Average command time per step: ', np.average(command_times_per_step))

results = [(problem_names[i], egg_times[i], command_times[i]) for i in range(len(problem_names))]

output_file = eval_dir + "/pre_dcp_eval_results.csv"

with open(output_file, 'w', newline='') as file:
writer = csv.writer(file)
writer.writerow(["problem_name", "egg_time", "command_time"])
writer.writerows(results)

print("Results saved to:", output_file)

# Remove some outliers.
to_remove = 8
idxs_to_remove = heapq.nlargest(to_remove, range(len(command_times)), key=command_times.__getitem__)
Expand Down

0 comments on commit ccee9b5

Please sign in to comment.