Learn R Programming

lasvmR (version 0.1.2)

lasvmPredict: lasvmPredict

Description

Use lasvm to train a given problem.

Usage

lasvmPredict(x, model, verbose = FALSE)

Arguments

x
data matrix
model
trained model
verbose
verbose output?

Value

a list consisting of predictions the predicted labels

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