svm_poli: Support Vector Machines with Polinomial Kernel

Description Usage Arguments Value Examples

Description

It is the Support Vector Machines with a polinomial kernel

Usage

1
svm_poli(X_train, Y_train, X_test, degree, gamma, coef0, 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.

degree

A integer that represents the kernel polynomial degree

gamma

A numeric value as the kernel coefficient.

coef0

A numeric value for kernel independent term.

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
11
12
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
coef0 <- 0
degree <- 5
gamma <- 0.5
Y_predicted <- svm_poli(X_train = X_train, Y_train = Y_train, X_test = X_test, C = C, coef0 = coef0, degree = degree, gamma = gamma)
print(table(Y_test, Y_predicted))

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