# Constructing Features Using a Hybrid Genetic Algorithm
## 2 Method Description
### Feature Construction  
The first phase of feature construction presented below has also been used as a feature construction mechanism in the initial work of [PERSON] et al. [40]. In this phase, a genetic algorithm constructs new features from the original and the training error of an RBF network on the dataset created with the new features is used. The steps of the algorithm for the first phase are:  
1. **Initialization step** 1. **Set** iter = 0, generation number. 2. **Construct** the set \(\text{TR}=\left\{\left(\overrightarrow{x_{1}},y_{1}\right),\left( \overrightarrow{x_{2}},y_{2}\right),\ldots,\left(\overrightarrow{x_{M}},y_{M} \right)\right\}\), which is the original training set. 3. **Set**\(N_{c}\) as the number of chromosomes and \(N_{f}\) as the number of desired constructed features. These options are defined by the user. 4. **Initialize** randomly in range \([0,255]\) the integer chromosomes \(Z_{i},i=1\ldots N_{c}\) 5. **Set**\(N_{g}\) as the maximum number of generations allowed. 6. **Set**\(p_{s}\in[0,1]\) as the selection rate and \(p_{m}\in[0,1]\) the mutation rate. 2. **Termination check. If** iter \(\geq N_{g}\)**go to** step 6. 3. **Estimate** the fitness \(f_{i}\) of every chromosome \(Z_{i}\) with the following procedure: 1. **Use** the procedure described in Section 2.1 and create \(N_{f}\) features. 2. **Create** a modified training set : \[\text{TN}=\left\{\left(G\left(\overrightarrow{x_{1}},Z_{i}\right),y_{1}\right),\left(G\left(\overrightarrow{x_{2}},Z_{i}\right),y_{2}\right),\ldots,\left( G\left(\overrightarrow{x_{M}},Z_{i}\right),y_{M}\right)\right\}\] (7)  
Figure 1: BNF grammar of the proposed method.  
**Train** an RBF neural network \(C\) with \(H\) processing units on the modified training set TN using the following train error:  
\[f_{i}=\sum_{j=1}^{M}\bigl{(}C\bigl{(}G\bigl{(}\overrightarrow{x}_{j}^{\prime},Z _{i}\bigr{)}\bigr{)}-y_{j}\bigr{)}^{2} \tag{8}\]  
**Genetic Operators**  
**Selection procedure:** initially, the chromosomes are sorted according to their fitness value. The best chromosomes are placed in the beginning of the population and the worst at the end. The best \((1-p_{s})\times N_{c}\) chromosomes are transferred to the next generation intact. The remaining chromosomes are substituted by offspring created through the crossover and mutation procedures.
**Crossover procedure:** in this process, for every produced offspring, two mating chromosomes (parents) are selected from the previous population using tournament selection. Tournament selection is a rather simple selection mechanism defined as: first a set of \(K>1\) randomly selected chromosomes is constructed and subsequently the chromosome with the best fitness value in the previous set is selected as the mating chromosome. Having selected the two parents for the offspring, the offspring is formed using the one point crossover. In one-point crossover, a random point is selected for the two parents and their right-hand side subchromosomes are exchanged.
**Mutation procedure:** for every element of each chromosome, a random number \(r\in[0,1]\) is taken. If \(r\leq p_{m}\), then this element is randomly altered by producing a new integer number.  
**Set** iter = iter+1 and **go to** Step 2.  
**Get** the best chromosome in the population defined as \(Z_{l}\) with the corresponding fitness value \(f_{l}\) and **Terminate**.