Skip to content

JingweiToo/Particle-Swarm-Optimization-for-Feature-Selection

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Particle Swarm Optimization for Feature Selection

View Particle Swarm Optimization for Feature Selection on File Exchange License GitHub release

Wheel

Introduction

  • This toolbox offers a Particle Swarm Optimization (PSO) method
  • The Main file illustrates the example of how PSO can solve the feature selection problem using benchmark data-set.

Input

  • feat : feature vector ( Instances x Features )
  • label : label vector ( Instances x 1 )
  • N : number of particles
  • max_Iter : maximum number of iterations
  • c1 : Cognitive factor
  • c2 : Social factor
  • w : Inertia weight

Output

  • sFeat : selected features
  • Sf : selected feature index
  • Nf : number of selected features
  • curve : convergence curve

Example

% Benchmark data set 
load ionosphere.mat; 

% Set 20% data as validation set
ho = 0.2; 
% Hold-out method
HO = cvpartition(label,'HoldOut',ho);

% Parameter setting
N        = 10;
max_Iter = 100;
c1       = 2;     % cognitive factor
c2       = 2;     % social factor
w        = 1;     % inertia weight

% Particle Swarm Optimization
[sFeat,Sf,Nf,curve] = jPSO(feat,label,N,max_Iter,c1,c2,w,HO);

% Plot convergence curve
plot(1:max_Iter,curve);
xlabel('Number of iterations');
ylabel('Fitness Value');
title('PSO'); grid on;

Requirement

  • MATLAB 2014 or above
  • Statistics and Machine Learning Toolbox