Description Usage Arguments Details Value Author(s) References See Also Examples
Performs recursive feature selction
1 2 3 | rfe4rainfall(predictors, response, sampsize = 1, threshold = 0.06,
out = "Rain", varSize = c(1:5), tuneGrid = list(.size = 2:5, .decay =
c(0.05, 0.07)), method = "nnet", seed = 20)
|
predictors |
Either a data.frame with each column is one predictor and each row represents one pixel. Or (if only one scene is used for training) a RasterStack with one Raster is one Predictor Variable. |
response |
A vector of either Rainfall area or rainfall rates for the corresponding pixels in predictors. If only one scene is used for model training, "response" may also be a RasterLayer of the response variable. |
threshold |
if response is Rainfall rate: pixels larger than the threshold are used for rainfall rate training |
out |
Either Rain or RInfo indicating weather rainfall rates or rainfall areas should be used. |
varSize |
integer vector indicating the numbers of variables to consider in rfe. |
tuneGrid |
list of tuning parameters to be supplied to model training. See https://topepo.github.io/caret/modelList.html for tuning values |
method |
ML algorithm to be applied. default is nnet |
seed |
Any integer number. Used to produce reproducable results |
sampsize. |
Number of data points used for training |
Predictors are centered and scaled according to mean and sd values. If the day of the year is used as predictor, this variable is scaled considering max=365 and min=1
A rfe model
Hanna Meyer
rfe Function in the caret package
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | # stack the msg scenes:
msg_example <-getChannels(inpath=system.file("extdata/msg",package="Rainfall"))
# raster the sunzenith
sunzenith<-getSunzenith(inpath=system.file("extdata/msg",package="Rainfall"))
#get Date
date <- getDate(inpath=system.file("extdata/msg",package="Rainfall"))
#calculate variables (takes some time...)
pred <- calculatePredictors(msg_example,
sunzenith=sunzenith,
spectral=c("VIS0.6","NIR1.6","T0.6_1.6"),
texture=expand.grid(c("NIR1.6","T6.2_10.8"),
c("variance", "contrast"),c(3,5,9)),
filterstat=expand.grid(c("NIR1.6","T6.2_10.8"),
c("sd","min"),c(3,5,9)),
further=NULL,
date=date)
response <- raster(system.file("extdata/radar",
"201007121650_radolan_SGrid.rst",package="Rainfall"))
#Train small rfe model with 0.1% of the pixels (takes around 1 minute...)
rfeModel <- rfe4rainfall(predictors=pred,
response,
out="Rain",
sampsize=0.01,
varSize=c(2,5,10,15,20))
# Show results:
print(rfeModel)
plotRfeCV(rfeModel)
predictors(rfeModel)
plot(varImp(rfeModel$fit,scale=TRUE))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.