File Exchange

image thumbnail

Feature Selection Library

version 6.2.2018.1 (672 KB) by Giorgio

Giorgio (view profile)

Feature Selection Library (MATLAB Toolbox)

326 Downloads

Updated 10 Aug 2018

View License

Feature Selection Library (FSLib 2018) is a widely applicable MATLAB library for feature selection (attribute or variable selection), capable of reducing the problem of high dimensionality to maximize the accuracy of data models, the performance of automatic decision rules as well as to reduce data acquisition cost.
* FSLib was awarded by MATLAB in 2017 by receiving a MATLAB Central Coin.
We would greatly appreciate it if you kindly give us some feedback on this toolbox. We value your opinion and welcome your rating.
If you use our toolbox (or method included in it), please consider to cite:
[1] Roffo, G., Melzi, S., Castellani, U. and Vinciarelli, A., 2017. Infinite Latent Feature Selection: A Probabilistic Latent Graph-Based Ranking Approach. arXiv preprint arXiv:1707.07538.
[2] Roffo, G., Melzi, S. and Cristani, M., 2015. Infinite feature selection. In Proceedings of the IEEE International Conference on Computer Vision (pp. 4202-4210).
[3] Roffo, G. and Melzi, S., 2017, July. Ranking to learn: Feature ranking and selection via eigenvector centrality. In New Frontiers in Mining Complex Patterns: 5th International Workshop, NFMCP 2016, Held in Conjunction with ECML-PKDD 2016, Riva del Garda, Italy, September 19, 2016, Revised Selected Papers (Vol. 10312, p. 19). Springer.

[4] Roffo, G., 2017. Ranking to Learn and Learning to Rank: On the Role of Ranking in Pattern Recognition Applications. arXiv preprint arXiv:1706.05933.

Comments and Ratings (106)

One of the best flawless toolbox that I have found in File Exchange! Superb work! Kudos!

V RAJINIKANTH

Excellent Work.

frankjk

nice👍🏼

Zheng Peng

Ha, I found my fault. The label must be 1 and -1, instead of 1 and 0

God Keven

fish

fish (view profile)

lily guo

thanking for your sharing,it is important to me , thanks

Giorgio

Giorgio (view profile)

