-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Devesh Sarda
committed
Feb 13, 2024
1 parent
2f3fb98
commit b3b5019
Showing
5 changed files
with
58 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"dataset_name" : "ogbn_arxiv", | ||
"features_stats" : { | ||
"page_size" : "16 KB", | ||
"feature_dimension" : 128, | ||
"feature_size" : "float32" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"dataset_name" : "ogbn_arxiv", | ||
"features_stats" : { | ||
"feature_layout" : "random", | ||
"page_size" : "16 KB", | ||
"feature_dimension" : 128, | ||
"feature_size" : "float32" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,44 @@ | ||
import matplotlib.pyplot as plt | ||
import os | ||
import numpy as np | ||
|
||
|
||
def visualize_results(pages_loaded, save_path, graph_title, dataset_name, num_bins=50): | ||
def visualize_results(visualize_args, num_bins=60, x_range=(0, 75), write_location=(0.75, 0.6)): | ||
# Get the number of pages read | ||
pages_loaded = visualize_args["pages_loaded"] | ||
np_arr = np.array(pages_loaded) | ||
page_mean, page_std = round(np.mean(np_arr), 2), round(np.std(np_arr), 2) | ||
|
||
# Create the histogram | ||
plt.figure() | ||
plt.ecdf(pages_loaded, label="CDF") | ||
plt.hist(pages_loaded, bins=num_bins, histtype="step", density=True, cumulative=True, label="Cumulative histogram") | ||
plt.xlabel("Number of pages loaded for node inference") | ||
plt.ylabel("Percentage of nodes") | ||
plt.title(graph_title) | ||
plt.xlim(0, 50) | ||
plt.title(visualize_args["graph_title"] + " for dataset " + visualize_args["dataset_name"]) | ||
plt.xlim(x_range) | ||
plt.legend() | ||
|
||
# Write some resulting text | ||
text_to_write = "Mean Pages Loaded: " + str(page_mean) + "\n" | ||
text_to_write += "Std Dev of Pages Loaded: " + str(page_std) + "\n" | ||
text_to_write += "Feature File Size: " + visualize_args["total_space"] | ||
|
||
# Get the current axis limits | ||
xlim = plt.xlim() | ||
ylim = plt.ylim() | ||
actual_x = write_location[0] * (xlim[1] - xlim[0]) + xlim[0] | ||
actual_y = write_location[1] * (ylim[1] - ylim[0]) + ylim[0] | ||
plt.text( | ||
actual_x, | ||
actual_y, | ||
text_to_write, | ||
fontsize=10, | ||
horizontalalignment="center", | ||
verticalalignment="center", | ||
bbox=dict(facecolor="red", alpha=0.5), | ||
) | ||
|
||
# Save the result | ||
print("Saving the result to", save_path) | ||
plt.savefig(save_path) | ||
plt.tight_layout() | ||
plt.savefig(visualize_args["save_path"]) |