Description Usage Arguments Value Examples
Use lasvm to train a given problem.
1 2 3 4 | 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)
|
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? |
a list consisting of alpha alpha for SVs as vector SV support vectors as matrix
1 2 3 4 5 6 7 8 9 10 | 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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.