F.Y.I.
New Special Issue "Feature Selection Meets Deep Learning"
The primary focus of this Special Issue will be on feature selection and deep learning, that is the question of how deep learning models can be imbued with feature selection and ranking strategies.
Please refer to the submission page for more information (https://www.mdpi.com/journal/informatics/special_issues/FSMDL)

Fantastic , thank you so much!

vivid zheng

Hi, Giorgio! Thank you for your sharing. I have a question: where is the source code of [19] Lasso? I can not find it in the toolbox.

Pedro Borges

Pedro Borges

Hi, Giorgio! It can be a silly question... but, what do you mean with "scores" within "cfs" function? How can I access these values? The code does not return them in the workspace.

Thank you for sharing!
Some of the methods use "nClass" variable for selecting number of classes. How about other methods in your toolbox? Do you know if they are applicable to multi-class paradigm?
Also, if you could provide citations for implemented methods, that would be wonderful!

crystal yang

Thanks!!

Giorgio

Giorgio (view profile)

Fixed. Thanks.

Giorgio

Giorgio (view profile)

I''l check.. sorry

hi. i believe the new version contains the wrong infFS function. the demo fails because infFS is given too many arguments. infFS.m says it is from version 4.0.

Giorgio

Giorgio (view profile)

New version available, please compile the solution before. run make.

missing libsvm_classifier_spider

Giorgio

Giorgio (view profile)

Hi! Please see the new version 6.1 -> Added new Demo file: how to select the best parameters for the Inf-FS and ILFS.

Giorgio

Giorgio (view profile)

How many tokens are you using? note, T>=4

Hello-Caihua

I got the error : error using histc ;Edge vector must be monotonically non-decreasing

Jinya Su

Jinya Su (view profile)

Hello-Caihua

Hi , thank you for your great job. I have a problem. when I run this toolbox on matlab 2015b on 64-bit Window 8.1 with 8GB memory, I got the error 'Out of memory'. I followed some suggestions such as reset the 'Jave heap size', but it didn't work. What shall I do?

ZhenHui Sun

for matlab2018a
% svmStruct = svmtrain(X_train(:,ranking(1:k)),Y_train,'showplot',true);
% C = svmclassify(svmStruct,X_test(:,ranking(1:k)),'showplot',true);
svmClassifier = fitcsvm(X_train(:,ranking(1:k)),Y_train);
[C, scores] = predict(svmClassifier, X_test(:,ranking(1:k)));

erick schultz

Hi,

I am using Matlab 2015a on a windows 10 computer. I always get the error: "Error using mex
No supported compiler or SDK was found. For options, visit http://www.mathworks.com/support/compilers/R2015a/win64.html." Can anyone help me?

Giorgio

Giorgio (view profile)

Hi @dongyang! unfortunately, the toolbox provides a collection of ranking methods, you should decide a priori the cardinality of your subset. If you want a method that provides you with a subset of features you can go for Lasso approaches, they are estimators used to remove redundant features by reducing their weights to zero, at the end of the process, you can select the subset of features whose coefficients are > 0. I hope to help! Best.

dongyang

Hi Giorgio:
thanks for sharing your code. I have some problems,
how can i output an subset of features using this toolbox, instead of a ranking of features.

Jinghua Xiong

Hi Giorgio:
I am trying to perform cross-validation on test data in an "on-the-fly" way during RFE.
I have tried setting a.test_on_the_fly = struct('loss','class_loss','data',test_dset);
where test_dset = data(X_test,Y_test);

This throws an error within training:
Undefined function or variable 'group'.

Error in rfe/training>evaluate (line 122)
if ~isa(a.test_on_the_fly.result, 'group'), a.test_on_the_fly.result = group; end

any idea how to fix this? i am not sure what "group" is supposed to be, and whether I need to set a.test_on_the_fly.result ahead of time.

thanks,
Nick

Ioannis

Dear Giorgio,

very glad to see everything compiling and running so smoothly
in version 6. Fantastic job!

Xiaomin Yue

Hi Giorgio,

The toolbox is great. It seems that the ranking from rfe algorithm is always 1 to N, not matter what data I put in. Is I missing something? Does the ranking should be importance of the features?

Hello, I'm going to release a new version 6.0 with several updates. best.

omid eghbali

hello Giorgio
thanks for sharing your code. I have some problems,
how can i import this toolbax in matlab 2017a?

chintan Shah

Error using mex
No supported compiler or SDK was found. For options, visit
http://www.mathworks.com/support/compilers/R2014a/win64.

arghavani

hi
thank you for sharing your code. this is an error that i recieve while compiling will you please help me ?
make
+ Build and install
building mex(dll) of estmutualinfo.cpp
Building with 'Microsoft Windows SDK 7.1 (C++)'.
MEX completed successfully.
building mex(dll) of estpab.cpp
Building with 'Microsoft Windows SDK 7.1 (C++)'.
MEX completed successfully.
building mex(dll) of libsvm_classifier_spider.cpp
Warning: Escaped character '\m' is not valid. See 'doc sprintf' for supported special characters.
> In make (line 20)
Error using mex
Unknown file extension ''.
Error in make (line 20)
eval(['mex libsvm_classifier_spider.cpp svm.cpp -Icompiletools ',sprintf(['compiletools',filesep,'mexarg.cpp'])])

Conor Fahy

Thank you Giorgio for this incredibly useful and easy to use library...

Conor Fahy

Hi!
actually this is not a library problem, your missing file is located in: FSLib_v5.2_2017/lib/compiletools/mexarg.h
your compiler can't find it, so you can try to add the folder and subfolders to the path then compile again.
Best,

Harsha Dudeja

This is the complete set of errors on running the make.m file
Error using mex
libsvm_classifier_spider.cpp
E:\FSLib_v5.2_2017 (1)\FSLib_v5.2_2017\lib\libsvm_classifier_spider.cpp(11) : fatal
error C1083: Cannot open include file: 'mexarg.h': No such file or directory

Error in make (line 20)
eval(['mex libsvm_classifier_spider.cpp svm.cpp
-Icompiletools',sprintf(['compiletools',filesep,'mexarg.cpp'])])

Harsha Dudeja

Feature selection method: rfe
training rfe(svm kernel linear) feat=43 output_rank=1...
Training in while 1
training svm kernel linear....
Undefined function or variable 'libsvm_classifier_spider'.

Error in svm/training (line 225)
[alpha,xSV,bias0]=libsvm_classifier_spider({'X',x},{'Y',y}, ...

Error in algorithm/train (line 103)
[dat,algor]=training(algo,dat);

Error in rfe/training (line 36)
[res,a.child]=train(untrained,dat);

Error in algorithm/train (line 103)
[dat,algor]=training(algo,dat);

Error in spider_wrapper (line 55)
[tr,a]=train(a,dset);

Error in rfe_rf (line 16)
ranking = spider_wrapper(TrainFeatures,TrainClass,numF, lower('rfe'));
Please help

Giorgio

Giorgio (view profile)

@shun: Thank you for the feedback. I fixed the bug, probably introduced in the previous upload. sorry for that.
@liliin: FSV is a wrapper method. Sorry, where you found a reference about FSV and filters?

shun zhang

hi Giorgio,i have a question when using infFS mode. In the paper, the correlation term is corr=1-abs(spearman(fi,fj)), but in your code, why it seems like corr=spearman(fi,fj)?

liliinChina

Hi Giorgio, I have one question about fsv feature selection method, in your guide book, you say fsv is a wrapper method, but your code about this indicates it is a filter method. Could you please tell me the principle that you referred in your code.

This error was found by running 'make.m'.What to do then?

Error using mex
No supported compiler or SDK was found. For options, visit http://www.mathworks.com/support/compilers/R2014a/win32.

Error in make (line 17)
mex([list(i).name]);

Said Pertuz

Excellent work

Hi Giorgio, thanks for sharing your code. I have some problems,
I have 100 samples (84 train 16 test) and each of them have 648 attribute, so i have 100*648 matrix. i create x_train(84*648), y_train(84*1), x_test(16*648), y_test(16*1).
After selecting methods, some errors occurs. I'm pasting the command window;

+ Feature selection method: l0
training l0(svm kernel linear) feat=648 output_rank=1....
training svm kernel linear....
Constraints 1 removed because of dependence

No equality constraints...

Error using +
Matrix dimensions must agree.
Error in quadsolve (line 414)
y = y +fd*dy;
Error in svm/training (line 50)
[alpha,bias] = quadsolve(KerMa,-ones(size(KerMa,1),1),y',0,algo.C);
Error in algorithm/train (line 103)
[dat,algor]=training(algo,dat);
Error in l0/training (line 30)
[r,alg.child]=train(alg.child,datTemp);
Error in algorithm/train (line 103)
[dat,algor]=training(algo,dat);
Error in spider_wrapper (line 55)
[tr,a]=train(a,dset);
Error in feat_selec (line 205)
ranking = spider_wrapper(X_train,Y_train,numF,lower(selection_method));
What do you advice for me?

Giorgio

Giorgio (view profile)

Hi!
In order to compile the toolbox you only need to run "make.m" from the main folder.
Please open the make.m file and check the paths separator: addpath(genpath('./compiletools'));
/ is used under Linux OS, if you are running the code on MS Windows you may need to replace it with \ such as: addpath(genpath('.\compiletools'));

From your outputs it seems you have a suitable C compiler installed. If you still have problems copy and paste the error otherwise is difficult to understand what's wrong. Best wishes

Samuel Walter

Hello Giorgio, i have the same problem than Richard. At first i run the mexall.-file and get this output:
Compiling...
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'g++'.
MEX completed successfully.
Compilation completed.

After that i want to run the make.m File but get the error: Unknown file extension ''. Error in make (line 20).
What did i do wrong? Thank you in advance.

Hello, This download wont build using make.m. What do I need to do? The directory /lib/compiletools is not found / missing. Error occurs in line 20 when running the make.m file. Thank you.

Giorgio

Giorgio (view profile)

Hi, Sorry but the guys from mathworks downgrade the library because of .mex file in the last upload. I re-uploaded the last version.

Quoc Pham

Hello Giorgio,
How I can fix this problem (I was using ILFS)
Assignment has more non-singleton rhs dimensions than non-singleton subscripts

Giorgio

Giorgio (view profile)

Hello, ranking(1) is the most discriminative feature. Ranking(end) the worst feature. best.

Hello Giorgio,

I'd like to know how the direction in which features are ranked after calling

[ranking, weights, subset] = ILFS( X_train, Y_train , 0 );

ranking(1) is the ''most discriminant'' feature or is it ranking(end)?

Thanks in advance

Giorgio

Giorgio (view profile)

Hello,
Please make sure you've correctly compiled the toolbox:
in ./FSLib_v5.0_2017/lib/drtoolbox ---> run mexall.m

you should have this output:

>> mexall
Compiling...
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'gcc'.
MEX completed successfully.
Building with 'g++'.
MEX completed successfully.
Compilation completed.

Error using internal.stats.parseArgs (line 42)
Wrong number of arguments.

Error in pca (line 170)
[vAlgorithm, vCentered, vEconomy, vNumComponents, vRows,vWeights,...

Error in intrinsic_dim (line 197)
[mappedX, mapping] = pca(X, size(X, 2));

Error in Untitled12 (line 39)
dd=intrinsic_dim(X, techniques{ii});

Rhys Chappell

Yaping LIN

Giorgio

Giorgio (view profile)

According to our experiments in "Infinite Latent Feature Selection: A Probabilistic Latent Graph-Based Ranking Approach" ICCV 2017, our ILFS results to be the most stable, robust supervised FS technique.
See the paper results here: https://goo.gl/WiDmu2
To perform a multiclass FS, you can always use the 1-vs-all strategy.
let's consider we have 4 classes.
We can obtain the best subsets representing each class by setting the class labels accordingly:
sub1) label 1 to class 1 label -1 to classes 2,3,4
sub2) label 1 to class 2 labels -1 to classes 1,3,4
sub3) label 1 to class 3, labels -1 to 1,2,4
sub4) label 1 to class 4, labels -1 to classes 2,3,4
After that we can extract the maximum common subset (intersect sub1 sub2 sub3 sub4).

Hello,
please suggest me the best supervised feature selection method from this tool box for high dimensional ,multiclass data(7 classes)

Hello,
Whenever I use mRMR method on the training data and training labels, MATLAB keeps crashing when I use it.
Anybody had a similar issue?

>> fea,score] = mRMR(M,L,10) %where M is the X-train, and L is the Y-train, and I want to select 10 features.
------------------------------------------------------------------------
Access violation detected at Sun Aug 13 21:38:47 2017
------------------------------------------------------------------------
.
.
.

Thank you in advance!

amr alanwar

rabbasi

Thanks for the contribution, I have a question regarding LaplacianScore. when I use your code for the example that is included in your code, regarding constructW function it gives me a warning: "Warning: This function has been changed and the Metric is no longer be supported " and in the continuation, it gives me an error in LaplacianScore(fea,W) function:
"Subscript indices must either be real positive integers or logicals.". as I said, the implementation is done on the rand data which is as an example in your code explanations. I would be thankful if you explain the reason.

Giorgio

Giorgio (view profile)

The infinite feature selection works in supervised and unsupervised manner, you can make your choice simply by setting the parameter sup=1 (for supervision) or sup=0 (unsupervised).

[ranking, w] = infFS( X_train , Y_train, alpha , sup , 0 );

X_train is a matrix, the standard "design matrix" (see Bishop, 2006) each row is a sample and each column a feature.
Y_train is a column vector of labels, if you have two classes, this vector will look like this: [1,1,1,-1,-1-1,1,-1,etc..] '
alpha is the mixing parameter, you can set alpha=0.9 usually works fine.

There's no way to know how many features to use a priori, most of the FS methods just rank the features according to their degrees of relevance, so you can select the top N features and pass them to a classifier to see how they work. If not enough you can increase N accordingly ...

The top N features are likely the ones the best contribute to the classification
Best!

Julien, I have used the ReliefF algorithm for a similar problem and it worked perfectly!
Good luck

Julien

Julien (view profile)

Hi, sorry for this very basic question. Can this method be used to identify which (visual) features best contribute to the classification of a given image in a binary classification task? Thanks . Julien

Eliya Sultan

Hi,
Does it make sense that I run the code twice over the same data and get different results?
I used the mrmr and fisher method.
thanks!
eliya.

Giorgio

Giorgio (view profile)

My comment disappeared.
SVM-RFE is SVM based, so
1) did you normalize you input data? SVMs work better and faster when inputs are in the range [0,1],
a very simple way is: X = X ./ sum(X,2)
2) check if in your Y vector you have missing labels like [ 1 1 1 1 1 3 3 3 3 4 4 4 4 5 5 5 5] <- here there's no 2, maybe this can generate an exception. in such a case you should re-assign labels as follows:
[ 1 1 1 1 1 3 3 3 3 4 4 4 4 5 5 5 5] --> [ 1 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4]

