#### Abstract

This work presents the use of swarm intelligence algorithms as a reliable method for the optimization of electroencephalogram signals for the improvement of the performance of the brain interfaces based on stable states visual events. The preprocessing of brain signals for the extraction of characteristics and the detection of events is of paramount importance for the improvement of brain interfaces. The proposed ant colony optimization algorithm presents an improvement in obtaining the key features of the signals and the detection of events based on visual stimuli. As a reference model, we used the Independent Component Analysis method, which has been used in recent research for the removal of nonrelevant and detection of relevant data from the brain’s electrical signals and also allows the collection of information in response to a stimulus and separates the signals that were generated independently in certain zones of the brain.

#### 1. Introduction

A brain computer interface (BCI) enables direct communication between a brain and a computer translating brain activity into computer commands, thus providing no muscular interaction with the environment [1]. The development of brain computer interface (BCI) systems is mainly based on the information obtained by processing brain signals obtained by electroencephalogram (EEG). Further to obtaining signals, extraction and feature selection steps are vital for the development of applications; the BCI systems based on steady-state visual evoked potentials (SSVEP) have the advantage over other BCI systems because they have a better signal-to-noise ratio (SNR) and faster transfer rate information (ITR) [2]. Additionally it does not require intensive training and requires fewer EEG channels for application development and immunity from artifacts (flicker, movement joints, etc.) [3, 4]. BCI-SSVEP systems are characterized by using stimuli at different frequencies sensitive to the dynamic processes of the occipital part of the cerebral cortex.

In recent years, algorithms based on swarm intelligence (SI) have recently emerged as a family-based wild populations of ant colony, bees, and swarm individuals algorithms which are capable of producing low give robust computational cost solutions to various complex and optimization problems [5, 6]. The ant colony optimization (ACO) algorithm proposed by Dorigo et al. (1996) is inspired by the foraging behavior of some species of ants. Ants lay pheromones on the ground in order to make a shorter path which eventually will be followed by other members of the colony which increases the probability of other ants following the same path resulting in an optimal way from the nest to the food source. Biologists have shown that many of the behaviors observed at the level of colony of social insects can be explained by fairly simple models in which only communication (called* stigmergy*) is present. The idea behind the ant algorithms is to use some form of artificial stigmergy to coordinate the societies of artificial agents [7].

Deneubourg et al. (1990) proposed the original model Ant Systems (AS). Several different aspects of the behavior of ant colonies have inspired different types of ant’s algorithms, AS Dorigo, et al. (1991), ELITIST AS Colorni et al. (1992), ANT-Q Gambardella and Dorigo (1995), MAX-MIN AS Stützle and Hoos (1996), RANK-BASED AS Bullnheimer et al. (1997), HYPER-CUBE AS Blum et al. (2001) [8].

Recently, ACO has been used in biomedical data processing: Behnam and Pourghassem (2015), brain rhythms detection with periodogram patters; Erguzel et al. (2014), feature selection method for QEEG data classification; Huang et al. (2012), feature selection method to classify hand motion surface electromyography; Korürek and Nizam (2010), clustering analysis of ECG arrhythmias; and Burša and Lhotska (2007), biomedical clustering process.

Resulting research ICA has been used in order to reduce the calculation time by removing and constructing irrelevant and relevant data from electrical brain signals obtained by EEG to improve the performance of BCI systems [11]. In the present work, AS model will be used as an improvement in the EEG signals obtained by visual events and ICA will be used as reference model to evaluate the performance of the proposed method.

#### 2. Background

##### 2.1. Independent Components Analysis (ICA)

