# EEG Feature Extraction Using Genetic Programming for the Classification of Mental States
## 3 Proposed Enhanced System
### Augmented Feature Extraction with Genetic Programming: \({}^{+}\)Fegp
Here, we proposed the following equations to mimic the behavior of the aforementioned algorithm: \[p_{InterC}(gen) =-\Delta_{InterC}\frac{log(gen)}{log(gen_{max}+1)}\] \[\qquad+\hat{p}_{InterC},\] (11) \[p_{K^{+}}(gen) =\frac{-sin(\frac{100\pi}{gen_{max}}+2.5)}{\frac{40(gen+\frac{50 \pi}{100})}{gen^{2}}}+0.25,\] (12) \[p_{K^{-}}(gen) =1-p_{InterC}-p_{InterF}-p_{IntrC}\] Figure 6:0 (13) where \(gen\) is the current generation, \(gen_{max}\) is the maximum generation number, \(-\Delta_{InterC}\) is a decay parameter, and \(\hat{p}_{InterC}\) is an initial probability. In preliminary tests, it was found out that, only in the earlier generations, a high probability for the inter-crossover operator was required, mainly to promote the exchange of genetic material and allow the algorithm to do a more efficient search. In more advanced stages of the evolutionary process, this operator produced a negative effect in the search by curtailing the ability of the algorithm to perform exploration. As a countermeasure to this phenomenon, the selection probability for this operator is reduced. Two of the most important operators are the feature insertion and removal mutations. Indeed, these are the ones responsible for the flexibility of the new feature space size. There is a higher probability that the hyperplane of the classifier has a good class separability when the number of dimensions is high. A high probability for the generation of new features (\(p_{K^{+}}\)) at the start of the run promotes the search for the most promising size of the new feature space. The ratio between these operators and the static ones decreases after the initial generations, giving more importance to the evolution of the solutions without changing the feature space too much. Because evolved models stagnate at the end of the run, increasing the feature space size is required once more. Moreover, \(p_{K^{-}}\) (features removal) is seen as the complementary part of \(p_{K^{+}}\) and \(p_{InterC}\). The operator functions are plotted in Figure 12 for the case that \(gen_{max}=50\). 5. **Fitness calculation. ** The fitness is computed by a local and a global measure, which are used differently by the search. More specifically: 1. Local fitness measure (Fisher's Discriminant Ratio). This is computed at the subtree level, which provides a separability value for each constructed feature. Certainly, the quality of a solution depends on the quality of their individual features. The local measure \(f^{\prime}\) is only used as the criterion for the inter-crossover subtree selection, that is, crossover points are selected within the subtrees with the best local fitness. Although the GP selection process chooses two individuals with similar fitness rank, it does not guarantee that all individual subtrees have a good performance. The goal is for the crossover to exchange features that show good performance in terms of class separation. This is given by Figure 6:1 (14) where \(\mu_{\text{C1}}\), \(\mu_{\text{C2}}\), \(\sigma_{\text{C1}}\), and \(\sigma_{\text{C2}}\) are the means and standard deviations corresponding to class one and two for the \(i\)th feature [61]. For any given tree \(K\), \(r\) local fitness measures are calculated. It was found that the use of the local fitness in other operators did not help the search. 2. Global fitness measure. The calculation of global fitness is the result of a two-tier process. In the first level, an initial regularization is performed over the tree output using the training data; then, the classification accuracy (\(Acc\)) is calculated. In detail, this is done by artificially changing the covariance of transformed training data (i.e., the training data in the new feature space created by an evolved transformation), defined by  
Figure 6:2 Operator probabilities through the search.