svm classification - matlab

I am a beginner in MATLAB and doing my Programming project in Digital Image Processing,i.e. Magnetic Resonance image classification using wavelet features+SVM+PCA+ANN. I executed the example SVM classification from MATLAB tool and modified that to fit my requirements. I am facing problems in storing more than one feature in an input vector and in giving new input to SVM. Please help.

Simply feed multidimensional feature data to svmtrain(Training, Group) function as Training parameter (Training can be matrix, each column represents separate feature). After that use svmclassify(SVMStruct, Sample) for testing data classification.

Related

Vlfeat Matlab SVM

I'm trying to build an application for image processing, the purpose is to get thermal image and to decide if the image contains a human object or no.
My thoughts were to try Matlab (actually Octave), for that mission i'm trying to use Vlfeat package and i'm really confuse on how should i use this library.
I'm trying to use the SVM trainer after extracting HOG features but couldn't figure out how to test the data.
After I have trained the SVM, how to test a new image?
*If there are better solutions I'm open for suggestions.
From the first paragraph of the link you provided
(...) Y W'*X(:,i)+B has the same sign of LABELS(i) for all i.
Then Y W'*X(:,i)+B is the value assigned to some feature vector X(:,i), so for any given feature vector x you want to test, just evaluate W.' * x+B.
EDIT: A feature vector x for some test data is generated the same as for the training data using your feature extractio method. To classify this vector you evaluate the linear function given by the svm to get the classification "value" c=W.' * x+B Then you just need to consider the sign of c as the classification to one or the other class.

The visualization of high-dimensional input for two-class classification in SVM

I am trying to find a way to visualize the data with high-dimensional input for two-class classification in SVM, before analysis to decide which kernel to use. In documents online, the visualization of data is given only for two dimensional inputs (I mean two attributes).
Another question rises: What if I have multi-class and more than two attributes?
To visualize, the data should be represented by 3 or less dimension.
Simply PCA can be applied to reduce dimension.
use pre-image using MDS.
refer to a paper The pre-image problem in kernel methods and its matlab code in http://www.cse.ust.hk/~jamesk/publication.html

Images classification using SVM classifier

I am new in MATLAB,I have centers of training images, and centers of testing images stored in 2-D matrix ,I already extracted color histogram features,then find the centers using K-means clustering algorithm,now I want to classify them using using SVM classifier in two classes Normal and Abnormal,I know there is a built in function in MATLAB but I don't know to adapt it to be used in this job,any help or suggestion will be helpful to me.
Thank to All
Thank you ,the svmclassify function classifies each row of the data in Sample,but I've represented each image by four rows of centers out of
K-means clustering algorithm,so I don't know how to do training,any help or suggestion will be helpful to me.
To train your SVM classifier, you can use the svmtrain function as described here
To classify your data, you can use the svmclassify function as described here
PS: Do not hesitate to look at the MatLab documentation at the Mathworks website.
Hope this was helpful.

How to train SVM for Tamil Character Recognition using MATLAB?

Hi I am doing my Final Year M.E Project in Tamil Character Recognition. I have completed till Feature Extraction step. Now I got Features for Each image in the Dataset(HP Labs). How to Feed these features to train SVM and How to Perform Class Labeling. I am new to this Neural Network area. So please Help me....
In Training
In Matlab neural Network has two inputs:
Input vector
Target Vector
Example:
net = newFF(input,target);
net = train(net,input,target);
You give feature is input vector. Target is corresponding feature id(char ID).
In Testing
Extract feature from image, then test the feature in Neural Network using sim function.
sim(net,features).. It returns corresponding char-ID.
open Matlab then type nftool and study that tool box.
same thing in SVM
Training
svmtrain(input,label).
input as feature.
label as ID of particular feature.
Testing
using svmclassify() method . It returns output of charID.
you may want to look at the svmclassify and svmtrain methods in the bioinformatics toolbox in matlab.
by the way, do you really want support vector machines or neural networks? they are very different from each other. please be clear which classifier you want to use for your problem before deciding to use a particular implementation.
if you are new to the field of machine learning and want to try out a couple of algorithms, I would suggest you try Weka first.

Feature Selection in MATLAB

I have a dataset for text classification ready to be used in MATLAB. Each document is a vector in this dataset and the dimensionality of this vector is extremely high. In these cases peopl usually do some feature selection on the vectors like the ones that you have actually find the WEKA toolkit. Is there anything like that in MATLAB? if not can u suggest and algorithm for me to do it...?
thanks
MATLAB (and its toolboxes) include a number of functions that deal with feature selection:
RANDFEATURES (Bioinformatics Toolbox): Generate randomized subset of features directed by a classifier
RANKFEATURES (Bioinformatics Toolbox): Rank features by class separability criteria
SEQUENTIALFS (Statistics Toolbox): Sequential feature selection
RELIEFF (Statistics Toolbox): Relief-F algorithm
TREEBAGGER.OOBPermutedVarDeltaError, predictorImportance (Statistics Toolbox): Using ensemble methods (bagged decision trees)
You can also find examples that demonstrates usage on real datasets:
Identifying Significant Features and Classifying Protein Profiles
Genetic Algorithm Search for Features in Mass Spectrometry Data
In addition, there exist third-party toolboxes:
Matlab Toolbox for Dimensionality Reduction
LIBGS: A MATLAB Package for Gene Selection
Otherwise you can always call your favorite functions from WEKA directly from MATLAB since it include a JVM...
Feature selection depends on the specific task you want to do on the text data.
One of the simplest and crudest method is to use Principal component analysis (PCA) to reduce the dimensions of the data. This reduced dimensional data can be used directly as features for classification.
See the tutorial on using PCA here:
http://matlabdatamining.blogspot.com/2010/02/principal-components-analysis.html
Here is the link to Matlab PCA command help:
http://www.mathworks.com/help/toolbox/stats/princomp.html
Using the obtained features, the well known Support Vector Machines (SVM) can be used for classification.
http://www.mathworks.com/help/toolbox/bioinfo/ref/svmclassify.html
http://www.autonlab.org/tutorials/svm.html
You might consider using the independent features technique of Weiss and Kulikowski to quickly eliminate variables which are obviously unimformative:
http://matlabdatamining.blogspot.com/2006/12/feature-selection-phase-1-eliminate.html