ICA was introduced first by Comon (1994), with further developments by Bell and Sejnowski (1995). Hyvärinen (2012) and Acharya and Panda (2009) provide an overview of some recent developments in the ICA theory since 2000 on many fields as neural computing, signal processing, and statistics. In the field of biomedical sciences, Isomura and Toyoizumi (2016) used a local learning rule for ICA to understand the processing of neuronal information through natural images and their applications in neuromorphic engineering. Gramfort et al. (2014) presented a medical-software to help reduce EEG signal artifacts. Mahajan and Morshed (2015); Akhtar et al., Mammone at al., and Safieddine et al (2012) used ICA removal artifact from multichannel EEG data. Oostenveld et al. (2011) presented open source software for advanced analysis of MEG, EEG, and invasive electrophysiological data based on ICA. Kong et al. (2008) used ICA in microarray gene expression data applications. Hung et al. (2005) used it in recognition EEG motor imagery signals. James and Hesse (2004) used it to separate measured multichannel EEG signals. Vigário et al. (2000) and Tang et al. (2002) used it to identify the artifacts and signals of interest obtained by magnetoencephalograms (MEG). Jung et al. (2000 and 2002) used it on EEG signals. Liebermeister (2002) used it to analyze gene expression patterns during the yeast cell cycle and in the identification of human lymphocytes. Martoglio et al. (2002) applied it to ovarian cancer data. Saidi et al. (2004) showed that clustering in the ICA components obtained clusters biologically more reasonably clustered than clusters obtained by PCA (Principal Component Analysis).

It was found that ICA extracts more significant and better interpretable components than PCA, and even an unexpected experimental artifact was discovered. In addition, when applied to enzymatic activities, ICA was able to provide components of greater discrimination and with greater significance than PCA components [10].

Resulting research ICA has been used in order to reduce the calculation time by removing and constructing irrelevant and relevant data from electrical brain signals obtained by EEG to improve the performance of BCI systems [11].

ICA is a method based on the* statistical independence* of the components that form a signal. Statistical independence is the main idea for the entire construction of the method, since we want to find within our mixed signals those that are statistically more independent than the others [9]. Statistical independence is defined as follows: let be a set of random variables with probability density function (PDF) ; these variables are mutually independent ifwhere is the marginal density function of (Figure 1).

Let a vector of components; we assume that this vector is produced as a linear combination (mixture) of independent signals denoted by . We will assume for the implementation of the algorithm that each of the signals is statistically independent of the other signals; thenwhere the coefficients determine a matrix that is known as a mixture matrix, the vector as the vector of mixtures, and the vector of independent components, so we can define the system asFigure 2 shows the relationship of (3).

Consider that the mixing components take values that allow to be invertible (Figure 2). There exists a matrix , with coefficients such that it will allow us to separate the signals aswhich we can define aswhere

ICA method consists of applying an algorithm that allows us to find the matrix in such a way as to be a good approximation of the vector [9, 12].

##### 2.2. Ant Colony Optimization (ACO)

The ant colony optimization algorithms are part of swarm intelligence (SI), which is the field of research that studies algorithms inspired by the social behavior of the insects and other animals. Algorithms based on swarms have recently emerged as a family of algorithms based on nature populations that are able to produce, at low cost and fast robust solutions to various complex problems and optimization [5, 13, 14], as well as some applications of grouping of data [15–18].

Ant colonies and, in general, groups of social insects, despite the simplicity of their individuals, have a highly structured social organization. Because of these organizations, ant colonies can perform complex tasks that in some cases far outweigh the individual capacities of a single ant. The fields of “ant algorithms” are models of studies derived from the observation of the behavior of real ants and these models are used as a source of inspiration for the design of new algorithms for optimization solution and distributed control problems [7].

The main idea is that the principles of self-organization that allow the highly coordinated behavior of real ants can be exploited to coordinate populations of artificial agents that collaborate to solve computational problems. Several different aspects of the behavior of ant colonies have inspired different types of ant algorithms: search for food, division of labor, classification of breeding, and cooperative transport. In all these examples, the ants coordinate their activities through stigmergy, a form of indirect communication by a slight modification of the environment. In the search for food, the ant deposits a chemical (called pheromone) in the soil, which increases the likelihood that other ants will follow the same path. Biologists have shown that many of the behaviors observed at the social insect colony level can be explained through simple models in which only stigmergy communication is present. The idea behind ant algorithms is to use some form of artificial stigmergy to coordinate artificial agent societies [7].

Recently, SI algorithms have been used in biomedical data processing of biomedical data such as EEG and electrocardiogram (ECG) [19–22]. For instance, Cheng et al. (2016) used ACO for reconstructing ECG signals; Salem et al. (2014) used ant colony (AC) for the detection of epileptic seizures on EEG signals. Erguzel et al. (2014) used ACO as a method of classifying data in quantitative EEG signals. Korürek and Nizam (2010) used ACO for clustering MIT-BIH arrhythmias; Burša and Lhotska (2006) used AC and ACO as ECG interpretation.

