# NOT RUN {
data(iris)
ffsmodel <- ffs(iris[,1:4],iris$Species)
ffsmodel$selectedvars
ffsmodel$selectedvars_perf
# }
# NOT RUN {
# or perform model with target-oriented validation (LLO CV)
#the example is taken from the GSIF package and is described
#in Gasch et al. (2015). The ffs approach for this dataset is described in
#Meyer et al. (2018).
#Due to high computation time needed, only a small and thus not robust example
#is shown here. Run it in parallel on 3 cores:
# }
# NOT RUN {
library(doParallel)
cl <- makeCluster(3)
registerDoParallel(cl)
dat <- get(load(system.file("extdata","Cookfarm.RData",package="CAST")))
trainDat <- dat[createDataPartition(dat$VW, p = 0.001,list=FALSE),]
indices <- CreateSpacetimeFolds(trainDat,spacevar = "SOURCEID")
predictors <- c("DEM","TWI","NDRE.M","Bt","BLD","PHI","Precip_cum","cdayt")
ffsmodel <- ffs(trainDat[,predictors],trainDat$VW,method="rf",
trControl=trainControl(method="cv",index=indices$index,indexOut=indices$indexOut),
tuneLength=1)
stopCluster(cl)
# }
Run the code above in your browser using DataLab