BestPredFFS_LLOCV: Select best performance layers for classification with a...

Description Usage Arguments Details Value Note Author(s) Examples

View source: R/BestPredFFS_LLOCV.R

Description

uses a forward feature selection (FFS) to select the best predictors for the classification

Usage

1
2
3
4
5
6
7
8
BestPredFFS_LLOCV(
  tDat,
  predCol = "default",
  classCol = NULL,
  classLocCol = "class_location",
  nk = NULL,
  Cores = 1
)

Arguments

tDat

data.frame - with values of the predictors (see details)

predCol

numeric - seq of columns with the predictor values. By default uses 1:(length(tDat)-1) for tDat format computed by 'IKARUS::exrct_Traindat'

classCol

character - name of the column containing the class information

classLocCol

character - name of the column containing the class and location information

nk
  • numeric - number for k in spacefolds

Cores

numeric - amount of Cores to exclude from calculation, default = 1

Details

The function is used to select best performing predictor variables for a classification. The

Value

returns a list of best performing predictors

Note

The function will compute a huge number of models. Depending on the sizes of the training data the process can take long time even with multicore processing.

Author(s)

Andreas Schönberg

Examples

 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)
# FFS with all layers in the RasterStack (this example could take some minutes)
ffs <- BestPredFFS_LLOCV(tDat=tDat,classCol = "class",classLocCol="class_location",nk=5)
# some code to look at the results
ffs$selectedvars # show seleted variables
ffs$perf_all # show performance of all combinations
ffs$finalModel # show confusion matrix

SchoenbergA/IKARUS documentation built on Sept. 8, 2021, 11:11 a.m.