Skip to contents

Runs a full comparison of the BM baseline and pigauto (with attention + calibration) over multiple random seeds. Returns a tidy data.frame suitable for plotting or downstream analysis.

Usage

compare_methods(
  data,
  tree,
  splits = NULL,
  seeds = NULL,
  epochs = 500L,
  verbose = TRUE,
  ...
)

Arguments

data

pigauto_data object.

tree

phylo object.

splits

pre-computed splits (applied to all reps) or NULL to create fresh splits per seed.

seeds

optional integer vector of random seeds for replication. The default NULL performs one run using the current RNG stream.

epochs

number of training epochs.

verbose

logical.

...

additional arguments passed to fit_pigauto.

Value

A data.frame with columns: method, trait, type, metric, value, rep.

Details

For each seed the function:

  1. Creates train/val/test splits.

  2. Fits the phylogenetic BM baseline.

  3. Fits pigauto (with attention and calibration enabled by default).

  4. Evaluates both methods on the test split.

  5. Collects results into a single data.frame.

Examples

# \donttest{
data(avonet300, tree300)
tree <- ape::keep.tip(tree300, tree300$tip.label[seq_len(30L)])
traits <- avonet300[match(tree$tip.label, avonet300$Species_Key),
                     c("Mass", "Wing.Length"), drop = FALSE]
rownames(traits) <- tree$tip.label
cmp <- compare_methods(preprocess_traits(traits, tree), tree, seeds = 1L,
                       epochs = 5L, verbose = FALSE)
#> Error: Lantern is not loaded. Please use `install_torch()` to install additional dependencies.
aggregate(value ~ method + trait + metric, data = cmp, FUN = mean)
#> Error in eval(m$data, parent.frame()): object 'cmp' not found
# }