Questions tagged [svm]

Support vector machines (SVMs) are a set of related supervised learning methods that analyze data and recognize patterns, used for classification and regression analysis.

From Wikipedia:

Support vector machines (SVMs) are a set of related supervised learning methods that analyze data and recognize patterns, used for classification and regression analysis. The standard SVM takes a set of input data and predicts, for each given input, which of two possible classes the input is a member of, which makes the SVM a non-probabilistic binary linear classifier. Since an SVM is a classifier, then given a set of training examples, each marked as belonging to one of two categories, an SVM training algorithm builds a model that assigns new examples into one category or the other. Intuitively, an SVM model is a representation of the examples as points in space, mapped so that the examples of the separate categories are divided by a clear gap that is as wide as possible. New examples are then mapped into that same space and predicted to belong to a category based on which side of the gap they fall on.

4561 questions
16
votes
2 answers

I have much more than three elements in every class, but I get this error: "class cannot be less than k=3 in scikit-learn"

This is my target (y): target = [7,1,2,2,3,5,4, 1,3,1,4,4,6,6, 7,5,7,8,8,8,5, 3,3,6,2,7,7,1, 10,3,7,10,4,10, 2,2,2,7] I do not know why while I'm executing: ... # Split the data set in two equal parts X_train, X_test,…
postgres
  • 2,242
  • 5
  • 34
  • 50
15
votes
3 answers

Getting deprecation warning in Sklearn over 1d array, despite not having a 1D array

I am trying to use SKLearn to run an SVM model. I am just trying it out now with some sample data. Here is the data and the code: import numpy as np from sklearn import svm import random as random A = np.array([[random.randint(0, 20) for i in…
Katya Willard
  • 2,152
  • 4
  • 22
  • 43
15
votes
3 answers

Line search fails in training ksvm prob.model

Following up from Invalid probability model for large support vector machines using ksvm in R: I am training an SVM using ksvm from the kernlab package in R. I want to use the probability model, but during the sigmoid fitting I get the following…
roelandvanbeek
  • 659
  • 8
  • 20
15
votes
3 answers

libsvm java implementation

I am trying to use the java bindings for libsvm: http://www.csie.ntu.edu.tw/~cjlin/libsvm/ I have implemented a 'trivial' example which is easily linearly separable in y. The data is defined as: double[][] train = new double[1000][]; double[][]…
user1220022
  • 11,167
  • 19
  • 41
  • 57
14
votes
2 answers

Plotting data from an svm fit - hyperplane

I used svm to find a hyperplane best fit regression dependent on q, where I have 4 dimensions: x, y, z, q. fit <- svm(q ~ ., data=data,kernel='linear') and here is my fit object: Call: svm(formula = q ~ ., data = data, kernel =…
CodeGuy
  • 28,427
  • 76
  • 200
  • 317
14
votes
2 answers

Help--100% accuracy with LibSVM?

Nominally a good problem to have, but I'm pretty sure it is because something funny is going on... As context, I'm working on a problem in the facial expression/recognition space, so getting 100% accuracy seems incredibly implausible (not that it…
14
votes
1 answer

support vector machines - a simple explanation?

So, i'm trying to understand how the SVM algorithm works but i just cannot figure out how you transform some datasets in points of n-dimensional plane that would have a mathematical meaning in order to separate the points through a hyperplane and…
flowerpower
  • 883
  • 9
  • 19
14
votes
2 answers

Is there a way to perform grid search hyper-parameter optimization on One-Class SVM

Is there a way to use GridSearchCV or any other built-in sklearn function to find the best hyper-parameters for OneClassSVM classifier? What I currently do, is perform the search myself using train/test split like this: Gamma and nu values are…
14
votes
4 answers

CVXOPT QP Solver: TypeError: 'A' must be a 'd' matrix with 1000 columns

I'm trying to use the CVXOPT qp solver to compute the Lagrange Multipliers for a Support Vector Machine def svm(X, Y, c): m = len(X) P = matrix(np.dot(Y, Y.T) * np.dot(X, X.T)) q = matrix(np.ones(m) * -1) g1 =…
Utumbu
  • 432
  • 3
  • 7
  • 18
14
votes
2 answers

One-class classification with SVM in R

I'm using the package e1071 in R in order to build a one-class SVM model. I don't know how to do that and I neither find any example on the Internet. Could someone give an example code to characterize, for example, the class "setosa" in the "iris"…
dreamscollector
  • 175
  • 1
  • 1
  • 8
14
votes
2 answers

Nu is infeasible

I am using the NuSVC class in sklearn. After trying to instantiate an NuSVC object as follows: self.classifier = OneVsRestClassifier(NuSVC()) I found that I repeatedly get a 'specified nu is infeasible' error. I tried varying the 'nu' parameter…
MEric
  • 946
  • 3
  • 12
  • 30
14
votes
3 answers

text classification methods? SVM and decision tree

i have a training set and i want to use a classification method for classifying other documents according to my training set.my document types are news and categories are sports,politics,economic and so on. i understand naive bayes and KNN…
mshzmkot
  • 351
  • 2
  • 7
  • 22
14
votes
2 answers

Does SVM classification always produces unique solution?

Linear classifiers on separable can have more than one boundary for classifying the data. This is the reason we go for SVM to choose boundary which has maximum margin(minimum generalization error on unseen data). Does SVM classification always…
user1599171
14
votes
3 answers

How to test if a kernel is a valid kernel

If I define my own method of determining the similarity between two input entities of my Support Vector Machine classifier, and thus define it as my kernel, how do I verify if it is indeed a valid kernel that I can use? For example, if my inputs are…
London guy
  • 27,522
  • 44
  • 121
  • 179
13
votes
2 answers

Python OpenCV SVM implementation

So I have a matrix with my sample images (all turned into vectors) which was run trough PCA/LDA, and a vector which denotes the class each images belongs to. Now I want to use the OpenCV SVM class to train my SVM (I am using Python, OpenCV 2.3.1).…
Veles
  • 1,512
  • 4
  • 14
  • 28