svm

How to do feature selection using linear SVM weights [closed]

柔情痞子 提交于 2019-12-10 14:03:42
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed last year . I have built a SVM linear model for two types of classes (1 and 0), using the following code: class1.svm.model <- svm(Class ~ ., data = training,cost=1,cross=10, metric="ROC",type="C-classification",kernel="linear",na.action=na.omit,probability = TRUE) and I have extracted the

Nu is infeasible

情到浓时终转凉″ 提交于 2019-12-10 14:00:18
问题 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 from 0.1 all the way to 1. (in 0.1 increments), but I keep getting the same error. I am really unsure how to interpret this message, and how to go about resolving it? I figured that if I set the nu to 1., it would work because nu represents an upper

Calculating Nearest Match to Mean/Stddev Pair With LibSVM

南笙酒味 提交于 2019-12-10 13:59:31
问题 I'm new to SVMs, and I'm trying to use the Python interface to libsvm to classify a sample containing a mean and stddev. However, I'm getting nonsensical results. Is this task inappropriate for SVMs or is there an error in my use of libsvm? Below is the simple Python script I'm using to test: #!/usr/bin/env python # Simple classifier test. # Adapted from the svm_test.py file included in the standard libsvm distribution. from collections import defaultdict from svm import * # Define our sparse

SVM for Image feature classification using OpenCv

不羁的心 提交于 2019-12-10 11:58:44
问题 my project scope is currency note identification by comparing the sample images feature set.There, i have completed the feature extraction part of the sample images. Further i need to store the sample images features in the text file or XML file and the classification of them. please help me to do the image classification part by using SVM classifier on the OpenCv this is the feature extraction code that i have completed. int main( intargc, char** argv ) { / Loading the image as gray scale /

Regression confidence using SVMs in python

旧城冷巷雨未停 提交于 2019-12-10 11:43:19
问题 I'm using regression SVMs in python and I am wondering if there is any way to get a "confidence-measure" value for its predictions. Previously, when using SVMs for binary classification, I was able to compute a confidence-type value from the 'margin'. Here is some pseudo-code showing how I got a confidence value: # Begin pseudo-code import svm as svmlib prob = svmlib.svm_problem(labels, data) param = svmlib.svm_parameter(svm_type=svmlib.C_SVC, kernel_type = svmlib.RBF) model = svmlib.svm

OpenCV SVM Gives Strange Prediction Results

我怕爱的太早我们不能终老 提交于 2019-12-10 10:27:46
问题 I am quite new to both OpenCV and Support Vector Machines. I want to use SVM to train a dataset with two labels and then predict the label of a given set. My current set contains about 600 rows with equal class distributions (300 for 1 and 300 for -1) containing 34 columns. This is my current code for setting up OpenCV's SVM. I am using OpenCV 3.0.0 // trainingData is an int array with size 600x34 // labels is an int array with size 600, they're the labels corresponding to the trainingData

How can I save a LibSVM python object instance?

China☆狼群 提交于 2019-12-10 09:49:50
问题 I wanted to use this classifier in other computer without had to train it again. I used to save some classifiers from scikit with cPickle. Doing the same with LIBSVM it gives me a " ValueError: ctypes objects containing pointers cannot be pickled ". I'm using LibSVM 3.1 and Python 2.7.3. Thanks from libsvm.svm import * from libsvm.svmutil import * import cPickle x = [[1, 0, 1], [-1, 0, -1]] y = [1, -1] prob = svm_problem(y, x) param = svm_parameter() param.kernel_type = LINEAR param.C = 10 m

Why does classifier.predict() method expects the number of features in the test data to be the same as in training data?

旧时模样 提交于 2019-12-10 08:04:22
问题 I am trying to build a simple SVM document classifier using scikit-learn and I am using the following code : import os import numpy as np import scipy.sparse as sp from sklearn.metrics import accuracy_score from sklearn import svm from sklearn.metrics import classification_report from sklearn.feature_extraction.text import CountVectorizer from sklearn.feature_extraction.text import TfidfTransformer from sklearn.feature_extraction.text import TfidfVectorizer from sklearn import cross

How to import a trained SVM detector in OpenCV 2.4.13

≡放荡痞女 提交于 2019-12-09 23:36:18
问题 So I have followed this guide to train my own pedestrian HOG detector. https://github.com/DaHoC/trainHOG/wiki/trainHOG-Tutorial And it was successful with 4 files generated. cvHOGClassifier.yaml descriptorvector.dat features.dat svmlightmodel.dat Does anyone know how to load the descriptorvector.dat file as a vector? I've tried this but failed. vector<float> detector; std::ifstream file; file.open("descriptorvector.dat"); file >> detector; file.close(); This is something I would like to use

Support vector machine in Python using libsvm example of features

别说谁变了你拦得住时间么 提交于 2019-12-09 06:25:18
问题 I have scraped a lot of ebay titles like this one: Apple iPhone 5 White 16GB Dual-Core and I have manually tagged all of them in this way B M C S NA where B=Brand (Apple) M=Model (iPhone 5) C=Color (White) S=Size (Size) NA=Not Assigned (Dual Core) Now I need to train a SVM classifier using the libsvm library in python to learn the sequence patterns that occur in the ebay titles. I need to extract new value for that attributes (Brand, Model, Color, Size) by considering the problem as a