Skip to content

Commit a4baa56

Browse files
committed
Merge branch 'original-paper' of https://github.com/pat-alt/AlgorithmicRecourseDynamics.jl into original-paper
2 parents 9e63624 + 98e9766 commit a4baa56

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

docs/src/paper/experiments/_synthetic.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ end
269269
#### Bootstrap
270270

271271
```{julia}
272-
n_bootstrap = 1000
272+
n_bootstrap = 100
273273
df = run_bootstrap(results, n_bootstrap; filename=joinpath(output_path,"bootstrap.csv"))
274274
```
275275

src/base.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function run!(
6666
# Pre-allocate memory:
6767
output = [DataFrame() for i in 1:M]
6868

69-
p_fold = Progress(K; desc="Progress on folds:", showspeed=true, enabled=show_progress, output=stderr)
69+
p_fold = Progress(K; desc="Total Progress:", showspeed=true, enabled=show_progress, output=stderr, color=:yellow)
7070
@info "Running experiment ..."
7171
for k in 1:K
7272
recourse_systems = experiment.recourse_systems[k]
@@ -77,7 +77,7 @@ function run!(
7777
end
7878
# Recursion over N rounds:
7979
chosen_individuals = zeros(size(recourse_systems))
80-
p_round = Progress(N; desc="Progress on rounds:", showspeed=true, enabled=show_progress, output=stderr)
80+
p_round = Progress(N; desc="Progress on round:", showspeed=true, enabled=show_progress, output=stderr, color=:green)
8181
for n in 1:N
8282
# Choose individuals that shall receive recourse:
8383
chosen_individuals_n = choose_individuals(experiment, recourse_systems; intersect_=intersect_)
@@ -96,7 +96,7 @@ function run!(
9696
output[m] = vcat(output[m], output_checkpoint, cols=:union)
9797
end
9898
end
99-
next!(p_round, showvalues=[(:Fold, k), (:Round, n)])
99+
next!(p_round, showvalues=[(:Fold, k//K), (:Round, n//N)])
100100
end
101101
next!(p_fold)
102102
end

src/post_processing.jl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ function run_bootstrap(
1212
filename::String="bootstrapped_results.csv", show_progress=!is_logging(stderr)
1313
)
1414
df = DataFrame()
15+
n_total = length(results)
16+
p_total = Progress(n_total; desc="Total Progress:", showspeed=true, enabled=show_progress, output = stderr, color=:yellow)
1517
for (key, val) in results
1618
n_folds = length(val.experiment.recourse_systems)
17-
p_fold = Progress(n_folds; desc="Progress on folds:", showspeed=true, enabled=show_progress, output = stderr)
19+
p_fold = Progress(n_folds; desc="Progress on fold:", showspeed=true, enabled=show_progress, output = stderr, color=:green)
1820
for fold in 1:n_folds
1921
N = length(val.experiment.system_identifiers)
20-
p_sys = Progress(N; desc="Progress on systems:", showspeed=true, enabled=show_progress, output = stderr)
22+
p_sys = Progress(N; desc="Progress on system:", showspeed=true, enabled=show_progress, output = stderr, color=:blue)
2123
Threads.@threads for i in 1:N
2224
rec_sys = val.experiment.recourse_systems[fold][i]
2325
model_name, gen_name = collect(val.experiment.system_identifiers)[i]
@@ -27,10 +29,11 @@ function run_bootstrap(
2729
df_.generator .= gen_name
2830
df_.fold .= fold
2931
df = vcat(df, df_)
30-
next!(p_sys, showvalues = [(:Model, model_name), (:Generator, gen_name)])
32+
next!(p_sys, showvalues = [(:Model, model_name), (:Generator, gen_name), (:System, i//N)])
3133
end
32-
next!(p_fold)
34+
next!(p_fold, showvalues = [(:Fold, fold//n_folds)])
3335
end
36+
next!(p_total)
3437
end
3538
df = mapcols(x -> typeof(x) == Vector{Symbol} ? string.(x) : x, df)
3639
CSV.write(filename, df)

0 commit comments

Comments
 (0)