Description Usage Arguments Value Author(s) References See Also Examples
Performs model training
1 2 3 4 5 |
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. |
scaleVars |
Center and scale variables? |
threshold |
if response is Rainfall rate: pixels larger than the threshold are used for rainfall rate training |
method |
ML algorithm to be applied. default is nnet |
tuneGrid |
list of tuning parameters to be supplied to model training. See https://topepo.github.io/caret/modelList.html for tuning values |
thresholdTune |
optional threshold tuning. Only if response ="RInfo" |
seed |
Any integer number. Used to produce reproducable results |
A train object. If keepScaling=TRUE a list with the first object is the train object and the second object is a data.frame including mean and sd values for all predictors which can be used for ensuring same scaling with new unknown values.
Hanna Meyer
train Function in the caret package
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | #' # 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(system.file("extdata/msg",package="Rainfall"))
response <- raster(system.file("extdata/radar",
"201007121650_radolan_SGrid.rst",package="Rainfall"))
#get optimal variables from rfe model
data(rfeModel)
pred<-calculatePredictors(msg_example,model=rfeModel,date=date)
train4rainfall(pred,response,sampsize=0.1,out="Rain")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.