The first proposed algorithm within the ACO metaheuristic was the Ant System (AS) to solve the Travel Agent Problem (TSP) problem in which we search for the optimal route between a set of cities that the traveler must visit only once and return to the starting point.

##### 2.3. Ant System (AS)

The first proposed algorithm within the ACO metaheuristic was the Ant System (AS) to solve the Travel Agent Problem (TSP) problem in which we search for the optimal route between a set of cities that the traveler must visit only once and return to the starting point.

Formally the TSP can be represented by a weighted complete graph , where is a set of nodes representing cities and the set of arcs between cities. Each arc is assigned a weight (length) which is the distance between city and city , with . The objective in the TSP is to find a Hamiltonian circuit of minimum length of the graph [7]. An optimal solution for the TSP is a permutation of the indexes of nodes such that is minimal, where is defined byIn the AS algorithm, ants are placed in different random cities that simultaneously construct a path for the TSP. Each ant constructs a feasible solution to the problem by applying an iterative probabilistic transition rule called* proportional random rule* to decide which city to visit next. The probability with which the ant that is currently in the city chooses to go to the city iswhere , and , determine the relative influence of the pheromone and the heuristic information, respectively, is the set of neighboring cities the ant* k*, being in city , has not visited, and the probability of choosing a city outside is 0.

Based on (7) the probability of choosing a particular arc increases with the value of the pheromone associated with the trail. Once all the ants have built a complete tour, the pheromone trail is updated; this is done first by reducing the value of the pheromone in all arcs by a constant factor, and then add pheromone in the arcs that the ants have crossed on their path. The pheromone evaporation is calculated according towhere and is the evaporation rate of the pheromone. The parameter is used to avoid the unlimited accumulation of pheromones in the trail and allows the algorithm to “forget” the bad decisions made previously. If associated value of pheromones decreases, the ants do not choose an arc exponentially based on the number of iterations. After evaporation, all the ants deposit pheromones in the bows they have crossed on their tour:where is the amount of pheromone deposited in the arc by the ant . is calculated as represents the length of the trail constructed and is a constant of generation of pheromone [6, 23, 24] (Figure 3).

#### 3. Materials and Methods

##### 3.1. Statement of Ethics

For the development of the evidence contained herein, they asked all participants to read and sign an informed consent form and a written letter of confidentiality for information management before participating in this study. The study protocol was based on the manual “Ethics of Scientific Research” at the Autonomous University of Queretaro [25].

##### 3.2. Experimental Protocol

Twenty-nine healthy volunteers, 17 men and 12 women, aged 20-29 and 48-50, participated in the experiment. 17 of them with normal vision and 12 corrected vision. The EEG signals were obtained by a portable, high-resolution multibrand equipment, Emotiv Epoc+ EEG model. The equipment has 16 electrodes, 14 data channels and 2 reference channels, which were placed in the standard positions of the international 10-20 system (Figure 4). The transfer rate is 128 bps of a frequency response from 0.16 to 43 Hz with 14 to 16 bit resolution and dynamic range of +/- 4.17mV per channel.

During the experimental trials, the study subjects were seated in a comfortable chair to 70 cm apart from a standard 15-inch LCD monitor (with a screen resolution of 1024 x 768 and a refresh rate of 60 Hz).

##### 3.3. Experiment

The experiment is based on tests performed visual discrimination by Makeig et al. (1999) for the study of BCI systems based SSVEP. The objective of the tests is to obtain data related stimuli in the brain signals during an exercise of simple attention; search to find the difference between attention-related and unrelated stimuli. The test subjects must discriminate between different types of stimuli that are presented at high speed.

Study subjects set their gaze on a cross, which is on top of one five boxes at a time that are constantly displayed (Figure 5). Each test block last for 76 s with approximately 5 s initial preparation. Stimuli presented as a series of red circles are briefly presented in any of the five boxes in a random order. The boxes are blue and one is green. The location of the latter is random during test periods. The stimuli presented within the green box are attended stimuli (events); stimuli within the blue boxes are known as unattended stimuli.

