svm

Is linear kernel positive definite?

点点圈 提交于 2019-12-11 10:46:29
问题 In a lot of articles, the linear kernel (inner product of two matrices) is listed as positive definite however when I try it with a toy dataset, positive definiteness test returns negative result. I checked the MATLAB SVM function for linear kernel. The linear kernel function is one line command, K=(u*v') However after this step in the main svm_train function it does another operation using K, kx= (kx+kx')/2 + diag(1./boxconstraint) Where kx is K and diag(1./boxconstraint) is just a diagonal

Model does not support probabiliy estimates in libsvm

旧巷老猫 提交于 2019-12-11 08:23:26
问题 I used libsvm in Matlab with the option '-b 1' in both training and prediction process. But it always returns Model does not support probabiliy estimates , so I don't get any probability or accuracy estimation. I tried in binary class SVM (not nu-svm!), it should have work with the '-b 1' but it's not. Does anyone know what's the reason for this problem? Thanks 回答1: Let me show you the usage of svm-predict : Usage: svm-predict [options] test_file model_file output_file options: -b probability

How to optimize SciKit one-class training time?

廉价感情. 提交于 2019-12-11 07:02:53
问题 Essentially my questions is the same as SciKit One-class SVM classifier training time increases exponentially with size of training data, but no one has figured out the problem. It seems to run fine for somewhere in the 10s of thousands, but 100s of thousands take very long. And I want to run it on 10s of millions, but I don't want to wait a day and a half (maybe even more) for nothing to come of it. Is there a faster way about it, or should I use something else? 回答1: I'm very junior in this

Setting an array element with a sequence error while training SVM to classify images

狂风中的少年 提交于 2019-12-11 05:58:24
问题 I'm trying to do image classification using SVM in python with 1022 images and 1022 multi-class labels (each label has 14 classes). mypath = 'path' k = listdir(mypath) images = np.empty((len(k)-1), dtype=object) resized_imgs = np.empty((len(k)-1),dtype=object) for n in range(0, len(k)-1): images[n] = cv2.imread(join(mypath,k[n]),0) #Reading images in grayscale resized_imgs[n] = cv2.resize(images[n],(32,32)) #Resizing images for i in range(0,len(k)-1): a=resized_imgs[i].mean() b=resized_imgs[i

R returns factor(0) when predicting with a SVM model

那年仲夏 提交于 2019-12-11 05:42:56
问题 My question is quite the same with this thread, however, since that seems not to have an satisfying answer yet, I think it is still appropriate to ask again along with reproducible codes. training <- read.csv("https://d396qusza40orc.cloudfront.net/predmachlearn/pml-training.csv")[,-1] testing <- read.csv("https://d396qusza40orc.cloudfront.net/predmachlearn/pml-testing.csv")[,-1] # Importing data library(e1071) # Load the required package for SVM svm_model <- svm(classe ~ pitch_arm + pitch

SVM is very slow when training classifier on big number of classes

亡梦爱人 提交于 2019-12-11 05:31:29
问题 I'm trying to train an SVM classifier on big number of items and classes, which becomes really, really slow. First of all, I've extracted a feature set from my data, to be specific 512 features overall and put it in numpy array. There are 13k items in this array. It looks like that: >>print(type(X_train)) <class 'numpy.ndarray'> >>print(X_train) [[ 0.01988654 -0.02607637 0.04691431 ... 0.11521499 0.03433102 0.01791015] [-0.00058317 0.05720023 0.03854145 ... 0.07057668 0.09192026 0.01479562] [

ValueError: X.shape[1] = 128 should be equal to 512, the number of features at training time

橙三吉。 提交于 2019-12-11 04:50:59
问题 Currently i am working on facial recognition and i am having the following issue with the given code. for i in range(nrof_faces): emb_array = np.zeros((1, embedding_size)) bb[i][0] = det[i][0] bb[i][1] = det[i][1] bb[i][2] = det[i][2] bb[i][3] = det[i][3] # inner exception if bb[i][0] <= 0 or bb[i][1] <= 0 or bb[i][2] >= len(frame[0]) or bb[i] [3] >= len(frame): print('Face is very close!') continue cropped.append(frame[bb[i][1]:bb[i][3], bb[i][0]:bb[i][2], :]) cropped[i] = facenet.flip

ROC curve and libsvm

流过昼夜 提交于 2019-12-11 04:30:17
问题 Given a ROC curve drawn with plotroc.m (see here): Theoretical question: How to select the best threshold to be used? Programming qeuestion: How to induce the libsvm classifier to work with the selected (best) threshold? 回答1: ROC curve is plot generated by plotting fraction of true positive on y-axis versus fraction of false positive on x-axis. So, co-ordinates of any point (x,y) on ROC curve indicates FPR and TPR value at particular threshold. As shown in figure, we find the point (x,y) on

HOG detector: relation between detected roi size and training sample size

自闭症网瘾萝莉.ら 提交于 2019-12-11 02:55:31
问题 I'm experimenting people detector with opencv and HOGDescriptor c++ object: HOGDescriptor::getDefaultPeopleDetector() . Using the sample program peopledetect.cpp in the sample/cpp directory of the Opencv 2.4.3 repository and testing it against some of the INRIA dataset images.. it works quite well. Now I want to try with some images I have to work with and, even if I try to change parameters.. it doesn't find anything. I suppose it is because of the pedestrian in the image I have are much

Do I need to calculate hist at prediction time in SVM?

最后都变了- 提交于 2019-12-11 02:04:03
问题 I am training my dataset with the below code: for file in glob.glob('C:\*.png'): image = cv2.imread(file, 1) image = cv2.resize(img, (60, 120)) hog = cv2.HOGDescriptor((60,120), (8,8), (4,4), (4,4), 9) hist = hog.compute(image) samples.append(hist) labels.append(-1) I am using hist = hog.compute(image) . This code is in the training part, but when I do the prediction part: hog = cv2.HOGDescriptor((60,120), (8,8), (4,4), (4,4), 9) svm = cv2.ml.SVM_load('svm_data.xml') sv = svm