Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7082381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:02:46+00:00 2026-05-28T07:02:46+00:00

I am following the example on this page : Example of 10-fold SVM classification

  • 0

I am following the example on this page : Example of 10-fold SVM classification in MATLAB.

Basically, i am following the example to execute my classification. The problem i face is that pred is always postive. It is not able to detect negative data.

clear all;
clc;
load('C:\Users\HP\Documents\MATLAB\TrainLabel');
load('C:\Users\HP\Documents\MATLAB\TrainVec');
cvFolds = crossvalind('Kfold', TrainLabel, 10);  
cp = classperf(TrainLabel);   
for i = 1:10                                   
    testIdx = (cvFolds == i);                   
    trainIdx = ~testIdx;                             
%     Model = svmtrain(TrainVec(trainIdx,:), TrainLabel(trainIdx),'showplot',true); 
    Model = svmtrain(TrainVec(trainIdx,:), TrainLabel(trainIdx), ...              
     'Autoscale',true, 'Showplot',false, 'Method','QP', ...              
     'BoxConstraint',2e-1, 'Kernel_Function','rbf', 'RBF_Sigma',1);
    pred = svmclassify(Model, TrainVec(testIdx,:),'Showplot',false);      
    cp = classperf(cp, pred, testIdx);
end 
cp.CorrectRate 
cp.CountingMatrix 

The values for pred is [1;1;1;1;1;1] but my correctrate is 0.65(65%) and the TrainLabel is <60×1 double> and TrainVec is <60×5900 double>.

Two more qns:

  1. must the values of TrainLabel be 0 and 1? is it ok if it is -1 or 1

  2. TrainVec is such that each feature from a image is placed in a row. The feature from the next image is placed in the next row. Is this correct? or must each of features be placed in a different column?

Need some help on this… thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:02:47+00:00Added an answer on May 28, 2026 at 7:02 am

    Scale the values to between 0 to 1.This will solve the problem

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following problem. I have a team page like this example: http://www.social-markets.de/social-commerce-team.html small
I have been following the example on the bottom of this page: http://msdn.microsoft.com/en-us/library/microsoft.windows.controls.ribbon.ribbonapplicationmenu.auxiliarypanecontent.aspx to
I have setup a simple Google Chart by following the example on this page:
Following this example, I can list all elements into a pdf file import pyPdf
I'm following this example: http://www.codinghorror.com/blog/2005/12/getting-started-with-indexing-service.html However, the conversion to dataset shows empty columns for
Ideally I want a function something like the following (this example doesn't compile): void
Take the following example plugin: (function($) { $.fn.alertOnClick = function(text) { return this.each(function(){ $(this).click(alert(text));
I initially designed my system following the s# architecture example outlined in this codeproject
This is just an example, but given the following model: class Foo(models.model): bar =
This confuses me. The following compiles fine under Eclipse. package com.example.gotchas; public class GenericHelper1

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.