# NOT RUN {
# The example shows a binary classification problem, characterized by two Gaussian classes,
# in order to demonstrate how to use the classification functions.
nc = 100
xc1 <- matrix(0.3 * rnorm(nc) + 2.5, ncol = 2)
xc2 <- matrix(0.3 * rnorm(nc) + 3.5, ncol = 2)
xc1 <- cbind(xc1, rep(0, times = nc/2))
xc2 <- cbind(xc2, rep(1, times = nc/2))
X <- rbind(xc1, xc2)
suffled_indexes <- sample(nc)
train_size = nc * 0.7
X_train <- X[suffled_indexes[1:train_size], cbind(1,2)]
y_train <- X[suffled_indexes[1:train_size], 3]
X_test <- X[suffled_indexes[(71:100)], cbind(1,2)]
y_test <- X[suffled_indexes[(71:100)], 3]
mdl <- model(X_train, y_train)
prd <- predict(mdl, X_test)
# }
Run the code above in your browser using DataLab