From c7bfd6273614845c0a06ee418c5895ea43e816cd Mon Sep 17 00:00:00 2001 From: kylebd99 Date: Wed, 20 Dec 2023 15:31:32 -0800 Subject: [PATCH] add x_order to graphing functions --- Experiments/Scripts/comparison_exps.jl | 24 +++++++++++++-------- Experiments/Scripts/query_size_exps.jl | 9 ++++---- Experiments/build_color_summaries.jl | 2 +- Experiments/graph_results.jl | 30 +++++++++++++++++++++++++- Experiments/run_estimators.jl | 2 +- 5 files changed, 51 insertions(+), 16 deletions(-) diff --git a/Experiments/Scripts/comparison_exps.jl b/Experiments/Scripts/comparison_exps.jl index b7ad582..16994bb 100644 --- a/Experiments/Scripts/comparison_exps.jl +++ b/Experiments/Scripts/comparison_exps.jl @@ -3,8 +3,7 @@ using Profile include("../Experiments.jl") #datasets = [human, aids, lubm80, yeast, hprd, dblp, youtube, eu2005, patents, wordnet] -#datasets = [human, aids, lubm80, yeast, dblp, youtube, eu2005, patents] -datasets = [human] +datasets = [human, aids, lubm80, yeast, dblp, youtube, eu2005, patents] experiment_params = Vector{ExperimentParams}() for dataset in datasets @@ -43,34 +42,40 @@ end #build_experiments(experiment_params) -run_estimation_experiments(experiment_params) +#run_estimation_experiments(experiment_params) + +order = [string(data) for data in datasets] graph_grouped_boxplot_with_comparison_methods(experiment_params; ylims=[10^-5, 10^4], - y_ticks=[10^-5, 10^-2, 10^0, 10^2, 10^4], + y_ticks=[10^-5, 10^-4, 10^-3, 10^-2, 10^-1, 10^0, 10^1, 10^2, 10^3, 10^4], y_type = runtime, + x_order = order, grouping=description, dimensions = (1450, 550), legend_pos=:top, - y_label="Inference Latency (10^ s)", + y_label="Inference Latency 10^ (s)", filename="overall_runtime") graph_grouped_boxplot_with_comparison_methods(experiment_params; ylims=[10^-21, 10^21], y_ticks=[10^-20, 10^-15, 10^-10, 10^-5, 10^-2, 10^0, 10^2, 10^5, 10^10, 10^15, 10^20], y_type = estimate_error, + x_order = order, grouping=description, dimensions = (1450, 550), - legend_pos=:top, - y_label="Relative Error (10^)", + legend_pos=:bottomleft, + y_label="Relative Error 10^", filename="overall_error") graph_grouped_bar_plot(experiment_params; grouping=description, y_type=memory_footprint, - ylims=[0, 30], - y_ticks = [5, 10, 15, 20, 25, 30], + x_order = order, + ylims=[0, 50], + y_ticks = [10, 20, 30, 40, 50], + legend_pos=:topright, dimensions = (1000, 550), y_label="Memory (MBs)", filename="overall_memory") @@ -78,6 +83,7 @@ graph_grouped_bar_plot(experiment_params; graph_grouped_bar_plot(experiment_params; grouping=description, y_type=build_time, + x_order = order, ylims=[0, 1600], y_ticks = [200, 400, 600, 800, 1000, 1200, 1400, 1600], dimensions = (1000, 550), diff --git a/Experiments/Scripts/query_size_exps.jl b/Experiments/Scripts/query_size_exps.jl index df726f4..5dd9bd3 100644 --- a/Experiments/Scripts/query_size_exps.jl +++ b/Experiments/Scripts/query_size_exps.jl @@ -19,11 +19,12 @@ for dataset in datasets push!(experiment_params, ExperimentParams(deg_stats_type=MinDegStats, dataset=dataset, partitioning_scheme=[(QuasiStable, 64)], + max_cycle_size = -1, description = "MinQ64")) - push!(experiment_params, ExperimentParams(deg_stats_type=MaxDegStats, dataset=dataset, partitioning_scheme=[(QuasiStable, 64)], + max_cycle_size = -1, description = "MaxQ64")) push!(experiment_params, ExperimentParams(deg_stats_type=MaxDegStats, @@ -45,13 +46,13 @@ end graph_grouped_boxplot_with_comparison_methods(experiment_params; ylims=[10^-5, 10^4], - y_ticks=[10^-5, 10^-2, 10^0, 10^2, 10^4], + y_ticks=[10^-5, 10^-4, 10^-3, 10^-2, 10^-1, 10^0, 10^1, 10^2, 10^3, 10^4], x_type = query_size, y_type = runtime, grouping=description, dimensions = (1450, 550), - legend_pos=:topleft, - y_label="Runtime 10^ (s)", + legend_pos=:topright, + y_label="Inference Latency 10^ (s)", x_label = "Query Size", filename="query_size_runtime") diff --git a/Experiments/build_color_summaries.jl b/Experiments/build_color_summaries.jl index bb336e4..f018122 100644 --- a/Experiments/build_color_summaries.jl +++ b/Experiments/build_color_summaries.jl @@ -1,5 +1,5 @@ function build_experiments(experiment_params_list::Vector{ExperimentParams}) - @sync @distributed for experiment_params in experiment_params_list + @sync @distributed for experiment_params in shuffle(experiment_params_list) build_times = [("Dataset", "Partitioner", "NumColors", "BuildPhase", "BuildTime", "MemoryFootprint")] dataset = experiment_params.dataset summary_params = experiment_params.summary_params diff --git a/Experiments/graph_results.jl b/Experiments/graph_results.jl index 1a5ee24..78e4f86 100644 --- a/Experiments/graph_results.jl +++ b/Experiments/graph_results.jl @@ -6,6 +6,7 @@ function graph_grouped_box_plot(experiment_params_list::Vector{ExperimentParams} x_type::GROUP=dataset, y_type::VALUE=estimate_error, grouping::GROUP=technique, + x_order = nothing, legend_pos = :outertopleft, x_label=nothing, y_label=nothing, @@ -42,6 +43,13 @@ function graph_grouped_box_plot(experiment_params_list::Vector{ExperimentParams} push!(groups, current_group) end end + + if isnothing(x_order) + x_order = sort(unique(x_values)) + end + x_ticks = ([x for x in 1:length(x_order)], x_order) + x_order_hash = [hash(x) for x in x_order] + x_values = [only(indexin(hash(x), x_order_hash)) for x in x_values] results_filename = params_to_results_filename(experiment_params_list[1]) println("starting graphs") @@ -51,6 +59,8 @@ function graph_grouped_box_plot(experiment_params_list::Vector{ExperimentParams} gbplot = groupedboxplot(x_values, [log10(y) for y in y_values], group = groups, + x_ticks = x_ticks, + xlims = [0, length(x_order)], ylims = (log10(ylims[1]),log10(ylims[2])), y_ticks = [log10(y) for y in y_ticks], legend = legend_pos, @@ -117,6 +127,7 @@ function query_size_category(s) end function graph_grouped_boxplot_with_comparison_methods(experiment_params_list::Vector{ExperimentParams}; + x_order = nothing, x_type::GROUP=dataset, y_type::VALUE=estimate_error, grouping::GROUP=technique, @@ -193,6 +204,12 @@ function graph_grouped_boxplot_with_comparison_methods(experiment_params_list::V push!(estimators, estimator) end end + if isnothing(x_order) + x_order = sort(unique(x_values)) + end + x_ticks = ([x for x in 1:length(x_order)], x_order) + x_order_hash = [hash(x) for x in x_order] + x_values = [only(indexin(hash(x), x_order_hash)) for x in x_values] sorted_vals = sort(zip(x_values, y_values, estimators), by=(x)->x[1]) x_values = [x[1] for x in sorted_vals] y_values = [x[2] for x in sorted_vals] @@ -204,6 +221,8 @@ function graph_grouped_boxplot_with_comparison_methods(experiment_params_list::V gbplot = groupedboxplot(x_values, [log10(y) for y in y_values], group = estimators, + x_ticks = x_ticks, + xlims = [0.5, length(x_order)+.5], ylims = (log10(ylims[1]),log10(ylims[2])), y_ticks = [log10(y) for y in y_ticks], legend = legend_pos, @@ -228,6 +247,7 @@ function graph_grouped_bar_plot(experiment_params_list::Vector{ExperimentParams} x_type::GROUP=dataset, y_type::VALUE=estimate_error, grouping::GROUP=technique, + x_order = nothing, x_label=nothing, y_label=nothing, ylims=[0, 10^2.5], @@ -284,11 +304,17 @@ function graph_grouped_bar_plot(experiment_params_list::Vector{ExperimentParams} current_y = results_df[i, :EstimationTime] end # push the errors and their groupings into the correct vector - push!(x_values, current_x) + push!(x_values, string(current_x)) push!(y_values, current_y) push!(groups, current_group) end end + if isnothing(x_order) + x_order = collect(sort(unique(x_values))) + end + x_ticks = ([x for x in 1:length(x_order)], x_order) + x_order_hash = [hash(x) for x in x_order] + x_values = [only(indexin(hash(x), x_order_hash)) for x in x_values] results_filename = params_to_results_filename(experiment_params_list[1]) println("starting graphs") @@ -298,7 +324,9 @@ function graph_grouped_bar_plot(experiment_params_list::Vector{ExperimentParams} gbplot = StatsPlots.groupedbar(x_values, y_values, group = groups, + x_ticks = x_ticks, ylims=ylims, + xlims = [0.5, length(x_order)+.5], y_ticks = y_ticks, legend = legend_pos, size = dimensions, diff --git a/Experiments/run_estimators.jl b/Experiments/run_estimators.jl index 119f118..6c1e1f6 100644 --- a/Experiments/run_estimators.jl +++ b/Experiments/run_estimators.jl @@ -6,7 +6,7 @@ function run_estimation_experiments(experiment_params_list::Vector{ExperimentPar !isfile(summary_file_location) && error("The summary has not been built yet! \n Attempted File Location: $(summary_file_location)") summary::ColorSummary = deserialize(summary_file_location) experiment_results = SharedArray{Tuple{Float64, Float64, Float64, String255, String255, Float64}}(length(all_queries[dataset])) - @sync @distributed for i in 1:length(experiment_results) + @sync @distributed for i in shuffle(collect(eachindex(experiment_results))) query::QueryGraph = all_queries[dataset][i].query query_path = all_queries[dataset][i].query_path exact_size = all_queries[dataset][i].exact_size