Before starting the test, the subject is asked to concentrate whenever a red circle appears in the green box [26]. The outlines of the pictures are of 1.6 cm, displayed on a black background horizontal viewing angles 0° ± 2.7° to ± 5.5°, and fixed. Each stimulus is displayed for 117 ms to one of five empty spaces inside the boxes with a pseudo-random sequence. Stimuli are presented to the subject in a random position of 250 ms, 500 ms, 750 ms, and 1 s, intervals between stimuli (ISI) between 250 and 1000 ms (Figure 6). At the beginning of the test, a black screen is presented for 5 s for the stabilization of the signals; the test begins with the configuration shown in Figure 7(a). In each test, a total of 100 stimuli are presented in total: 20 attended (events) 80 unattended (Figures 7(b) and 7(c), respectively), the last 200 ms stimulus remains on the screen before disappearing [27].

**(a)**

**(b)**

**(c)**

##### 3.4. Proposed Model

Figure 8 shows the classical model ICA, where two signals, in this case O1 and O2, are mixed (Figure 8(a)), the independent components of the mixture are obtained, and then a reconstruction of the signal is made based only on the found independent components (Figure 8(b)).

**(a)**

**(b)**

Figure 9 shows block diagram of proposed model based on the implementation of the ant colony optimization algorithm, described in Section 2.3 to the signals derived from EEG, based on an SSVEP-based BCI system.

**(a)**

**(b)**

After acquisition, signals from EEG, the electrodes O1 and O2, which are directly related to the visual processing of the brain signals, are selected. These signals are postprocessed using the proposed ACO algorithm to obtain an optimized signal (ACO-O1O2), Figure 9(a). Subsequently a mixture of the original signals (O1/O2) is performed separately, with the optimized signal ACO-O1O2, its mean mixture O1 with ACO-O1O2, and mixture O2 with ACO-O1O2. The ICA model, described in Section 2.1, is applied to the mixed signals to obtain its independent components.

Finally, the signal is reconstructed based on the independent components obtained, as shown on Figure 9(b). To establish the performance of the proposed model, a comparison of the original reconstructed signals (O1/O2) with the reconstructed signals using the ACO model is performed. Figure 10 showed flowchart proposed model.

##### 3.5. Optimization Model

The optimization of the EEG signals is based on the solution of Dorigo and Gambardella (1997), Ant System (AS), to solve the TSP. The optimization model of the present work is shown in Figure 11, as well as the algorithm implemented in Figure 12.

Illustratively, consider a pair of segments of the O1 and O2 signals (Figure 13) with 20 data points each, which represent the cities for a total of 40 cities. Consider the set of cities as and the distance (the cost of the edge) between the cities . Explicitly, cities can be seen as points of a 2-dimensional space, so we can represent them as and . The distance between cities is calculated by means of the Euclidean distance defined asWe define the matrix of nodes formed by the order of the points in the sequence of the signal and the values of the points of each signal (Figure 14). To the graph , , is a matrix of dimension defined by (Figure 15), which represent the set of distances between the respective points and (Figure 16). Figure 17 shows the graph obtained.

We define the probability matrix (probs) as the matrix that represents the probabilities of traversing an arch between nodes (Figure 18(a)). The pheromone matrix is the matrix that represents the amount of pheromone deposited by each ant as it passes through a city (Figure 18(b)). Figure 18(c) shows the representation of the route matrix (tours) that indicates the nodes visited by each ant based on the probability matrix.

**(a)**

**(b)**

**(c)**

Figure 19 represents the simulation of the path of two ants during 5 iterations and Figure 20 represents the flowchart algorithm.

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

#### 4. Results and Discussion

The computational simulation of the proposed model was developed in MATLAB V9.1.0441655 (R2016b), as well as EEGLAB V13.6.b. Figure 21(a) shows a segment of 5 s of the original signals O1 and O2 obtained from EEG. The ACO parameters used to experiment were pheromone generation constant , influence parameter , attractive parameter , pheromone evaporation parameter , amount of ants 20, and number of iterations for the tours 5. The optimization signal obtained with the ACO algorithm is showed in Figure 21(b). Test durations were approximately 65-72 s.

**(a)**

**(b)**

The representation of the mixture of the original signals as well as the histogram of each source signal, which approximates the PDF representation of the signals, is shown in Figures 22 and 23, respectively; Figure 24 showed the independent components (IC1, IC2) obtained from ICA process.

