S3 plot method for pigauto_fit objects, using base R
graphics. Three plot types are available: training history,
calibrated gate values, and conformal prediction scores.
Usage
# S3 method for class 'pigauto_fit'
plot(x, type = "history", ...)Arguments
- x
An object of class
"pigauto_fit".- type
Character.
"history"(default when a GNN was trained): 2x2 panel of training loss components (reconstruction, shrinkage, gate regularisation) and validation loss over epochs. A fit withgnn = FALSE(the default) has no training history, soplot(fit)then shows"gates"instead."gates": bar plot of calibrated gate values per trait, coloured by trait type (green = continuous, blue = count, orange = ordinal, red = binary, purple = categorical)."conformal": bar plot of conformal prediction scores per trait with a reference line at the median score.- ...
Additional arguments passed to base plotting functions.
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
data <- preprocess_traits(traits, tree)
splits <- make_missing_splits(data$X_scaled, trait_map = data$trait_map)
fit <- fit_pigauto(data, tree, splits = splits, epochs = 5L,
eval_every = 1L, verbose = FALSE, gnn = TRUE)
#> Warning: phylo_signal_gate requires the 'phytools' package; returning NA for all traits.
#> Warning: Small validation set for 2 trait(s): Mass (n=2), Wing.Length (n=1). Calibrated gate and conformal scores will be noisy for these trait(s). 95% split-conformal coverage is NOT achievable for 2 trait(s) with fewer than 19 validation cells (Mass (n=2), Wing.Length (n=1)): the achievable ceiling is n_val / (n_val + 1), which only reaches 0.95 at n_val >= 19. See `?fit_pigauto` under 'Calibration at small n' for smoothing options.
plot(fit)
plot(fit, type = "history")
plot(fit, type = "gates")
plot(fit, type = "conformal")
# }
