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
4
votes
1 answer

Equation of rbfKernel in kernlab is different from the standard?

I have observed that kernlab uses rbfkernel as, rbf(x,y) = exp(-sigma * euclideanNorm(x-y)^2) but according to this wiki link, the rbf kernel should be of the form rbf(x,y) = exp(-euclideanNorm(x-y)^2/(2*sigma^2)) which is also more intuitive…
jMathew
  • 1,057
  • 8
  • 13
4
votes
0 answers

R - "ksvm object contains no probability model" error for one class svm?

I am trying to detect outliers and output as probabilities using one class svm in R kernlab package. The import data and model building process all seems fine, but when I tried to predict the model by specifying type="probabilities" it gives me the…
4
votes
1 answer

creating a 2D plot in R with KSVM (kernlab) with 3 or more class variables

I am trying to create a 2D plot using SVM in library(kernlab), but it appears the plot function is only appropriate for binary classification. I would like to be able to plot 3 (or more) groups, as in the example below. My data is structured just…
4
votes
0 answers

How to overcome "Error in .local(object, ...) : test vector does not match model !"?

I removed 100 records from the original data set, then rebuilt a SVM model using the following coding. uk<-read.csv("Riskx.csv", header=TRUE, sep=",") attach(uk) library(e1071) library(kernlab) index<-1:nrow(uk) testindex<-sample(index,…
Spidey
  • 41
  • 2
4
votes
1 answer

How can I perform novelty detection with ksvm in R?

I am trying to implement a novelty detector using the kernlab library (ksvm function) in R. Here is a simple example of what I am trying to do: # Training data xxTrain <- matrix(rnorm(2000), nrow=1000, ncol=2, byrow=TRUE) y <- rep(1,1000) classifier…
siva82kb
  • 1,910
  • 4
  • 19
  • 28
3
votes
1 answer

Issue with R-Kernlab SVM Predict

I have been trying to build SVM classifier but having trouble with predict. > modelrbf<-ksvm(set,y,kernel="rbfdot",type="C-svc") Using automatic sigma estimation (sigest) for RBF or laplace kernel > predict(modelrbf,set[24,]) Error in…
jitendra
  • 1,438
  • 2
  • 19
  • 40
3
votes
1 answer

Plot SVM linear model trained by caret package in R

Purpose I was trying to visualize SVMLinear classification model via plot. I am using the example code and data provided in kernlab package having noticed caret actually train svm via ksvm function (referring to src code here…
Puriney
  • 2,417
  • 3
  • 20
  • 25
3
votes
1 answer

Looking into the predict function in R

I am trying to understand how the SVM predict function works when using command ksvm from R package kernlab. I tried the look into the predict function using the following commands: methods(class="ksvm") getAnywhere(ksvm:::predict) However, I get…
Ravi
  • 3,223
  • 7
  • 37
  • 49
3
votes
1 answer

What does this error mean while running the ksvm of kernlab package in R

I am calling the ksvm method of the kernlab package in R using the following syntax svmFit = ksvm(x=solTrainXtrans, y=solTrainYSVM, kernel="stringdot", kpar="automatic", C=1, epsilon=0.1) The x parameter is a data.frame with feature values and the…
London guy
  • 27,522
  • 44
  • 121
  • 179
3
votes
1 answer

Access the estimated var in kernlab::gausspr function in R

I am looking at the R function gausspr from the kernlab package for Gaussian process regression. The process is defined by the hyperparameters of the kernel function and by the noise in the data. I see in the documentation that I can specify…
cboettig
  • 12,377
  • 13
  • 70
  • 113
2
votes
1 answer

kernlab regression

Anyone encountered this difficulty with kernlab regression? It seems like it's losing some scaling factors or something, but perhaps I'm calling it wrong. library(kernlab) df <- data.frame(x=seq(0,10,length.out=1000)) df$y <- 3*df$x + runif(1000) -…
Ken Williams
  • 22,756
  • 10
  • 85
  • 147
2
votes
1 answer

Predict function for ksvm is not found?

I'm trying to use the function predict.ksvm from library kernlab in R. I have been reading the documentation at the following link: https://www.rdocumentation.org/packages/kernlab/versions/0.9-27/topics/predict.ksvm The function ksvm is working, so…
Jesper.Lindberg
  • 313
  • 1
  • 5
  • 14
2
votes
1 answer

Iterating through multiple C values in R's ksvm

Is there an easy way to iterate through multiple C values and display the top 5 results? I have ksvm set up like this: # call ksvm model <- ksvm(as.matrix(data[,1:10]),as.factor(data[,11]),type="C-svc",kernel="vanilladot",C=100, scaled=TRUE) #…
LMGagne
  • 1,636
  • 6
  • 24
  • 47
2
votes
0 answers

SVM with radial kernel for numeric response in caret package

I applied the SVM algorithm with a Radial kernel to a regression problem using the following packages: caret (train function with SVMRadial method), e1071 (svm function) and kernlab (ksvm function). For functions on caret and kernlab, I fixed the…
2
votes
0 answers

Plot string kernel svm/decision boundary using kernlab

I am using kernlab to learn the basics of kernel SVMs, and am running into some difficulty plotting the results for the model applied to the reuters dataset. Jean-Philippe Vert has written an excellent tutorial which I am following…
sqlck
  • 87
  • 1
  • 7