How to label the training projections obtained by PCA to use for training SVM for classification? MATLAB

前端 未结 3 763
清歌不尽
清歌不尽 2020-12-20 03:11

I have a \"training set\" of images. I have formed the \'Eigenspace\'. Now i need to label the projections to train the SVM. The projections of \"face 1\" to the Eigenspace

3条回答
  •  余生分开走
    2020-12-20 03:52

    It seems that you cannot train the SVM... This is an example on how you can train a Matlab SVM:

    %Generate 100 positive points (the data is a circle)
    r = sqrt(rand(100,1)); % radius
    t = 2*pi*rand(100,1); % angle
    dataP = [r.*cos(t), r.*sin(t)]; % points
    
    %Generate 100 negative points (the data is a circle)
    r2 = sqrt(3*rand(100,1)+1); % radius
    t2 = 2*pi*rand(100,1); % angle
    dataN = [r2.*cos(t2), r2.*sin(t2)]; % points
    
    data3 = [dataN;dataP];
    theclass = ones(200,1);
    theclass(1:100) = -1; %First 100 points are negative
    
    %Train the SVM
    cl = svmtrain(data3,theclass,'Kernel_Function','rbf');
    

提交回复
热议问题