Description Usage Arguments Details Author(s) References Examples
space extension for training data
1 | extspace_dat(xdata)
|
xdata |
space extension for training data |
space extension for training data
Hong Wang
Random Survival Forest with Space Extensions for Censored Data, submitted to Artificial Intelligence in Medicine
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
function (xdata)
{
xdata = model.matrix(~0 + ., as.data.frame(xdata))
p = ncol(xdata)
d = p
ncomb <- combn(p, 2)
ncombsub <- ncomb[, sample(choose(p, 2), d)]
newx <- vector(mode = "list", length = d)
newx <- NULL
new_names <- paste("newvar", 1:d, sep = "_")
for (i in 1:p) {
newx = cbind(newx, xdata[, ncombsub[2, i]] - xdata[,
ncombsub[1, i]])
}
colnames(newx) <- new_names
newxdata = cbind(xdata, newx)
return(list(newxdata = newxdata, ncombsub = ncombsub))
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.