Runs one or more refinement functions on identical benchmark inputs, records elapsed time, and evaluates every output with [evaluate_spatial_refinement()]. The same `xy`, `labels`, and optional masks are used for each method so results are directly comparable.
Arguments
- data
A benchmark object returned by a fibermargin simulator or [spatial_benchmark()], or a named list of such objects.
- methods
Named list of refinement functions. A function must accept `xy` and `labels`; `samples` is supplied when the function declares it or accepts `...`.
- include_initial
Include the unrefined assignment as method `Initial`.
- seed
Integer seed reset before each method run.
- on_error
Either `"stop"` or `"record"`. The latter returns an `error` column and `NA` performance values for a failed method rather than aborting.
Examples
sim <- simulate_spatial_domains(n = 500, pattern = "jagged_stripes", seed = 4)
methods <- list(identity = function(xy, labels) labels)
benchmark_spatial_refiners(sim, methods)
#> dataset method n classes initial_accuracy accuracy accuracy_gain
#> 1 dataset1 Initial 500 5 0.8 0.8 0
#> 2 dataset1 identity 500 5 0.8 0.8 0
#> error_reduction ari macro_recall worst_recall sparse_region_accuracy
#> 1 0 0.5648596 0.8 0.73 0.81
#> 2 0 0.5648596 0.8 0.73 0.81
#> dense_region_accuracy boundary_accuracy interior_accuracy correction_recall
#> 1 0.81 0.75 0.8125 0
#> 2 0.81 0.75 0.8125 0
#> damage_rate changed_precision changed_fraction unresolved_fraction seconds
#> 1 0 NA 0 0 0.000
#> 2 0 NA 0 0 0.001
#> error
#> 1 <NA>
#> 2 <NA>