Giorgio

Giorgio (view profile)

**** sorry "check if in your Y vector you have missing labels like [ 1 1 1 1 1 3 3 3 3 4 4 4 4 5 5 5 5] <- here there's no 4, maybe this can generate an exception. "
I meant label 2 is missing... in such a case you should re-assign labels like this:
[ 1 1 1 1 1 3 3 3 3 4 4 4 4 5 5 5 5] --> [ 1 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 4]
best,

elahe afshari

Hi Dear Giorgio Roffo

I've used svm-rfe(FSLIB) for two similar dataset(ozone & ozone2), but for ozone dataset properly run and for ozone2 dataset run it does not end.

% function SR=SVMRFEOzone(TrainData)
%% DEMO FILE
fprintf('\nFEATURE SELECTION TOOLBOX v 4.0 2016 - For Matlab \n');

% Select a feature selection method from the list
listFS = {'InfFS','ECFS','mrmr','relieff','mutinffs','fsv','laplacian','mcfs','rfe','L0','fisher','UDFS','llcfs','cfs'};

[ methodID ] = readInput( listFS );
selection_method = listFS{methodID}; % Selected
% Include dependencies
addpath('./lib'); % dependencies
addpath('./methods'); % FS methods

% number of features
% numF = size(X_train,2);
vectorvote=zeros(1,72);
TrainData=load('ozone.mat');
TrainData=TrainData.TrainData;

