Skip to content

Instantly share code, notes, and snippets.

@alfard
Created April 10, 2013 16:01
Show Gist options
  • Select an option

  • Save alfard/5355960 to your computer and use it in GitHub Desktop.

Select an option

Save alfard/5355960 to your computer and use it in GitHub Desktop.
R test matrix
i=0
#mymat <- matrix(data=NA,nrow=1000000,ncol=6)
Score1 <- matrix(data=NA,nrow=156849,ncol=1)
Score2 <- matrix(data=NA,nrow=156849,ncol=1)
tic=proc.time()[3]
for (i in seq(1,nrow(e4),1))
{
#*************************************************************************************************
ensemblefit <- data.frame(expm1((predictionslm*e4[i,1]+predictionsgbm*e4[i,2]+predictionsnn*e4[i,3]+prevY2*e4[i,4])/100))
#ensemblefit[ensemblefit<0] = 0
names(ensemblefit) <- c("ensemblefit")
Days <- Y2withy1$DaysInHospital
ensemblefit<-cbind(ensemblefit,Days)
names(ensemblefit) <- c("ensemblefit","days")
Score1[i,]<-sqrt((sum((log(ensemblefit$ensemblefit+1)-log(ensemblefit$days+1))^2))*(1/nrow(ensemblefit)))
#*************************************************************************************************
ensemblefit <- data.frame(expm1((predictionslmX*e4[i,1]+predictionsgbmX*e4[i,2]+predictionsnnX*e4[i,3]+prevY3*e4[i,4])/100))
#ensemblefit[ensemblefit<0] = 0
names(ensemblefit) <- c("ensemblefit")
Days <- Y3withy2$DaysInHospital
ensemblefit<-cbind(ensemblefit,Days)
names(ensemblefit) <- c("ensemblefit","days")
Score2[i,]<-sqrt((sum((log(ensemblefit$ensemblefit+1)-log(ensemblefit$days+1))^2))*(1/nrow(ensemblefit)))
#*************************************************************************************************
#mymat[i,] <- c(e4[i,1],e4[i,2],e4[i,3],e4[i,4],Score1,Score2)
print(i)
}
toc=proc.time()[3] - tic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment