Description Usage Arguments Details Value Author(s) Examples
View source: R/RFclass_LLOCV.R
RF Classification with LLOCV
1 2 3 4 5 6 7 8 9 | RFclass_LLOCV(
tDat,
predCol = "default",
predStk = NULL,
classCol = "class",
classLocCol = "class_location",
nk = NULL,
Cores = 1
)
|
tDat |
data.frame - with values of the predictors (see details) |
predCol |
numeric - seq of columns with predictor values. By default uses 1:(length(tDat)-1) for tDat format computed by IKARUS::exrct_Traindat |
predStk |
|
classCol |
character - name of the column containing the class information |
classLocCol |
character - name of the column containing the class and location information |
nk |
|
Cores |
numeric - amount of Cores to exclude from calculation, default = 1 |
predCol - specific predictors can be selected by setting predCol = x:y
tDat - the use of IKARUS::exrct_Traindat is recommended.
parallel processing - the function uses parallel processing for multicore processors. by default all cores -1 are used.
returns a list with the model and the prediction
Andreas Schönberg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | # load data
require(caret)
require(CAST)
require(doParallel)
require(raster)
require(IKARUS)
lau_Stk <- raster::stack(system.file("extdata","lau_RGB.grd",package = "IKARUS"))
lau_tP <-rgdal::readOGR(system.file("extdata","lau_TrainPolygon.shp",package = "IKARUS"))
# handle CRS string
crs(lau_tP) <- crs(lau_Stk)
### extract values using 'exrct_Tdat' to generate training dataset
tDat <- exrct_Traindat_LLOCV(lau_tP,lau_Stk,classCol="class",locname="location")
# check for class column and predictor columns in input training dataset
head(tDat)
# classification
model1 <- RFclass_LLOCV(tDat = tDat,predCol = "default",predStk = lau_Stk,classCol = "class",nk=5)
# check model
model1$model_LLOCV
# plot prediction
plot(model1$prediction)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.