Based on ICA model, Figure 25 shows the original signals O1, O2 and the result of mixing them to obtain the reconstructed signal. We can observe that, for the present example, the reconstruction of the electrode O1 is very similar to the original; in the case of O2, we can appreciate the loss of some elements of the original signal.

The comparison of the original signals with the reconstructed signals generated by mixing the signals O1 and O2 with the optimized signal ACO is shown in Figures 26 and 27, respectively. We can observe in both cases less loss of elements in the reconstructed signals.

After ICA process, we can observe in the histograms of Figure 28 that in IC2 the dispersion is much smaller in the case of the mixtures with ACO (Figures 28(b), 28(d), and 28(f)), and in the case of IC1, the dispersion is similar (Figures 28(a), 28(c), and 28(e)), where we can interpret that the mixture of ACO concentrates more elements of the signal.

**(a)**

**(b)**

**(c)**

**(d)**

**(e)**

**(f)**

Figure 29 shows the power spectrum density (PSD) for the ICA components at each electrode for the study mixtures, more specifically for the corresponding frequency to the stimuli performed (0.895 Hz). The PSD in the IC1 component behaves similarly for O1 in all mixtures (Figures 29(a), 29(b), and 29(c)); however, for O2 the power is higher for mixtures with ACO (Figures 29(b) and 29(c)). The higher the power, the greater the probability of finding the stimulus frequency. In Figure 30 we observed the stimulus frequency (0.895 Hz), and its harmonics (1.79, 2.685, 3.58,...) are present in all the signals generated by the study, which implies that the components retain one of the main features of the signal. The spectrograms in Figure 31 show that the stimulus frequency manifests in all signals, both original and reconstructed.

**(a)**

**(b)**

**(c)**

Table 1 shows the results obtained from the implementation of the ICA model. The ORIGINAL column represents the mixture of the original signals and the EXTRACT column the signals reconstructed from independent components. The values shown represent the correlation between the signals (1 would represent that a signal is identical to another).

Comparing the original O1-O2 signals mixed with the ACO signal, we have 82.76% better correlation O1-ACO versus O1-O2, 10.34% with equal correlation, and only 6.9% better correlation between O1-O2 (Figure 32(a)). We have 86.2% better correlation between O2-ACO versus O1-O2 and a 13.8% better correlation between O1-O2 (Figure 32(b)).

**(a)**

**(b)**

**(c)**

**(d)**

In the case of reconstructed signals, we have an 82.76% better correlation in O1-ACO versus O1-O2, 6.9% with equal scores, and a 10.34% better correlation in O1-O2 (Figure 32(c)). We obtain an 86.2% better correlation of O2-ACO versus O1O2 and only a 13.8% better correlation between O1-O2 versus O2-ACO (Figure 32(d)).

The results of the correlation of the signals show that the signals optimized with ACO, either in the original signals or in the reconstructed signals, present better characteristics in the selection of components than in the original signals without optimizing.

In Figure 33, we can see that 24 of 29 users in O1 and 24 of 29 users in O2 obtained a better signal reconstructed using the optimization signal ACO (1 mean identical signals). Three users with the same result are shown in O1 and 2 users in O2, and only 2 in O1 and 3 in O2 where the use of the O1 and O2 signals show an improvement in the reconstruction.

#### 5. Conclusions

The methods inspired by swarm intelligence can be applied in many stages of the process of biomedical data processing; in this work, we have presented techniques inspired by the ants with respect to the processing of EEG signal data. We have presented and evaluated the AS method to obtain optimized signals that can be used to extract its characteristics and improve the characteristics of the original signals.

The results obtained show a good optimization capacity when treating the set of EEG signals as a TSP problem solved with ACO; applying our proposal to real biomedical datasets allows us to search methodologies that improve the performance of the applications. Our experimental results demonstrate an improvement in the obtaining of optimized signals. The use of IS-based methodologies in biomedical signals is a new branch that must be exploited in the future.

#### Conflicts of Interest

The authors declare that there are no conflicts of interest regarding the publication of this paper.

#### Acknowledgments

The authors acknowledge the support received from the National Institute of Technology of México, Campus Institute of Technology of Queretaro, and the Autonomous University of Queretaro for the accomplishment of the present work.