Learn R Programming

lasvmR (version 0.1.2)

lasvmTrain: lasvmTrain

Description

Use lasvm to train a given problem.

Usage

lasvmTrain(x, y, gamma = 1, cost = 1, degree = 3, coef0 = 0, optimizer = 1, kernel = 2, selection = 0, termination = 0, sample = 1e+08, cachesize = 256, bias = 1, epochs = 1, epsilon = 0.001, verbose = FALSE)

Arguments

x
data matrix
y
labels
gamma
RBF kernel parameter
cost
regularization parameter
degree
degree for poly kernel
coef0
coefficient for poly kernel
optimizer
type of optimizer
kernel
kernel type
selection
selection strategy
termination
criterion for stopping
sample
time for stopping/number of iterations tec
cachesize
size of kernel cache
bias
use bias?
epochs
number of epochs
epsilon
stopping criterion parameter
verbose
verbose output?

Value

a list consisting of alpha alpha for SVs as vector SV support vectors as matrix

Examples

Run this code
model = lasvmR::lasvmTrain (x = as.matrix(iris[seq(1,150,2),1:4]),
	y = (as.numeric(iris[seq(1,150,2),5]) %% 2)*2-1,
	gamma = 1,
	cost = 1,
	kernel = 2)
ytrue = (as.numeric(iris[seq(2,150,2),5]) %% 2)*2-1
result = lasvmPredict (x = as.matrix(iris[seq(2,150,2),1:4]), model)
ypred = result$predictions
error = sum(abs(ypred - ytrue))/length(ytrue)
cat ("Error rate =", error*100)

Run the code above in your browser using DataLab