Questions tagged [kernlab]

The kernlab package for R provides kernel-based machine learning methods for classification, regression and clustering.

The kernlab package for R provides kernel-based machine learning methods for classification, regression, clustering, novelty detection, quantile regression and dimensionality reduction. Among other methods kernlab includes Support Vector Machines, Spectral Clustering, Kernel PCA, Gaussian Processes and a QP solver.

Resources:

84 questions
2
votes
2 answers

KSVM (in r) giving - Error in indexes[[j]] : subscript out of bounds

I have been running into this error every time I try to implement ksvm. My code: Train11<- read.csv('Train.csv', head=TRUE) Train11 <- (sapply(Train11, as.numeric)) #convert all data to numeric Train11 <-…
2
votes
1 answer

cross-validate predictions for caret and svm

There seem to be differences between the ROC/Sens/Spec that is produced when tuning the model, to the actual predictions made by the model on the same dataset. I'm using caret which uses kernlab's ksvm. I'm not experiencing this problem with…
Ozeuss
  • 229
  • 1
  • 6
2
votes
0 answers

How to calculate AIC for a SVM model built using "ksvm" in "kernlab" package?

I built a SVM using "ksvm" from "kernlab" package. Here is my code:…
ZigZagZebra
  • 1,349
  • 3
  • 14
  • 25
2
votes
0 answers

User-defined kernels in kernlab library

Lately I've worked with kernlab library in R-statistical software. In specific, I use the ksvm function to identify patterns. I'm trying to implement a new kernel in SVM, my code is:
2
votes
2 answers

Applying function to cartesian product of two unequal vectors

I am trying to avoid looping by using an documented apply function, but have not been able to find any examples to suit my purpose. I have two vectors, x which is (1 x p) and y which is (1 x q) and would like to feed the Cartesian product of their…
mlegge
  • 6,763
  • 3
  • 40
  • 67
2
votes
2 answers

Error plotting SVM classification results for the spam dataset

I am having problem with plotting results of SVM classification for the spam dataset from kernlab package.. Code: require(kernlab) data(spam) index <- sample(1:dim(spam)[1]) spamtrain <- spam[index[1:floor(dim(spam)[1]/2)], ] spamtest <-…
2
votes
1 answer

parameter C. epsilon as vector in kernlab's ksvm in R

I am trying to use ksvm function of kernlab package in R for epsilon-SVM regression. I want to put parameters C(regularization constant) and epsilon (insensitivity) as vectors(length of vector = training data length). But I am not able to figure out…
manofsins
  • 1,583
  • 2
  • 10
  • 12
2
votes
1 answer

R ksvm support vectors

I am trying to extract weights for R's ksvm package. Usually I use the e1071 package and the weights can be computed by weights = t(svmmodel$coefs) %*% svmmodel$SV However, when I look into the ksvm package, both the coefficients and alphas…
Florie
  • 251
  • 3
  • 9
1
vote
1 answer

Error in if (sum(abs(dc)) < 1e-15) break : missing value where TRUE/FALSE needed: Kernel K-Means kernlab

I am trying to implement Kernel K Means clustering with the kkmeans() function from the kernlab R package. My problem is that my code returns the expected output when I specify some numbers of clusters with the function's clusters argument, but…
myfatson
  • 354
  • 2
  • 14
1
vote
0 answers

Is it true that parameter C cannot be optimized for 'nu-svr' or is it an error?

I am trying to optimize an SVR model within the mlr3 ecosystem with the kernlab package and I am getting the following error: The parameter 'C' can only be set if the following condition is met 'type {eps-svr, eps-bsvr}'. Instead the…
1
vote
0 answers

How to do Parallel Computing in R with Workflow and Caret packages

I know that I can do parallel computing in R however I am having trouble setting it up in a way that it works with my modeling approach. Here is how I set load / set up the parallel computing library(doParallel) # Parallel Computing cores <-…
1
vote
0 answers

Get probabilities with kernlab in R - ksvm with precomputed kernel matrix and C classification

I'm trying to get probabilities for each observation in my test dataset test_k. I'm using a precomputed kernel matrix and C classification. "C-svc" should allow me to get a probability model. However, I get the following error code: Error: $…
p.bdns
  • 11
  • 1
1
vote
1 answer

How to extract the Prediction Intervals of a Gaussian Process Regression via caret kernlab package?

I am trying to use a Gaussian Process Regression (GPR) model to predict hourly streamflow discharges in a river. I've got good results applying the caret::kernlab train () function (thanks Kuhn!). Since the uncertainty idea is one of the main…
1
vote
1 answer

comparing performance of all ksvm kernels at once

I'm new to R, so maybe this is a dumb question, but I'm looking for a way to iterate over all possible kernel options in the ksvm function in kernlab and spit out a table of the results. Right now I have a basic set up: # call ksvm model <- …
LMGagne
  • 1,636
  • 6
  • 24
  • 47
1
vote
1 answer

Unusual support vector using kernlab

The following code should create a support vector classifier (SVM with linear kernel) using the ksvm function from the kernlab package: library(kernlab) set.seed(1) x <- rbind(matrix(rnorm(10 * 2, mean = 0), ncol = 2), matrix(rnorm(10 *…
Sean Raleigh
  • 579
  • 4
  • 10