Learn R Programming

mlspatial (version 0.1.1)

model_evaluation_examples: Examples for model evaluation functions

Description

Examples for model evaluation functions

Arguments

Examples

Run this code
# \donttest{
library(randomForest)
library(caret)
data(panc_incidence)
mapdata <- join_data(africa_shp, panc_incidence, by = "NAME")
rf_model <- randomForest(incidence ~ female + male + agea + ageb + agec + fagea + fageb + fagec +
magea + mageb + magec + yrb + yrc + yrd + yre, data = mapdata, ntree = 500,
importance = TRUE)

rf_preds <- predict(rf_model, newdata = mapdata)
rf_metrics <- postResample(pred = rf_preds, obs = mapdata$incidence)
print(rf_metrics)
# }

Run the code above in your browser using DataLab