svm_radial: Support Vector Machines with Radial Kernel

Description Usage Arguments Value Examples

Description

It is the Support Vector Machines with a radial kernel

Usage

1
svm_radial(X_train, Y_train, X_test, gamma, C)

Arguments

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.

gamma

A numeric value as the kernel coefficient.

C

A numeric value that represents the cost of constraints violation of the regularization term in the Lagrange formulation.

Value

predicted labels

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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
gamma <- 0.5
Y_predicted <- svm_radial(X_train = X_train, Y_train = Y_train, X_test = X_test, C = C, gamma = gamma)
print(table(Y_test, Y_predicted))

PauloCirino/MLAT documentation built on May 13, 2019, 1:22 p.m.