MATLAB Answers

using fitcecoc with lasso for feature selection, how to find out the selected features

3 views (last 30 days)
Hello community,
I am trying to compare different feature selection methods on my own big set of data (10 classes) which I want to train with support vector machines and it works very well so far with filter methods and wrapped methods. Now I want to use L1-Regularization as a feature selection. I am training my data pretty straight forward for now just to try it out before optimizing stuff:
t=templateLinear('Regularization','lasso');
model=fitcecoc(X,Y,'Learners',t);
This works fine. But I am wondering how to find out the preferred features and I have no clue...
I looked at all the parameters of the model and of all the binarymodels themself, but I don't really find any coefficients that seem to make sense for what I am looking for. Probably my fault, but I hope somebody can help me!
Thank you very much!
Jojo :)

  0 Comments

Sign in to comment.

Accepted Answer

Johanna Richter
Johanna Richter on 25 Nov 2020
Well I got the solution myself, but I'll keep the question posted, maybe somebody faces the same problem.
The Regularization term strength Lambda was default way to low to "kick out" any of my features. (default Lamda=1/n, with n beeing the training sample size). By setting it manually a lot higher I got the result I expected to get initial: The binary models parameter beta gets a lot more zeros when increasing the parameter Lambda, which suggests, that this feature is not preffered by the lasso regularization.
Now I can get an overview about all the binary learners to see if there are some general preffered or "kicked of" features.
t=templateLinear('Regularization','lasso', 'Lambda', 0.1);
model=fitcecoc(X,Y,'Learners',t);
This Lambda works fine for me, but this does not mean it works the same on a different data set.
Have a nice day! :)

  0 Comments

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by