% feature Selection on training data

X_train=TrainData(1:201,1:72);
Y_train=TrainData(1:201,73);
ranking = spider_wrapper(X_train,Y_train,60,lower('rfe'));
rankingD=sort(ranking(1,61:72));
rankingB=sort(ranking(1,1:60));
vectorvote(1,rankingD(:))=vectorvote(1,rankingD(:))+9;
TrainData(:,rankingD(:))=[];
%--------------------------------------------------------------

X_train1=TrainData(201:400,1:60);
Y_train1=TrainData(201:400,61);
ranking1 = spider_wrapper(X_train1,Y_train1,60,lower('rfe'));
rankingD1=sort(ranking1(1,51:60));
rankingB1=sort(ranking1(1,1:50));
rankingB1=rankingB(rankingB1(:));
vectorvote(1,rankingB(rankingD1(:)))=vectorvote(1,rankingB(rankingD1(:)))+8;
TrainData(:,rankingD1(:))=[];

% --------------------------------------------------------------
X_train2=TrainData(401:600,1:50);
Y_train2=TrainData(401:600,51);
ranking2 = spider_wrapper(X_train2,Y_train2,40,lower('rfe'));
rankingD2=sort(ranking2(1,41:50));
rankingB2=sort(ranking2(1,1:40));
rankingB2=rankingB1(rankingB2(:));
vectorvote(1,rankingB1(rankingD2(:)))=vectorvote(1,rankingB1(rankingD2(:)))+7;
TrainData(:,rankingD2(:))=[];
%--------------------------------------------------------------
X_train3=TrainData(600:801,1:40);
Y_train3=TrainData(600:801,41);
ranking3 = spider_wrapper(X_train3,Y_train3,30,lower('rfe'));
rankingD3=sort(ranking3(1,31:40));
rankingB3=sort(ranking3(1,1:30));
rankingB3=rankingB2(rankingB3(:));
vectorvote(1,rankingB2(rankingD3(:)))=vectorvote(1,rankingB2(rankingD3(:)))+6;
TrainData(:,rankingD3(:))=[];
%--------------------------------------------------------------
X_train4=TrainData(802:1000,1:30);
Y_train4=TrainData(802:1000,31);
ranking4 = spider_wrapper(X_train4,Y_train4,25,lower('rfe'));
rankingD4=sort(ranking4(1,26:30));
rankingB4=sort(ranking4(1,1:25));
rankingB4=rankingB3(rankingB4(:));
vectorvote(1,rankingB3(rankingD4(:)))=vectorvote(1,rankingB3(rankingD4(:)))+5;
TrainData(:,rankingD4(:))=[];


