Description Usage Arguments Value Examples
It is the Support Vector Machines without a kernel
1 | svm_linear(X_train, Y_train, X_test, C)
|
X_train |
A Matrix of trainning observations. |
Y_train |
A numeric vector of classes or values of the trainning observations. |
X_test |
A Matrix of testing observations. |
C |
A numeric value that represents the cost of constraints violation of the regularization term in the Lagrange formulation. |
predicted labels
1 2 3 4 5 6 7 8 9 | X <- as.matrix(cbind(runif(n = 100), runif(n = 100)))
pos <- sample(100, 70)
X_train <- X[pos, ]
X_test <- X[-pos, ]
Y_train <- as.numeric( X_train[, 1] ** 2 - X_train[, 2] > 0)
Y_test <- as.numeric(X_test[, 1] ** 2 - X_test[, 2] > 0)
C <- 5
Y_predicted <- svm_linear(X_train = X_train, Y_train = Y_train, X_test = X_test, C = C)
print(table(Y_test, Y_predicted))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.