noweiAvg: Averages over the Ensemble Predictions of Mixed Models (No...

Description Usage Arguments Value Author(s) Examples

View source: R/RcppExports.R

Description

Average and standard deviation of multiple models by ensemble learning.

Usage

1
noweiAvg(path, preStr = "preno2", idStr = "id", dateStr = "s_date")

Arguments

path

Path for the prediction files from multiple models with the unified format and field names. File format: CSV with head:(gid,rid,pre)

preStr

prediction field names

idStr

unique identifier string

dateStr

date string. You can set it as the same as idStr

Value

id and corresponding mean and standard deviation. Format: dataframe

Author(s)

Lianfa Li: lspatial@gmail.com

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
# Generate the prediction dataset, but you can use parATimePredict function
# to make the prediction in application

dPath=tempdir()
pPath=paste(dPath,"/preds",sep="")
unlink(pPath, recursive=TRUE, force=TRUE)
dir.create(pPath)

nr=2000
for(i in c(1:80)){ # i =1
  dset=data.frame(gid=c(1:nr),rid=sample(c(1:30),size=nr,replace=TRUE))
  dset$pre=dset$gid%%80+rnorm(nr,mean=5,sd=9)+runif(nr,0,1)
  afile=paste(pPath,"/m_",i,".csv",sep="")
  write.csv(dset,file=afile,row.names = FALSE)
}
result=noweiAvg(pPath, preStr="pre",idStr="gid",dateStr="gid")

lspatial/sptemUS documentation built on May 29, 2019, 3:42 a.m.