svm

selecting c and gamma value

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-09 06:04:46
问题 Hi I am performing SVM classification using SMO, in which my kernel is RBF, now I want to select c and sigma values, using grid search and cross validation, I am new to kernel functions, please help, in step by step process 回答1: Pick some values for C and sigma that you think are interesting. E.g., C = {1, 10, 100, 1000} and sigma = {.01, .1, 1} (I'm just making these up). Divide the training set into k (e.g. 10) parts, preferably in a stratified way. Loop over all pairs of C and sigma values

Why Gaussian radial basis function maps the examples into an infinite-dimensional space?

瘦欲@ 提交于 2019-12-09 05:04:22
问题 I've just run through the Wikipedia page about SVMs, and this line caught my eyes: "If the kernel used is a Gaussian radial basis function, the corresponding feature space is a Hilbert space of infinite dimensions." http://en.wikipedia.org/wiki/Support_vector_machine#Nonlinear_classification In my understanding, if I apply Gaussian kernel in SVM, the resulting feature space will be m -dimensional (where m is the number of training samples), as you choose your landmarks to be your training

Train SVM and save it with OpenCV 3.0

谁都会走 提交于 2019-12-09 03:23:45
问题 I am using Visual Studio 2010, with OpenCV 3.0. I'm trying to train a SVM and to save it into a file, but I am having problems. My purpose is to extract the HOG features of some images and train a SVM with them. All seems to be right, but when I try to save the model in a xml file I obtain the following error: Unhandled exception in 0x000007fefd9bb16d (KernelBase.dll) in TrainSVM.exe: Exception de MICROSOFT C++: cv::Exception at memory location 0x0026e1b0. And then this is showed in console:

SVM with dynamic time warping kernel return error rate greater than 0

此生再无相见时 提交于 2019-12-09 02:16:27
I'm using Accord.net in my research. I have a vector sequences of variable size as input so I use DynamicTimeWarping as a kernel for MulticlassSupportVectorMachine. IKernel kernel = new DynamicTimeWarping(dimension); var machine = new MulticlassSupportVectorMachine(0, kernel, 2); // Create the Multi-class learning algorithm for the machine var teacher = new MulticlassSupportVectorLearning(machine, inputs.ToArray(), outputs.ToArray()); // Configure the learning algorithm to use SMO to train the // underlying SVMs in each of the binary class subproblems. teacher.Algorithm = (svm, classInputs,

How to reproduce predict.svm in R? [closed]

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-09 01:02:10
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 9 months ago . I want to train an SVM classifier in R and be able to use it in other software by exporting the relevant parameters. To do so, I first want to be able to reproduce the behavior of predict.svm() in R (using the e1071 package). I trained the model based on the iris data. data(iris) # simplify the data by removing

Build a custom svm kernel matrix with opencv

痴心易碎 提交于 2019-12-08 23:45:26
问题 I have to train a Support Vector Machine model and I'd like to use a custom kernel matrix, instead of the preset ones (like RBF, Poly, ecc.). How can I do that (if is it possible) with opencv's machine learning library? Thank you! 回答1: AFAICT, custom kernels for SVM aren't supported directly in OpenCV. It looks like LIBSVM, which is the underlying library that OpenCV uses for this, doesn't provide a particularly easy means of defining custom kernels. So, many of the wrappers that use LIBSVM

Scikit - 3D feature array for SVM

人盡茶涼 提交于 2019-12-08 20:55:30
I am trying to train an SVM in scikit. I am following the example and tried to adjust it to my 3d feature vectors. I tried the example from the page http://scikit-learn.org/stable/modules/svm.html and it ran through. While bugfixing I came back to the tutorial setup and found this: X = [[0, 0], [1, 1],[2,2]] y = [0, 1,1] clf = svm.SVC() clf.fit(X, y) works while X = [[0, 0,0], [1, 1,1],[2,2,2]] y = [0, 1,1] clf = svm.SVC() clf.fit(X, y) fails with: ValueError: X.shape[1] = 2 should be equal to 3, the number of features at training time what is wrong here? It's only one additional dimension...

Support Vector Machine on R and WEKA

回眸只為那壹抹淺笑 提交于 2019-12-08 17:35:30
My data generated strange results with svm on R from the e1071 package, so I tried to check if the R svm can generate same result as WEKA (or python), since I've been using WEKA in the past. I googled the question and found one that has the exact same confusion with me but without an answer. This is the question . So I hope that I could get an answer here. To make things easier, I'm also using the iris data set, and train a model (SMO in WEKA, and svm from R package e1071) using the whole iris data, and test on itself. WEKA parameters : weka.classifiers.functions.SMO -C 1.0 -L 0.001 -P 1.0E-12

SKLearn: Getting distance of each point from decision boundary?

本小妞迷上赌 提交于 2019-12-08 14:24:31
I am using SKLearn to run SVC on my data. from sklearn import svm svc = svm.SVC(kernel='linear', C=C).fit(X, y) I want to know how I can get the distance of each data point in X from the decision boundary? For linear kernel, the decision boundary is y = w * x + b, the distance from point x to the decision boundary is y/||w||. y = svc.decision_function(x) w_norm = np.linalg.norm(svc.coef_) dist = y / w_norm For non-linear kernels, there is no way to get the absolute distance. But you can still use the result of decision_funcion as relative distance. It happens to be that I am doing the homework

Error in testing SVM classifier for text classification

*爱你&永不变心* 提交于 2019-12-08 11:56:16
问题 I have gone throught the sklearn documentation, and written code for training SVM classifier as well as testing it. However, at the end step, I am getting an error that I cant comprehend. My code is as below: rb = open_workbook('subjectcat.xlsx')#C:/Users/5460/Desktop/ wb = copy(rb) #making a copy sheet = rb.sheet_by_index(0) #only subjects extracted from excel file train_set = () #list for row_index in range(1,500): #train using 500 subject = 0 for col_index in range(1,2): if col_index==1: