tisimst / pyswarm

Particle swarm optimization (PSO) that supports constraints
314 stars 137 forks source link

binary PSO for feature selection #10

Open vaskonov opened 7 years ago

vaskonov commented 7 years ago

I wonder how to implement the binary PSO, where the values of the particles are vectors of 0's and 1's.

It is useful for feature selection, when 0 mean doesn't include the correspond feature for the classification.

tisimst commented 7 years ago

I haven't yet had a chance to consider how the algorithm should handle discrete variables. I agree that it would be very helpful, but for the time being you could include some conditional statements that, for example, force any value x<0.5 to 0 and those that fall into x>=0.5 to be 1. Although not an ideal procedure for choosing discrete values, it might get the job done for you.