# An Improved Artificial Bee Colony for Feature Selection in QSAR
## 4 The Proposed Method  
### The Basic Artificial Bee Colony Algorithm  
ABC is a swarm intelligence algorithm that simulates the foraging behavior of a honey bee colony [32]. It has been used widely in many fields for solving optimization problems [62]. In the hive, three types of bees are assigned to the foraging task: employed bees, onlooker bees, and scout bees. Employed bees use the previous source information to find better food sources and share the information with onlooker bees. Onlooker bees waiting on the hive exploit a source with the help of the information shared by employed bees. Scout bees search for undiscovered sources based on an internal rule or possible external clues. The basic implementation of ABC is as follows:  
(1) Initialization phase: From the perspective of an optimization problem, each food source represents a probable solution which is described as a vector: \(X=(x_{i,1},x_{i,2},\ldots,x_{i,D})\), and is generated by Equation (4):  
\[x_{i,j}=x_{j}^{min}+rand(0,1)(x_{j}^{max}-x_{j}^{min}) \tag{4}\]  
where \(i=1,2,\ldots,SN\) and \(SN\) is the number of the food source. \(j=1,2,\ldots,D\) and \(D\) is the dimensionality of the search space. \(x_{i,j}\) is the \(j\)th dimension of \(x_{i}\). \(x_{j}^{max}\) and \(x_{j}^{min}\) are the maximum and minimum boundary value, respectively.  
(2) Employed bee phase: Each employed bee is associated with a food source. Employed bees need to modify the position of their food source to find new better ones. Thereby, they learn from a neighbor source which is selected randomly among all sources except for itself. The new food source is produced by Equation (5):  
\[x_{i,j}^{\prime}=x_{i,j}+\phi_{i,j}(x_{i,j}-x_{k,j}) \tag{5}\]  
In the above formula, \(\phi_{i,j}\) is a uniformly distributed random value within [\(-\)1,1]. After \(x_{i}^{\prime}\) is produced, its fitness value can be evaluated according to Equation (1). Then, a greedy selection is applied to the selection between \(x_{i}^{\prime}\) and \(x_{i}\). Specifically, if \(f(x_{i}^{\prime})>f(x_{i})\), \(x_{i}^{\prime}\) replaces \(x_{i}\) to enter the next iteration and its counter holding, the number of trials is reset to 0. Otherwise, \(x_{i}\) is kept into the next iteration and its counter holding the number of trials is increased by 1.  
(3) Onlooker bee phase: After getting the information concerning nectar amount (fitness value) and positions of food sources from employed bees, each onlooker bee selects a food source according to the fitness values by a roulette-wheel scheme, where the better the fitness value of the source, the higher the probability of being selected. The probability value of each food source is calculated by Equation (6):  
\[P_{i}=\frac{fitness_{i}}{\sum_{j=1}^{SN}fitness_{j}} \tag{6}\]  
After calculating the probability value of each source, a random number \(rand(0,1)\) is generated to determine whether to be chosen. If \(P_{i}>rand(0,1)\), \(x_{i}\) is chosen to update just as in the employed bee phase.  
(4) Scout bee phase: Each source has a counter which is zero at the beginning. If the counter holding the number of trials exceeds the predefined threshold value, its corresponding food source will be abandoned and replaced by a new food source, which is generated by Equation (4).