Skip to content

Commit

Permalink
add x_order to graphing functions
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebd99 committed Dec 20, 2023
1 parent 440a764 commit c7bfd62
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 16 deletions.
24 changes: 15 additions & 9 deletions Experiments/Scripts/comparison_exps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -43,41 +42,48 @@ 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")

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),
Expand Down
9 changes: 5 additions & 4 deletions Experiments/Scripts/query_size_exps.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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")

Expand Down
2 changes: 1 addition & 1 deletion Experiments/build_color_summaries.jl
Original file line number Diff line number Diff line change
@@ -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
Expand Down
30 changes: 29 additions & 1 deletion Experiments/graph_results.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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")

Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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]
Expand All @@ -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,
Expand All @@ -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],
Expand Down Expand Up @@ -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")

Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion Experiments/run_estimators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c7bfd62

Please sign in to comment.