Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Classifying using SVM

Subject: Classifying using SVM

From: Gomathi C

Date: 22 Mar, 2012 11:38:11

Message: 1 of 1

I'm doing a project in liver tumor classification. Actually I initially used Region Growing method for liver segmentation and from that I segmented tumor using FCM. I,then, obtained the texture features using Gray Level Co-occurence Matrix. My output for that was

stats =

autoc: [1.857855266614132e+000 1.857955341199538e+000]
contr: [5.103143332457753e-002 5.030548650257343e-002]
corrm: [9.512661919561399e-001 9.519459060378332e-001]
corrp: [9.512661919561385e-001 9.519459060378338e-001]
cprom: [7.885631654779597e+001 7.905268525471267e+001]

Now how should I give this as an input to the SVM program.

function [itr] = multisvm( T,C,tst )
%MULTISVM(2.0) classifies the class of given training vector according to the
% given group and gives us result that which class it belongs.
% We have also to input the testing matrix

%Inputs: T=Training Matrix, C=Group, tst=Testing matrix
%Outputs: itr=Resultant class(Group,USE ROW VECTOR MATRIX) to which tst set belongs

%----------------------------------------------------------------------%
% IMPORTANT: DON'T USE THIS PROGRAM FOR CLASS LESS THAN 3, %
% OTHERWISE USE svmtrain,svmclassify DIRECTLY or %
% add an else condition also for that case in this program. %
% Modify required data to use Kernel Functions and Plot also%
%----------------------------------------------------------------------%
% Date:11-08-2011(DD-MM-YYYY) %
% This function for multiclass Support Vector Machine is written by
% ANAND MISHRA (Machine Vision Lab. CEERI, Pilani, India)
% and this is free to use. email: anand.mishra2k88@gmail.com

% Updated version 2.0 Date:14-10-2011(DD-MM-YYYY)

u=unique(C);
N=length(u);
c4=[];
c3=[];
j=1;
k=1;
if(N>2)
    itr=1;
    classes=0;
    cond=max(C)-min(C);
    while((classes~=1)&&(itr<=length(u))&& size(C,2)>1 && cond>0)
%This while loop is the multiclass SVM Trick
        c1=(C==u(itr));
        newClass=c1;
        svmStruct = svmtrain(T,newClass);
        classes = svmclassify(svmStruct,tst);

% This is the loop for Reduction of Training Set
        for i=1:size(newClass,2)
            if newClass(1,i)==0;
                c3(k,:)=T(i,:);
                k=k+1;
            end
        end
        T=c3;
        c3=[];
        k=1;

% This is the loop for reduction of group
        for i=1:size(newClass,2)
            if newClass(1,i)==0;
                c4(1,j)=C(1,i);
                j=j+1;
            end
        end
        C=c4;
        c4=[];
        j=1;

        cond=max(C)-min(C); % Condition for avoiding group
                            %to contain similar type of values
                            %and the reduce them to process

% This condition can select the particular value of iteration
% base on classes
        if classes~=1
            itr=itr+1;
        end
    end
end

end

Kindly guide me.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us