Skip to content
Snippets Groups Projects
Commit 3f61596a authored by pat-alt's avatar pat-alt
Browse files

small fixes

parent e46c1408
No related branches found
No related tags found
1 merge request!8985 overshooting
{ {
"julia.environmentPath": "/Users/paltmeyer/code/ECCCo.jl"
} }
\ No newline at end of file
...@@ -192,11 +192,6 @@ function best_absolute_outcome( ...@@ -192,11 +192,6 @@ function best_absolute_outcome(
higher_is_better = [var ["validity", "redundancy"] for var in evaluation.variable] higher_is_better = [var ["validity", "redundancy"] for var in evaluation.variable]
evaluation.value[higher_is_better] .= -evaluation.value[higher_is_better] evaluation.value[higher_is_better] .= -evaluation.value[higher_is_better]
# # Normalise to allow for comparison across measures:
# evaluation =
# groupby(evaluation, [:dataname, :variable]) |>
# x -> transform(x, :value => standardize => :value)
# Reconstruct outcome with normalised values: # Reconstruct outcome with normalised values:
bmk = CounterfactualExplanations.Evaluation.Benchmark(evaluation) bmk = CounterfactualExplanations.Evaluation.Benchmark(evaluation)
outcome = ExperimentOutcome(exper, model_dict, generator_dict, bmk) outcome = ExperimentOutcome(exper, model_dict, generator_dict, bmk)
...@@ -229,6 +224,13 @@ best_absolute_outcome_eccco(outcomes; kwrgs...) = ...@@ -229,6 +224,13 @@ best_absolute_outcome_eccco(outcomes; kwrgs...) =
best_absolute_outcome_eccco_Δ(outcomes; kwrgs...) = best_absolute_outcome_eccco_Δ(outcomes; kwrgs...) =
best_absolute_outcome(outcomes; generator = ECCCo_Δ_NAMES, kwrgs...) best_absolute_outcome(outcomes; generator = ECCCo_Δ_NAMES, kwrgs...)
"""
best_outcome(outcomes)
The best outcome is chosen as follows: choose the outcome with the minium average unfaithfulness (`distance_from_energy_l2`) aggregated across all ECCCo generators (`ECCCo_Δ_NAMES`) for the weakest models (`MLP` and `MLP Ensemble`).
"""
best_outcome(outcomes; measure=["distance_from_energy_l2"]) = best_absolute_outcome(outcomes; generator=ECCCo_Δ_NAMES, measure=measure, model=["MLP", "MLP Ensemble"])
""" """
append_best_params!(params::NamedTuple, dataname::String) append_best_params!(params::NamedTuple, dataname::String)
...@@ -252,7 +254,8 @@ function append_best_params!(params::NamedTuple, dataname::String) ...@@ -252,7 +254,8 @@ function append_best_params!(params::NamedTuple, dataname::String)
"$(replace(lowercase(dataname), " " => "_")).jls", "$(replace(lowercase(dataname), " " => "_")).jls",
), ),
) )
best_params = best_absolute_outcome_eccco_Δ(grid_search_results).params best_params = best_outcome(grid_search_results).params
params = (; params..., best_params...) params = (; params..., best_params...)
@info "Best parameters: $(best_params)"
end end
end end
...@@ -13,7 +13,7 @@ function summarise_outcome( ...@@ -13,7 +13,7 @@ function summarise_outcome(
measure = isnothing(measure) ? unique(bmk().variable) : measure measure = isnothing(measure) ? unique(bmk().variable) : measure
df = bmk() df = bmk()
# If the :run column is missing (single runs), add it: # If the :run column is missing (single runs), add it:
if !(:run names(df)) if !("run" names(df))
df.run .= 1 df.run .= 1
end end
# Aggregate per run: # Aggregate per run:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment