Skip to contents

Plot the selected model metrics relative to the distribution of across all models in the grid search

Usage

plot_grid_search_metrics(
  train_metrics,
  test_metrics,
  bf = NULL,
  include = NULL,
  cor_threshold,
  cor_metric,
  use = "test"
)

Arguments

train_metrics

training statistics data frame

test_metrics

test statistics data frame

bf

bird flow model

include

Names of metrics to include in the plots should be columns in train_metrics or test_metrics.

cor_threshold

correlation threshold used when selecting models

cor_metric

correlation metrics used when selecting models

use

"test" or "train" to indicate what statistics to use in the plot

Value

A ggplot plot object

Examples

files <- c("sstspa_model.hdf5", "sstspa_test_metrics.rds", "sstspa_train_metrics.rds")
paths <- lapply(paste0("rmd/example_data/", files), function(x) system.file(x, package = "BirdFlowPipeline"))
names(paths) <- c("model", "test_metrics", "train_metrics")
bf <- import_birdflow(paths$model)
#> Error in import_birdflow(paths$model): could not find function "import_birdflow"
test_metrics <- readRDS(paths$test_metrics)
train_metrics <- readRDS(paths$train_metrics)

included_metrics <- c("mean_dist_cor", "mean_ll", "mean_energy_improvement", 
  "weighted_mean_win_prob", "weighted_mean_win_distance",
  "weighted_mean_win_distance_fraction", "weighted_mean_ll", 
  "weighted_energy_improvement", "pit_row", "pit_col")

plot_grid_search_metrics(train = train_metrics, test = test_metrics, bf, include = included_metrics,  cor_threshold = 0.9, cor_metric = "min_dist_cor")
#> Error: object 'bf' not found