| fit_selected | R Documentation |
This function fits models selected during model calibration().
fit_selected(calibration_results, replicate_method = "kfolds",
n_replicates = 1, sample_proportion = 0.7, type = "cloglog",
write_models = FALSE,
file_name = NULL, parallel = FALSE, ncores = NULL,
progress_bar = TRUE, verbose = TRUE, seed = 1)
calibration_results |
an object of class |
replicate_method |
(character) method used for producing replicates.
Available options are |
n_replicates |
(numeric) number of replicates or folds to generate. If
|
sample_proportion |
(numeric) proportion of occurrence and background
points to be used to fit model replicates. Only applicable when
|
type |
(character) the format of prediction values for computing thresholds. For maxnet models, valid options are "raw", "cumulative", "logistic", and "cloglog". For glm models, valid options are "cloglog", "response" and "raw". Default is "cloglog". |
write_models |
(logical) whether to save the final fitted models to disk. Default is FALSE. |
file_name |
(character) the file name, with or without a path, for saving
the final models. This is only applicable if |
parallel |
(logical) whether to fit the final models in parallel. Default is FALSE. |
ncores |
(numeric) number of cores to use for parallel processing.
Default is NULL and uses available cores - 1. This is only applicable if
|
progress_bar |
(logical) whether to display a progress bar during processing. Default is TRUE. |
verbose |
(logical) whether to display detailed messages during processing. Default is TRUE. |
seed |
(numeric) integer value used to specify an initial seed to split the data. Default is 1. |
This function also computes model consensus (mean and median), the thresholds to binarize model predictions based on the omission rate set during model calibration to select models.
An object of class 'fitted_models' containing the following elements:
species |
a character string with the name of the species. |
Models |
a list of fitted models, including replicates (fitted with part of the data) and full models (fitted with all data). |
calibration_data |
a data.frame containing a column ( |
selected_models |
a data frame with the ID and summary of evaluation metrics for the selected models. |
weights |
a numeric vector specifying weights for the predictor variables (if used). |
pca |
a list of class |
addsamplestobackground |
a logical value indicating whether any presence sample not already in the background was added. |
omission_rate |
the omission rate determined during the calibration step. |
thresholds |
the thresholds to binarize each replicate and the consensus
(mean and median), calculated based on the omission rate set in
|
# An example with maxnet models
data(calib_results_maxnet, package = "kuenm2")
# Fit models using calibration results
fm <- fit_selected(calibration_results = calib_results_maxnet,
n_replicates = 4)
# Output the fitted models
fm
# An example with GLMs
data(calib_results_glm, package = "kuenm2")
# Fit models using calibration results
fm_glm <- fit_selected(calibration_results = calib_results_glm,
replicate_method = "subsample",
n_replicates = 5)
# Output the fitted models
fm_glm
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.