File Exchange

image thumbnail

Binary Particle Swarm Optimization for Feature Selection

version 1.1.0 (58.4 KB) by Jingwei Too
Simple algorithm shows how binary particle swarm optimization (BPSO) used in feature selection problem.

40 Downloads

Updated 23 Jul 2020

View Version History

View License

I provide a simple binary particle swarm optimization (BPSO) for feature selection tasks, which can select the potential features to improve the classification accuracy.

The "Main" script demos an example on how to use BPSO with classification error rate (computed by KNN) as the fitness function for feature selection problem using benchmark data-set.

**********************************************************************************************************************************
Detail of BPSO can be found in the following papers:
[1] Too, J., Abdullah, A.R. and Mohd Saad, N., 2019. A new co-evolution binary particle swarm optimization with multiple inertia weight strategy for feature selection. Informatics, 6(2), p. 21.
DOI: https://doi.org/10.3390/informatics6020021

[2] Too, J., Abdullah, A.R., Mohd Saad, N. and Tee, W., 2019. EMG feature selection and classification using a Pbest-guide binary particle swarm optimization. Computation, 7(1), p.12.
DOI: https://doi.org/10.3390/computation7010012

Cite As

Too, Jingwei, et al. “A New Co-Evolution Binary Particle Swarm Optimization with Multiple Inertia Weight Strategy for Feature Selection.” Informatics, vol. 6, no. 2, MDPI AG, May 2019, p. 21, doi:10.3390/informatics6020021.

View more styles

Too, Jingwei, et al. “EMG Feature Selection and Classification Using a Pbest-Guide Binary Particle Swarm Optimization.” Computation, vol. 7, no. 1, MDPI AG, Feb. 2019, p. 12, doi:10.3390/computation7010012.

View more styles

Comments and Ratings (7)

Jingwei Too

Dear Ali Sameer,

Yes, you may change the fitness function to perform the regression process. However, I notice that the fitcknn cannot work for regression. You need to learn another learning algorithm in Matlab that can perform the supervised regression. One more thing is that you have to make sure your fitness function is minimization but not maximization. It is also possible for maximization if you make some changes in the code. Hope this help.

Ali sameer

I am very interested with your code. your papers are novel therefore, I would like to use you code for feature selection. My issue is I have a regression issue not classification. Does the attached code can be implemented to deal with regression problems. If yes, please give me any possible details.

regards

Jingwei Too

Dear Umit Kilic,

You mentioned the code block can be added easily by controlling whether the summation of the subset feature is greater than zero or not using the sum() function. Indeed, your way can be implemented. However, there are many ways to do it.

Let denote a feature subset, X=[1, 0, 0, 1, 1, 1];
sum(X==1) you can get the number of features (4). Can you please show me how it causes the error in the small-size dataset? since the solutions are binary then there should be no way the data size can affect to it.

Umit Kilic

A system to check whether the algorithm selects at least one feature or not should be implemented in the jBPSO.m file. For small-size datasets, it produces an error. The code block can be added easily by controlling whether the summation of the subset feature is greater than zero or not using the sum() function.

Sek Kun Leong

eric githua

Tee Wei Hown

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

Community Treasure Hunt

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

Start Hunting!

Binary Particle Swarm Optimization for Feature Selection