Learn R Programming

sptemExp (version 0.1.4)

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

Description

Average and standard deviation of multiple models by ensemble learning.

Usage

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

Examples

Run this code
# NOT RUN {
# 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")


# }

Run the code above in your browser using DataLab