I'm trying to use the Binary Flower Pollination Algorithm (BFPA) for feature selection. In the BFPA, the sigmoid function is used to compute a binary vector that represents whether a feature is selected or not. Here are the relevant equations from the paper (page 4).

$$ S\left(x_{i}^{j}(t)\right)=\frac{1}{1+e^{-x_{i}^{j}(t)}} \tag{4}\label{4} $$

\begin{equation} x_{i}^{j}(t)=\left\{\begin{array}{ll} 1 & \text { if } S\left(x_{i}^{j}(t)\right)>\sigma \\ 0 & \text { otherwise } \end{array}\right. \tag{5}\label{5} \end{equation}

In my case, I noticed that my algorithm sometimes returns a zero vector (i.e. all elements are zeros, such as $[0,0,0,0,0,0,0,0,0]$), which means that no feature is selected (a feature would be selected when it is $1$), which makes the fitness function returns an error.

Is it correct that sigmoid returns result like that?

  • $\begingroup$ Which $\sigma$ are you using in your case? Clearly, if $\sigma$ is very big, then it's possible that most features will not be selected, according to formula 5. $\endgroup$ – nbro Jan 12 at 18:37
  • $\begingroup$ σ is a random value between 0 and 1 .. $\endgroup$ – Adnan Hussein Jan 13 at 6:09
  • $\begingroup$ If you have a link to a Github repository that contains your implementation of the BFPA algorithm, it may be a good idea to edit your answer and provide such a link. However, note that programming issues are off-topic here. I'm suggesting you to include the link in case someone wants to take a look at the source code for more info. $\endgroup$ – nbro Jan 13 at 9:53
  • $\begingroup$ unfortunately, I didn't put it at Github yet,,, I am just asking about sigmoid function, Is it possible to return a zero vector like what I explained in my question? or it always returned at least one selected feature? $\endgroup$ – Adnan Hussein Jan 13 at 13:23
  • $\begingroup$ It's not clear to me if you're getting a zero vector after the sigmoid or after the threshold operation (operation 5). Can you clarify this? $\endgroup$ – nbro Jan 13 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.