TrainData1=load('ozone2.mat');
TrainData1=TrainData1.xc11;

% feature Selection on training data

X_train=TrainData1(1:201,1:72);
Y_train=TrainData1(1:201,73);
ranking = spider_wrapper(X_train,Y_train,60,lower('rfe'));
rankingD=sort(ranking(1,61:72));
rankingB=sort(ranking(1,1:60));
vectorvote(1,rankingD(:))=vectorvote(1,rankingD(:))+9;
TrainData(:,rankingD(:))=[];
%--------------------------------------------------------------

X_train1=TrainData1(201:400,1:60);
Y_train1=TrainData1(201:400,61);
ranking1 = spider_wrapper(X_train1,Y_train1,60,lower('rfe'));
rankingD1=sort(ranking1(1,51:60));
rankingB1=sort(ranking1(1,1:50));
rankingB1=rankingB(rankingB1(:));
vectorvote(1,rankingB(rankingD1(:)))=vectorvote(1,rankingB(rankingD1(:)))+8;
TrainData(:,rankingD1(:))=[];

% --------------------------------------------------------------
X_train2=TrainData1(401:600,1:50);
Y_train2=TrainData1(401:600,51);
ranking2 = spider_wrapper(X_train2,Y_train2,40,lower('rfe'));
rankingD2=sort(ranking2(1,41:50));
rankingB2=sort(ranking2(1,1:40));
rankingB2=rankingB1(rankingB2(:));
vectorvote(1,rankingB1(rankingD2(:)))=vectorvote(1,rankingB1(rankingD2(:)))+7;
TrainData(:,rankingD2(:))=[];
%--------------------------------------------------------------
X_train3=TrainData1(600:801,1:40);
Y_train3=TrainData1(600:801,41);
ranking3 = spider_wrapper(X_train3,Y_train3,30,lower('rfe'));
rankingD3=sort(ranking3(1,31:40));
rankingB3=sort(ranking3(1,1:30));
rankingB3=rankingB2(rankingB3(:));
vectorvote(1,rankingB2(rankingD3(:)))=vectorvote(1,rankingB2(rankingD3(:)))+6;
TrainData(:,rankingD3(:))=[];
%--------------------------------------------------------------
X_train4=TrainData1(802:1000,1:30);
Y_train4=TrainData1(802:1000,31);
ranking4 = spider_wrapper(X_train4,Y_train4,25,lower('rfe'));
rankingD4=sort(ranking4(1,26:30));
rankingB4=sort(ranking4(1,1:25));
rankingB4=rankingB3(rankingB4(:));
vectorvote(1,rankingB3(rankingD4(:)))=vectorvote(1,rankingB3(rankingD4(:)))+5;
TrainData(:,rankingD4(:))=[];



