View source: R/iucnn_best_model.R
iucnn_best_model | R Documentation |
Uses a data-frame of model-testing results generated with
iucnn_modeltest
as input, and finds the best model
based on the chosen criterion.
iucnn_best_model(
x,
criterion = "val_acc",
require_dropout = FALSE,
verbose = FALSE
)
x |
a data.frame of model-testing results as produced
by |
criterion |
name the criterion to rank models by (default="val_acc"). Valid options are "val_acc","val_loss","weighted_error", or "total_class_matches" (see details below):
|
require_dropout |
logical (default=FALSE). If set to TRUE, the best model that contains a dropout rate of > 0 will be picked, even if other non-dropout models scored higher given the chosen criterion. Dropout models are required for certain functionalities within IUCNN, such as e.g. choosing a target accuracy when using predict_iucnn. |
verbose |
logical. Set to TRUE to print screen output. Default is FALSE. |
outputs an iucnn_model
object containing all
information about the best model.
See vignette("Approximate_IUCN_Red_List_assessments_with_IUCNN")
for a tutorial on how to run IUCNN.
## Not run:
data("training_occ") #geographic occurrences of species with IUCN assessment
data("training_labels")# the corresponding IUCN assessments
# 1. Feature and label preparation
features <- iucnn_prepare_features(training_occ, type = "geographic") # Training features
labels <- iucnn_prepare_labels(training_labels, features) # Training labels
# Model-testing
model_testing_results <- iucnn_modeltest(features,
labels,
mode = 'nn-class',
seed = 1234,
dropout_rate = c(0.0,0.1,0.3),
n_layers = c('30','40_20','50_30_10'),
cv_fold = 2,
init_logfile = TRUE)
# Selecting best model based on chosen criterion
best_iucnn_model <- iucnn_best_model(model_testing_results,
criterion = 'val_acc',
require_dropout = TRUE)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.