Description Usage Arguments Author(s) Examples
Returns an R dataframe
containing the character vector
c("foo", "bar")
c(0, 1)
.
1 | weightedstat(path,modelpath,metric,preStr, idStr,dateStr)
|
path |
path of the prediction dataset files. |
modelpath |
model metric file |
metric |
performance weight |
preStr |
prediction value's name |
idStr |
id name |
dateStr |
date name |
Lianfa Li lspatial@gmail.com
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | # Simulared data
dPath=tempdir()
pPath=paste(dPath,"/preds",sep="")
unlink(pPath, recursive=TRUE, force=TRUE)
dir.create(pPath)
nr=2000;nmod=80
for(i in c(1:nmod)){ # i =1
dset=data.frame(gid=c(1:nr),rid=sample(c(1:30),size=nr,replace=TRUE),stringsAsFactors = FALSE)
dset$pre=dset$gid%%nmod+rnorm(nr,mean=5,sd=9)+runif(nr,0,1)
dset$gid=paste("c",dset$gid,sep="")
afile=paste(pPath,"/m",i,".csv",sep="")
write.csv(dset,file=afile,row.names = FALSE)
}
modelsMetrics=data.frame(mid=c(1:nmod),r2=runif(nmod,0.6,0.9),rmse=runif(nmod,20,60))
modelsMetrics$rmse2=1/modelsMetrics$rmse
mfile=paste(dPath,"/model_metrics.csv",sep="")
write.csv(modelsMetrics,file=mfile,row.names = FALSE)
res=weightedstat(pPath,modelpath=mfile,metric="rmse2",preStr="pre",idStr="gid",dateStr="gid")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.