Mehdi BRAHIMI

Hi Giorgio!
Thank you very much for this toolbox !
I have one question about feature selection using fisher linear discriminent. In the paper related to the toolbox you've cited the Generelized Feature Score proposed by Gu et al. but it seems that the toolbox performs the "simple" fisher selection defined by Duda et al. 2012. Is that correct ?

Giorgio

Giorgio (view profile)

Hi! Thank you for downloading the toolbox, some techniques can provide you with a subset of features. But generally, they just perform the ranking step, in such a case you can decide how many features to select a priori or use any form of cross-validation to decide (roughly) how many of them to maintain.

Thank you very much for valuable contributions.
I have just downloaded FSLib developed by you. I have a question. After the feature ranking processes, how do we decide how many features are needed for the best accuracy?

jae baak

Forget about the comment below. Found out that Matlab Compiler isn't the only one available. This toolbox works great by the way.

jae baak

Would like to try this out but I don't have access to Matlab Compiler. Is a pre-compiled version available somewhere? (other than the dead link in the first comment) Thank you!

Great tool for FS, well documented and excellent README file with details and references for various methods.

I wish it would work for multi-class or regression based feature selection, but I will see if I can figure out a way to make it possible.

--EDIT: worth noting that the SVM tools used here "will be removed in a future release" and will need to be replaced with the updated functions at some point.

--EDIT2: Figured out how to get multi-class working for fisher at least. For others interested:
1. Turn your labels (Y) into an nxm matrix where m=number of classes and n=number of samples (with values -1 or 1 as in the Demo).
2. Modify the 'spider_wrapper' line 10: a.method='classification'; to a.method=2;%could be any number 1-3 depending on your method preference (see line 60 of FSLib_v4.2_2016/FSLib_v4.2_2016/FSLib_v4.2_2016/lib/@fisher/training.m for details)
3. Don't try to plot the results using svms, that won't work for multiclass data. Stop after feature selection (line 149 of Demo.m).

Giorgio

Giorgio (view profile)

Hi Davide, the '\' and '/' for paths are related to your operating system (Linux or Windows) so maybe you need to switch from to another based on it, you're welcome :)

Hi Giorgio, thanks for the advice. There was a \ instead of a / at line 9 of the make file file, under the path "/lib". Cheers :)

