# An Improved Brain-Inspired Emotional Learning Algorithm for Fast Classification
## 3 Implementation
### GA-BEL Algorithm  
In this paper, GA is adopted to optimize the initial weights and biases of amygdala and orbitofrontal cortex in the BEL neural network. There are three steps in GA-BEL for classification. * Step 1: Chromosome encoding. For the advantages of high precision, in this paper, real encoding is adopted to acquire optimal results. One real number string presents one chromosome, which consists of the connection weights and bias of orbitofrontal cortex and amygdala. According to the structure of the BEL neural network, each chromosome is initialized as follows: \[Ch=[w_{1},...,w_{m},b_{o},v_{1},...,v_{m+1},b_{a}]\] (8) where \(w_{i}\) and \(b_{o}\) represent orbitofrontal cortex weights and biases, respectively. \(v_{1}\) and \(b_{a}\) represent amygdala weights and bias, respectively. The values of them are usually chosen in \([-1,1]\). \(m\) is the number of input features; thus, the number of genes in each chromosome is \(2m+3\). * Step 2: Optimization. The value of individual fitness can be calculated by the fitness function. The most optimal fitness value corresponding to the best individual can be found by the selection, crossover and mutation in GA.  
(1) Fitness function:  
The fitness function is used to evaluate the adaptability of each individual in the whole population, and the individual fitness will provide reference to selection operation. As a consequence, we select the sample variance as the evaluation criteria of weights, and the fitness function is defined as:  
\[Fitness(Ch_{k})=\frac{1}{n}\sqrt{\sum\limits_{k=1}^{n}{(E_{k}-T_{k})^{2}}} \tag{9}\]  
where \(E_{k}\) is the response to the \(k\)-th input pattern with given weights in \(Ch_{k}\), which can be calculated by Equation (7). \(T_{k}\) is the target value; \(n\) is the number of pattern-targets. On the definition of the fitness function, the minimum output of the fitness function means the minimum total error for all training samples. Thus, the overall goal of genetic operators is to find the minimum value of the fitness function. (2) Selection:  
The selection operation can choose better individuals for the subsequent iteration. There are several methods of selection in GA, such as the roulette wheel method, the championship method, the optimum maintaining strategy, etc. [24]. In this study, according to the definition of the fitness function, we adopt the roulette wheel method based on the fitness ratio, for the method works by selecting chromosomes with a higher probability of survival, it is intuitive and widely used in GA. According to the definition of the fitness function, the selection probability \(p_{i}\) for each individual \(i\) is:  
\[\left\{ \begin{array}{l}f_{i}=k/F_{i}\\ p_{i}=f_{i}/\sum\limits_{j=1}^{n}{f_{j}}\end{array} \right. \tag{10}\]  
where \(F_{i}\) is the fitness value of individual \(i\), \(k\) is the coefficient and \(n\) is the number of individuals in a group. (3) Crossover:  
To enlarge the diversity and searching space, the crossover operation is used to produce two new individuals by exchanging information between the parent individuals. For crossover mechanisms, single-point crossover, two-point crossover, arithmetic crossover and multipoint crossover are reported [24]. This paper uses a real coded GA strategy in chromosomes. Here, arithmetic crossover is adopted; it is a method with high precision. The rule is given as follows [25]:  
\[\left\{ \begin{array}{l}c_{i}^{k}(n+1)=\alpha c_{i}^{k}(n)+(1-\alpha)c_{j}^{k }(n)\\ c_{j}^{k}(n+1)=\alpha c_{j}^{k}(n)+(1-\alpha)c_{i}^{k}(n)\end{array} \right. \tag{11}\]  
where \(c_{i}^{k}\) and \(c_{j}^{k}\) represent the chromosomes for which occur crossovers in the \(k\)-th bit, \(n\) denotes the number of iterations and \(\alpha\) is a random number uniformly distributed in [0, 1]. (4) Mutation:  
To further enhance the local search capability of GA, mutation is another way to create new individuals. The mutation operation is needed to change one or some gene values of the chromosome.