Confusion Matrix
Computes Confusion Matrixes for threshold values varying from 0 to 1.
confMatrix(model, test = NULL, th = NULL, type = NULL)
model |
SDMmodel object. |
test |
SWD testing locations, if not provided it uses the
training dataset, default is |
th |
numeric vector, if provided it computes the evaluation at the given
thresholds, default is |
type |
character. The output type used for "Maxent" and "Maxnet"
methods, possible values are "cloglog" and "logistic", default is |
For models trained with the Maxent method the argument type can be:
"raw", "logistic" and "cloglog".
For models trained with the Maxnet method the argument type can be:
"link", "exponential", "logistic" and "cloglog", see maxnet
for more details.
The Confusion Matrix for all the used thresholds.
Sergio Vignali
# Acquire environmental variables
files <- list.files(path = file.path(system.file(package = "dismo"), "ex"),
pattern = "grd", full.names = TRUE)
predictors <- raster::stack(files)
# Prepare presence and background locations
p_coords <- virtualSp$presence
bg_coords <- virtualSp$background
# Create SWD object
data <- prepareSWD(species = "Virtual species", p = p_coords, a = bg_coords,
env = predictors, categorical = "biome")
# Train a model
model <- train(method = "Maxnet", data = data, fc = "l")
# Get the confusion matrix for thresholds ranging from 0 to 1
cm <- confMatrix(model, type = "cloglog")
head(cm)
tail(cm)
# Get the confusion matrix for a specific threshold
confMatrix(model, type = "logistic", th = 0.6)Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.