Two-panel animated GIF showing how the rank-1 (Pareto) population evolves across NSGA generations: the left panel plots the Pareto front in objective space, the right panel plots inclusion frequency of base features in that generation's Pareto solutions. Both axes (Pareto-panel x/y, frequency-panel features) are held fixed across frames so the animation is comparable frame-to-frame.

plot_pareto_evolution(
  optimization_result,
  x_metric = "sensitivity",
  y_metric = "specificity",
  top_n_features = 15L,
  generations = NULL,
  fps = 4,
  width = 1000,
  height = 500,
  point_size = 3,
  viridis_option = "plasma",
  path = NULL
)

Arguments

optimization_result

An OptimizationResult from optimize_panel().

x_metric, y_metric

Objective names for the Pareto panel axes. Defaults "sensitivity" / "specificity".

top_n_features

Integer; number of features to display on the right panel. Default 15.

generations

One of: NULL (all recorded generations, default), a single integer n giving the number of evenly-spaced frames to render, or an integer vector of specific generation numbers.

fps

Numeric; animation frames per second. Default 4.

width, height

Frame dimensions in pixels. Default 1000 x 500.

point_size

Point size in the Pareto panel. Default 3.

viridis_option

Viridis palette for coloring by panel size. Default "plasma".

path

Optional file path to write the GIF to. Default NULL (in-memory only).

Value

A magick-image representing the animated GIF.

Details

Requires the optimization to have been run with record_history = TRUE. The set of features shown on the right panel is the top-N base features by total appearances across the rank-1 population of all recorded generations; features not present in a given generation drop to zero.

Examples

if (FALSE) { # \dontrun{
opt <- optimize_panel(x, y, record_history = TRUE)
anim <- plot_pareto_evolution(opt)
anim  # display in RStudio viewer
plot_pareto_evolution(opt, path = "evolution.gif")
} # }