Perform sequential feature selection for classification of noisy features - code explanation

1 view (last 30 days)
Dear All, First of all I'm new to use matlab software, I'm very interested with feature selection method (sequential method) to get discriminant variable in the end. I've searched and learn from matlab it self about the example but I little bit confused about these part
*fun = @(XT,yT,Xt,yt)... (sum(~strcmp(yt,classify(Xt,XT,yT,'quadratic'))));
[fs,history] = sequentialfs(fun,X,y,'cv',c,'options',opts) *
can anybody teach me how the function worked until it get for example this value (Step 1, added column 7, criterion value 0.04)
Thanks a lot! Best Regards Adrian Tjahjana
example:
load fisheriris; X = randn(150,10); X(:,[1 3 5 7 ])= meas; y = species;
c = cvpartition(y,'k',10); opts = statset('display','iter'); fun = @(XT,yT,Xt,yt)... (sum(~strcmp(yt,classify(Xt,XT,yT,'quadratic'))));
[fs,history] = sequentialfs(fun,X,y,'cv',c,'options',opts)
Start forward sequential feature selection: Initial columns included: none Columns that can not be included: none Step 1, added column 7, criterion value 0.04 Step 2, added column 5, criterion value 0.0266667 Final columns included: 5 7
fs = 0 0 0 0 1 0 1 0 0 0 history = In: [2x10 logical] Crit: [0.0400 0.0267]
history.In ans = 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 0 0 0

Answers (2)

Sean de Wolski
Sean de Wolski on 20 Dec 2011
doc function_handle
Is possibly be a good starting point to help clarify the above code.
  1 Comment
Adrian
Adrian on 21 Dec 2011
HI Thanks for the reply, it's really helpful
more question, it's a book or something else that I can deeply learn matlab code about feature selection?
Thanks

Sign in to comment.


Richard Willey
Richard Willey on 22 Dec 2011
Hi Adrian
I did a two part series on Loren Shure's blog contrasting feature selection techniques with regularization. The article contain some background theory along with some example code. You can read the articles at
I also did a recorded webinar that dives into more detail on these topics. You can watch the webinar at http://www.mathworks.com/company/events/webinars/wbnr59911.html?seq=1 or download the code from http://www.mathworks.com/matlabcentral/fileexchange/33329
If you want a more thorough treatment of the underlying theory your best option is probably to get a copy of "Elements of Statistical Learning" by Hastie, Tibshirani, and Friedman.
Please note: If you're primary interested in information about how to use feature selection in MATLAB then your best course of action is to (thoroughly) read up on function handles and anonymous functions. (This is the most likely stumbling block)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!