Giorgio

Giorgio (view profile)

Hi Davide, are you sure that you compiled the solution? Before using the toolbox you should run the make file, it seems a mex file is missing, also check to include into the path the FSLib folder and its subfolders.

ranking = spider_wrapper(X,Y,N_DS,lower('rfe')) triggers this stack error trace:

Undefined function 'libsvm_classifier_spider' for input arguments of type 'cell'.

Error in svm/training (line 225)
[alpha,xSV,bias0]=libsvm_classifier_spider({'X',x},{'Y',y}, ...

Error in algorithm/train (line 103)
[dat,algor]=training(algo,dat);

Error in rfe/training (line 36)
[res,a.child]=train(untrained,dat);

Error in algorithm/train (line 103)
[dat,algor]=training(algo,dat);

Error in spider_wrapper (line 12)
[tr,a]=train(a,dset);

Can you suggest me how to solve it?

Giorgio

Giorgio (view profile)

Hi David, the Inf-FS is an unsupervised method, however within this toolbox you can find two variants of this method.
function [RANKED, WEIGHT] = infFS( X_train, Y_train, alpha, supervision, verbose )

Set supervision=0 to use the unsupervised version, in such a case you can set Y_train=[]

If you want to use the supervised version then set supervision=1 and provide the right class labels.

Thank you for your question,
Hope this helps!

Hi, one question regarding the infFS algorithm. If it is an unsupervised feature selection method, why do you have to provide a Y_train vector with the class labels?

nVIDIApascal

YJXia

YJXia (view profile)

Helmie Hamid

yiting yang

Afsoon

Afsoon (view profile)

Does this toolbox work on multiclass data? I have data with 1320 features and 3 class and I need feature selection stage. But this toolbox can't work for my data.

Andrea

Andrea (view profile)

Lory Pent

I found FSLib to be a very useful tool! Many thanks to the developer!

David

David (view profile)

Giorgio

Giorgio (view profile)

Hi, thank you for your feedback. I added the "Feature Selection Library (MATLAB Toolbox)" paper in the zip. It discusses the most important FS methods. As for the usability, you can find a Demo file in the toolbox which is designed to allow users to run the code easily and use every method provided with the toolbox.

Hi, Your toolbox seems very interesting, but do you provide any 'readme' file or any other documentation to learn how to use it?
Thank you very much!

Excellent! Thank you!

Hi Thanks so much for the library. I have a question. For the method Fisher[6], does the library implement the Generalized Fisher Score proposed by Quanquan Gu etc 2012, (which is more complicated), or just the classical Fisher Score. Thank you.

frankjk

huang hai

Giorgio

Giorgio (view profile)

Updates

6.2.2018.1

+ Add method: infFS_fast

6.2.2018.0

+ New Methods:
[1] ILFS
[2] InfFS
[3] ECFS
[4] mrmr
[5] relieff
[6] mutinffs
[7] fsv
[8] laplacian
[9] mcfs
[10] rfe
[11] L0
[12] fisher
[13] UDFS
[14] llcfs
[15] cfs
[16] fsasl
[17] dgufs
[18] ufsol
[19] lasso

6.1.2018.0

+ Added new Demo file: how to select the best parameters for the Inf-FS and ILFS.
+ How to obtain the best results with the Inf-FS approach.

6.0.2018.0

+ File separator for current platform included.

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Discover Live Editor

Create scripts with code, output, and formatted text in a single executable document.


Learn About Live Editor

FSLib_v6.2.1_2018

FSLib_v6.2.1_2018/eval_metrics

FSLib_v6.2.1_2018/lib

FSLib_v6.2.1_2018/lib/@algorithm

FSLib_v6.2.1_2018/lib/@data

FSLib_v6.2.1_2018/lib/@distance

FSLib_v6.2.1_2018/lib/@fisher

FSLib_v6.2.1_2018/lib/@kernel

FSLib_v6.2.1_2018/lib/@l0

FSLib_v6.2.1_2018/lib/@loss

FSLib_v6.2.1_2018/lib/@rfe

FSLib_v6.2.1_2018/lib/@svm

FSLib_v6.2.1_2018/lib/drtoolbox

FSLib_v6.2.1_2018/lib/drtoolbox/gui

FSLib_v6.2.1_2018/lib/drtoolbox/techniques

FSLib_v6.2.1_2018/lib/files

FSLib_v6.2.1_2018/methods