Skip to content

Commit

Permalink
idek unif
Browse files Browse the repository at this point in the history
  • Loading branch information
rtjoa committed Feb 6, 2025
1 parent 07dbefe commit 526489e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Infiltrator = "5903a43b-9cc3-4c30-8d17-598619ec4e9b"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
Jive = "ba5e3d4b-8524-549f-bc71-e76ad9e9deed"
MacroTools = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09"
PGFPlots = "3b7a836e-365b-5785-a47d-02c71176b4aa"
PGFPlotsX = "8314cec4-20b6-5062-9cdb-752b83310925"
PProf = "e4faabce-9ead-11e9-39d9-4379958e3056"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Expand Down
17 changes: 14 additions & 3 deletions qc/benchmarks/benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ include("lib/lib.jl")

UNIQUE_CURVES_SAMPLES = 10_000
using Plots
# pgfplotsx()
using Random
using Infiltrator
using DataStructures
Expand Down Expand Up @@ -166,6 +167,11 @@ function mk_areaplot2(path; xlabel, ylabel, has_header)
end
end

# function PGFPlotsX.print_tex(io::IO, data::Plots.Measures.AbsoluteLength)
# print(io, string(data))
# end


function save_areaplot2(path, header, v; xlabel, ylabel)
rng = Random.MersenneTwister(42)

Expand All @@ -178,14 +184,18 @@ function save_areaplot2(path, header, v; xlabel, ylabel)
torow(v) = reshape(v, 1, length(v))

# Calculate maximum proportion for each column
threshold = 0.04 # threshold
max_proportions = vec(maximum(mat, dims=1))

# Create ordering by maximum proportion
order = sortperm(max_proportions, rev=true)
mat = mat[:, order]
max_proportions = max_proportions[order]

# Calculate threshold to show top 20 labels
num_labels_to_show = min(20, length(max_proportions))
threshold = max_proportions[num_labels_to_show]
println_flush(rs.io, "Threshold: $(threshold)")

# Find where the original first three columns ended up
original_positions = [findfirst(==(i), order) for i in 1:3]

Expand Down Expand Up @@ -247,11 +257,12 @@ function save_areaplot2(path, header, v; xlabel, ylabel)
xlabelfontsize=fontsize,
ylabelfontsize=fontsize,
legend=:outerright,
left_margin=5Plots.mm,
left_margin=10Plots.mm,
right_margin=15Plots.mm,
foreground_color_legend = nothing,
bottom_margin=5Plots.mm,
legend_left_margin=-5Plots.mm,
yticks=nothing,
)
yflip!(true)
plot!(size=(1000,500))
Expand Down Expand Up @@ -466,7 +477,7 @@ function make_plots(
end

filename = joinpath(rs.out_dir, "feature_dist_" * join(to_subpath(loss_config), "_"))
mk_areaplot2(filename, has_header=true, xlabel="Epochs", ylabel="Proportion")
mk_areaplot2(filename, has_header=true, xlabel="Epochs", ylabel="Sample Proportion")
end
end
end
Expand Down

0 comments on commit 526489e

Please sign in to comment.