# load zoo data
# column 1 is name, columns 2:17 are features, column 18 is class
data(zoo)
# feature matrix without intercept
x <- zoo[,2:17]
# class vector
y <- zoo[,18]
# run VDA
out <- vda.r(x,y)
# predict cases based on VDA
onecase <- matrix(c(0,0,1,0,0,1,1,0,0,0,0,0,6,0,0,0),nrow=1)
fivecases <- matrix(0,5,16)
fivecases[1,] <- c(1,0,0,1,0,0,0,1,1,1,0,0,4,0,1,0)
fivecases[2,] <- c(1,0,0,1,0,0,1,1,1,1,0,0,4,1,0,1)
fivecases[3,] <- c(0,1,1,0,1,0,0,0,1,1,0,0,2,1,1,0)
fivecases[4,] <- c(0,0,1,0,0,1,1,1,1,0,0,1,0,1,0,0)
fivecases[5,] <- c(0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0)
predict(out, fivecases)
Run the code above in your browser using DataLab