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 7898589
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T08:28:28+00:00 2026-06-03T08:28:28+00:00

I want to use matlab toolbox to do feature selection. there is one good

  • 0

I want to use matlab toolbox to do feature selection. there is one good function there called sequentialfs that does a good job. However, I could not integrate it with LibSVM function to perform features selection. It works fine with KnnClassify, can somebody help me please. here is the code for KnnClassify:

fun1 = @(XT,yT,Xt,yt)…

    (sum((yt ~= knnclassify(Xt,XT,yT,5))));

[fs,history] = sequentialfs(fun1,data,label,’cv’,c,’options’,opts,’direction’,’forward’);

  • 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-06-03T08:28:29+00:00Added an answer on June 3, 2026 at 8:28 am

    You’ll need to wrap the libsvm functions to train and test an SVM on a particular featureset. I’d suggest writing things in a separate .m file (though in priciple I think it could go in an anonymous function). Something like:

    function err = svmwrapper(xTrain, yTrain, xTest, yTest)
      model = svmtrain(yTrain, xTrain, <svm parameters>);
      err = sum(svmpredict(yTest, xTest, model) ~= yTest);
    end
    

    and then you can call sequentialfs with:

    [fs history] = sequentialfs(@svmwrapper, ...);
    

    (You may need to check the order of the arguments to svmtrain, I can never remember which way round they should be).

    The idea is that svmwrapper will train an SVM and return its error on the test set.

    The anonymous equivalent would be:

    svmwrapper = @(xTrain, yTrain, xTest, yTest)sum(svmpredict(yTest, xTest, svmtrain(yTrain, xTrain, <svm parameters>) ~= yTest);
    

    which doesn’t look very nice.

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

Sidebar

Related Questions

I use the function findpeaks from MATLAB's Signal Processing Toolbox. But everytime the function
I want to use instead of matlab integration command, a basic self created one.
I want to use reshape() function in matlab by calling the following self-defined function:
I want to use some Python libraries to replace MATLAB. How could I import
I have a transaction log file in CSV format that I want use to
I have downloaded the matlab software and now i want to use the neural
I want to use fft in MATLAB to analize some exprimental data saved as
Is it possible to use the Matlab save command inside a function to store
I have a double 2D image that I want to use in my UI
i have the following in mathematica and want to use it in matlab.I tried

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.