Skip to content

Commit

Permalink
Merge pull request #7 from divyegala/fea-2312-bench-ann-conf
Browse files Browse the repository at this point in the history
add cross products for yaml->json configs
  • Loading branch information
cjnolet authored Oct 24, 2023
2 parents 9e52c11 + 14e2c5d commit 2532571
Show file tree
Hide file tree
Showing 7 changed files with 310 additions and 194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ def convert_json_to_csv_build(dataset, dataset_path):
"time": df["real_time"],
}
)
write.to_csv(file.replace(".json", ".csv"), index=False)
filepath = os.path.normpath(file).split(os.sep)
filename = filepath[-1].split("-")[0] + ".csv"
write.to_csv(os.path.join(f"{os.sep}".join(filepath[:-1]), filename), index=False)


def convert_json_to_csv_search(dataset, dataset_path):
Expand Down
27 changes: 18 additions & 9 deletions python/raft-ann-bench/src/raft-ann-bench/plot/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ def mean_y(algo):
fig = ax.get_figure()
print(f"writing build output to {fn_out}")
plt.title("Build Time for Highest QPS")
plt.suptitle(f"{dataset} k={k} batch_size={batch_size}")
plt.suptitle(f"{dataset}")
plt.ylabel("Build Time (s)")
fig.savefig(fn_out)

Expand Down Expand Up @@ -349,17 +349,26 @@ def load_all_results(
):
results_path = os.path.join(dataset_path, "result", method)
result_files = os.listdir(results_path)
result_files = [
result_filename
for result_filename in result_files
if f"{k}-{batch_size}" in result_filename
]
if len(algorithms) > 0:
print(result_files)
if method == "search":
result_files = [
result_filename
for result_filename in result_files
if result_filename.split("-")[0] in algorithms
if f"{k}-{batch_size}" in result_filename
]
if len(algorithms) > 0:
result_files = [
result_filename
for result_filename in result_files
if result_filename.split("-")[0] in algorithms
]
elif method == "build":
if len(algorithms) > 0:
result_files = [
result_filename
for result_filename in result_files
if result_filename.split("-")[0] in algorithms
]

results = load_lines(results_path, result_files, method, index_key)

Expand Down Expand Up @@ -450,7 +459,7 @@ def main():
)
build_output_filepath = os.path.join(
args.output_filepath,
f"build-{args.dataset}-k{k}-batch_size{batch_size}.png",
f"build-{args.dataset}.png",
)

search_results = load_all_results(
Expand Down
Loading

0 comments on commit 2532571

Please sign in to comment.