train4rainfall: Performs model training

Description Usage Arguments Value Author(s) References See Also Examples

Description

Performs model training

Usage

1
2
3
4
5
train4rainfall(predictors, response, out = "Rain", scaleVars = FALSE,
  sampsize = 0.25, threshold = 0.06, method = "nnet",
  tuneGrid = list(.size = 2:5, .decay = c(0.05, 0.07)),
  thresholdTune = c(seq(0, 0.1, 0.05), seq(0.12, 0.3, 0.02), seq(0.35, 1,
  0.05)), seed = 20, ...)

Arguments

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

Value

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.

Author(s)

Hanna Meyer

References

train Function in the caret package

See Also

train

Examples

 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")

environmentalinformatics-marburg/Rainfall documentation built on May 16, 2019, 7:49 a.m.