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

improved post-processing funcitons

parent c3e6ec34
No related branches found
No related tags found
1 merge request!7669 initial run including fmnist lenet and new method
......@@ -3,48 +3,36 @@
Helper function to quickly filter a benchmark table for the distance from targets: the smaller this distance, the higher the plausibility.
"""
function plausibility(outcome::ExperimentOutcome)
function summarise_outcome(outcome::ExperimentOutcome; measure="distance_from_targets", model::Union{Nothing,String}=nothing)
bmk = outcome.bmk
df = @chain bmk() begin
@group_by(dataname, generator, model, variable)
@summarize(mean=mean(value),sd=std(value))
@filter(variable == "distance_from_targets")
@ungroup
@arrange(mean)
df = groupby(bmk(), [:dataname, :generator, :model, :variable]) |>
x -> combine(x, :value => mean => :mean, :value => std => :std) |>
x -> subset(x, :variable => ByRow(x -> x ==measure))
if !isnothing(model)
df = subset(df, :model => ByRow(x -> x == model))
end
sort!(df, [:model, :mean])
return df
end
"""
plausibility(outcome::ExperimentOutcome)
Helper function to quickly filter a benchmark table for the distance from targets: the smaller this distance, the higher the plausibility.
"""
plausibility(outcome::ExperimentOutcome; kwrgs...) = summarise_outcome(outcome, measure="distance_from_targets", kwrgs...)
"""
faithfulness(outcome::ExperimentOutcome)
Helper function to quickly filter a benchmark table for the distance from energy: the smaller this distance, the higher the faithfulness.
"""
function faithfulness(outcome::ExperimentOutcome)
bmk = outcome.bmk
df = @chain bmk() begin
@group_by(dataname, generator, model, variable)
@summarize(mean=mean(value),sd=std(value))
@filter(variable == "distance_from_energy")
@ungroup
@arrange(mean)
end
return df
end
faithfulness(outcome::ExperimentOutcome; kwrgs...) = summarise_outcome(outcome, measure="distance_from_energy", kwrgs...)
"""
closeness(outcome::ExperimentOutcome)
Helper function to quickly filter a benchmark table for the distance from the factual: the smaller this distance, the higher the closeness desideratum.
"""
function closeness(outcome::ExperimentOutcome)
bmk = outcome.bmk
df = @chain bmk() begin
@group_by(dataname, generator, model, variable)
@summarize(mean=mean(value),sd=std(value))
@filter(variable == "distance")
@ungroup
@arrange(mean)
end
return df
end
\ No newline at end of file
closeness(outcome::ExperimentOutcome; kwrgs...) = summarise_outcome(outcome, measure="distance", kwrgs...)
\ No newline at end of file
......@@ -19,7 +19,7 @@ using JointEnergyModels
using LazyArtifacts
using Logging
using Metalhead
using MLJBase: multiclass_f1score, accuracy, multiclass_precision, table, machine, fit!
using MLJBase: multiclass_f1score, accuracy, multiclass_precision, table, machine, fit!, Supervised
using MLJEnsembles
using MLJFlux
using Random
......@@ -37,6 +37,7 @@ include("experiment.jl")
include("grid_search.jl")
include("data/data.jl")
include("models/models.jl")
include("model_tuning.jl")
include("benchmarking/benchmarking.jl")
include("post_processing/post_processing.jl")
include("utils.jl")
......
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