An electroencephalogram signal separation method based on genetic algorithm and fast independent component analysis
By combining genetic algorithms and FASTICA, and introducing the non-uniform mutation algorithm of PSO, the EEG signal separation method is optimized, which solves the problem that the traditional method does not have unique signal separation under high-dimensional non-Gaussian distribution, and achieves more efficient signal separation and noise reduction.
Patent Information
- Application Number
- CN202111271574.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-29
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2041-10-29
AI Technical Summary
Existing signal processing methods struggle to accurately separate the desired source signal from complex mixed EEG signals, especially in the case of high-dimensional non-Gaussian distributions. Traditional PCA and ICA algorithms cannot effectively solve the signal crosstalk problem, resulting in non-unique separation results.
By combining genetic algorithms and Fast Independent Component Analysis (FASTICA), and introducing a non-uniform mutation algorithm based on particle swarm optimization (PSO), the selection, crossover, and mutation processes of the genetic algorithm are optimized. Furthermore, by combining the FASTICA algorithm and using the objective function of maximizing negative entropy, the update mechanism of matrix W is improved, thereby enhancing the convergence and separation efficiency of the algorithm.
It improves the speed and quality of EEG signal separation, achieves more efficient signal separation, and can accurately extract the required source signal from complex environments and reduce noise.
Smart Images

Figure CN113935382B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of computer application, and particularly relates to an electroencephalogram signal separation method based on a genetic algorithm and fast independent component analysis, which is used for electroencephalogram signal separation or information noise reduction. BACKGROUND
[0002] At present, in the field of signal processing, an important research direction is signal source separation, which is mainly to separate the desired source signal from a mixed data system. In the modern increasingly complex signal environment, it is more and more difficult to extract the desired signal from complex and numerous mixed signals. The signals received by people are often many unknown, different distance and randomly mixed observation signals, however, the traditional way is difficult to handle such problems, and cannot accurately obtain the truly needed signal. In this background, in 1986, Jutten and Herault proposed an adaptive algorithm to complete the separation of two mixed source signals, and in 1991, an important article on blind source separation was published, which made great progress in the research on blind source separation. In 1994, Comon analyzed the separation of electroencephalogram signals and clearly proposed the concept of independent component analysis (ICA), and then a large number of new algorithms about ICA were generated. Blind source separation as a hot topic has made great research and development in many fields, such as speech signal processing, biomedical signal processing, image processing, noise reduction processing, array signal processing and the like.
[0003] In real life, many brain diseases are characterized by repeated super-synchronous discharge of brain nerve cell groups, causing paroxysmal, sudden and transient brain function disorders, which brings great inconvenience to the life of patients. Electroencephalogram examination is a commonly used technology for checking various brain diseases in clinic, and the types of brain diseases can be analyzed through electroencephalogram. However, the human body is a complex network system, and the electroencephalogram signal will inevitably be disturbed by some irrelevant electrophysiological signals, and the brain electrical signals of different channels may also exist mutual crosstalk, which makes the brain electrical signal of each channel finally show a kind of aliasing signal. In order to solve the inconvenience of crosstalk phenomenon to the analysis of electroencephalogram, blind source separation of electroencephalogram signal is a hot spot.
[0004] People usually use the method of PCA (principal component analysis) to reduce the dimension of the signal source, but this method is usually used to process high-dimensional data to two dimensions, mainly according to the size of the variance to extract features, only considering the second-order statistics of variance, and when facing high-dimensional non-Gaussian distribution sample data, PCA cannot reduce the dimension, but ICA can effectively solve this problem. Taking two-dimensional as an example, if two groups of data are Gaussian distribution, then the result of ICA will not be unique. The steps of ICA processing data are: 1. Whitening, making the signal uncorrelated and having the same variance; 2. Rotation, making the output signal not only uncorrelated but also independent of each other. When two groups of data are Gaussian distribution, the joint distribution graph of the output signal after whitening presents a more symmetric image, so no matter how the output signal is rotated, the two signals are independent of each other. This leads to the result of ICA being not unique. When two groups of data are non-Gaussian distribution, the joint distribution graph of the output information after whitening is not related and independent, and after a certain angle of rotation, the image symmetry is achieved, so that the ICA result is unique.
[0005] FASTICA algorithm is also called fixed point algorithm, which is a kind of fast optimization iteration algorithm, using batch processing method. Based on the fastica algorithm of maximum negative entropy, it takes the maximum negative entropy as a search direction, can realize the extraction of independent source in sequence, fully embodies the traditional linear transformation idea of projection pursuit. In addition, the algorithm uses fixed point iteration optimization algorithm, which makes the convergence more rapid and robust, and has good effect on the separation of electroencephalogram signal.
[0006] The non-uniform mutation algorithm based on PSO can introduce the advantages of PSO algorithm into non-uniform mutation, use the PSO idea to constantly approach the local optimal solution after each iteration, and the local optimal solution approaches the global optimal solution, which can effectively enhance the convergence of the algorithm.
[0007] The combination of the non-uniform mutation algorithm based on particle swarm optimization PSO and genetic algorithm (GA) and the fast independent component analysis FASTICA algorithm can improve the speed of electroencephalogram signal separation and the convergence of the algorithm, and improve the quality of electroencephalogram signal separation.
[0008] Symbol description
[0009] SUMMARY
[0010] To achieve accurate and rapid separation of brainwave signals, quickly and effectively extract the required source signals from complex environments and complex brainwave signals, and perform noise reduction processing, this invention proposes a brainwave signal separation method based on genetic algorithms and rapid independent component analysis.
[0011] The present invention comprises the following steps: a method for separating electroencephalogram (EEG) signals based on genetic algorithms and rapid independent component analysis, comprising the following steps:
[0012] Step 1: Acquire brainwave signal data, extract the brainwave signal data, and convert the data into numerical data that can be calculated according to different encoding formats;
[0013] Step 2: Perform data preprocessing on the acquired source signal data, using two methods, mean removal and whitening, to initialize the data;
[0014] Step 3: Use a genetic algorithm to find the initialization matrix W, and perform decorrelation processing on the W matrix;
[0015] Step 4: Set up a new update mechanism, updating W in each loop. new The value;
[0016] Step 5: For W new Perform relevant processing;
[0017] Step 6: Calculate W new The norm of W is used to determine the endpoint of the process. If the value converges to 0, the entire process ends; otherwise, the process returns to step 4 and repeats.
[0018] Furthermore, step 1 includes the following steps:
[0019] Step 1.1: First, prepare the EEG signal data and convert all data types into numerical data types for use. This patent uses a 4*20000 numerical data type, which is the mouse brain visual cortex local potential dataset provided by GitHub.
[0020] Step 1.2: Read the EEG signals from Excel using the pandas library in Python and convert them into numerical data types. The EEG signals consist of a 4*20000 array, where 4 represents 4 signal sources and 20000 represents 20000 points for each signal source. The data from the four sets of data are mixed together and plotted as a line graph of the mixed signal using the matplotlib library in Python.
[0021] Furthermore, step 2 includes the following steps:
[0022] Step 2.1: data preprocessing of the acquired brain wave signal data, first centering. The n row vectors of the matrix X formed by the brain wave signal data are meaned, and then the mean value is subtracted from the corresponding row, that is, the mean value mean is calculated using the mean function in python, and then the matrix X -= mean;
[0023] Step 2.2: data preprocessing of the acquired brain wave signal data, the whitening step after centering, the essence of whitening is decorrelation, first find the covariance matrix COV_X of the centered matrix X using the cov function in the numpy library, then use the linalg.elgh function in the numpy library to find the unit eigenvector P and the diagonal matrix D composed of eigenvalues of COV_X, and finally calculate the whitening matrix Complete the whitening step.
[0024] Further, the step 3 comprises the following steps:
[0025] Step 3.1: initialization of the parameters of genetic algorithm, such as mutation parameter t1, mutation probability pc, crossover parameter t2, crossover probability pm, upper and lower bounds of function;
[0026] Step 3.2: selection of fitness function (objective function), among all equal variance random variables, the entropy of Gaussian variable is maximum, so the entropy is used to measure non-Gaussianity, and the negative entropy is used as the fitness function here, the negative entropy is defined as: J(Y) =
[0027] H(Y gauss )-H(Y)
[0028] Where Y represents a certain signal, J(Y) is the negative entropy of Y, H is the differential entropy of the variable, Y gauss is a random vector composed of n Gaussian random variables, which has the same mean and covariance as Y; According to mutual information, the negative entropy can be expressed as:
[0029]
[0030] Where I is the mutual information, minimizing the mutual information is equal to maximizing the negative entropy, so the cost function based on the maximum negative entropy is:
[0031]
[0032] Where, is the cost function of the maximum negative entropy, and detW is the determinant of the matrix W;
[0033] Step 3.3: After determining the objective function and the number of iterations N, the initial population is selected, crossed, and mutated for N iterations to select the final population; wherein the selection method uses roulette selection, the crossover method uses SBX (simulated binary) crossover method, and the mutation uses a non-uniform mutation algorithm based on PSO;
[0034] In the roulette selection algorithm: first, calculate the fitness f(i = 1, 2, …, M) of each individual, M is the size of the population, then calculate the probability of each individual being passed to the next generation population
[0035]
[0036] where P(x i ) is the population probability, f(x i ) is the fitness, and the cumulative probability of each individual is calculated
[0037]
[0038] where q[i] is referred to as the cumulative probability of chromosome x[i], i = 1, 2, …, n, and a pseudo-random number r is generated in the interval [0, 1] with uniform distribution. The counter a = 0, and only when the pseudo-random number r > q i [j] and r < q i [j+1], the loop new_popu[i][a] = population[j][a] is performed, where population[j][a] is the population array, new_popu[i][a] is the generated new population array, and a += 1 until a is greater than the upper limit of the dimension.
[0039] In the simulated binary crossover algorithm: set the crossover parameter 20 and the crossover probability to 0.4. Generate a pseudo-random number r in the interval [0, 1], and when r is less than 0.4, generate a pseudo-random number a in the interval [0, 1] as a random parameter and put it into the crossover formula: new_popu[i][j] = a*new_popu[i][j] + (1-a)*new_popu[i+1][j], new_popu[i+1][j] = a*new_popu[i+1][j] + (1-a)*new_popu[i][j];
[0040] In the non-uniform mutation algorithm based on PSO: set the mutation probability to 0.2, introduce PSO into the traditional non-uniform mutation algorithm, and propose to use Ubest iThe upper and lower bounds of the objective function of the traditional non-uniform variation algorithm are replaced by the local optimal solution Ubest, so that each individual approaches the local optimal solution in each iteration, and the local optimal solution constantly approaches the global optimal solution, thereby increasing the convergence of the entire algorithm. The local optimal solution Ubest defined is used to replace the upper and lower bounds of the objective function in the original non-uniform variation L 、 M U M best is updated after each iteration, and boundary processing is performed when Ubest is updated each time. When the value of the new point is greater than 1 after being updated, it is set to 1, and when the value is less than 0, it is set to 0. After selection, crossover, and mutation, the parent population and the child population are combined to form a new population (size 2N), the fitness of the new population is calculated, and the first N populations with the optimal fitness are selected as the newly generated population.
[0041] The entire process of step 3.3 is as follows:
[0042] Step 3.3.1: Initialize the population.
[0043] Step 3.3.2: Calculate the fitness function.
[0044] Step 3.3.3: Roulette wheel selection.
[0045] Step 3.3.4: Simulate binary crossover.
[0046] Step 3.3.5: Non-uniform variation algorithm based on PSO.
[0047] Step 3.3.6: Merge the population (2N).
[0048] Step 3.3.7: Recalculate the fitness function.
[0049] Step 3.3.8: Generate a new population (N).
[0050] Step 3.3.9: Determine whether the iteration has reached the maximum value. If the maximum value has been reached, the entire process is ended. Otherwise, return to step 3.3.3.
[0051] Further, the step 4 comprises the following steps:
[0052] A 4*4 transformation matrix is generated through the above steps, which is used for the subsequent electroencephalogram signal separation. Let S = WZ,
[0053] W new = E{g(s)Z T}-E{g′(s)}W
[0054] where g(s) is the distribution function of s, W is the signal source matrix, Z is the transformation matrix, S is the newly generated electroencephalogram matrix, and there are three optional functions, of which
[0055]
[0056] Its derivative is g'(s) = 1-g 2 (s), in the actual code, alpha constant is also introduced, that is, g(s) = tanh(alpha*s), g'(s) = alpha(1-g 2 (s)), and 1≤alpha≤2, usually alpha = 1, the code for updating W new is as follows: next_w = (X*g(np.dot(w.T, X))).mean(axis = 1) \ g_prime(np.dot(w.T, X)).mean() * wnext_w / = np.linalg.norm(next_w);
[0057] After the update of W new , it can be decorrelated.
[0058] Further, the step 5 comprises the following steps:
[0059] W is decorrelated, and the updated W new obtained in step 4 is put into the decorrelation formula: wherein is the inverse square root of WW T , which can be obtained by eigenvalue decomposition, WW T = PDP T , wherein P is a unit eigenvector and D is a diagonal matrix composed of eigenvectors, so The relevant code for decorrelating the matrix W is as follows: next_w -= np.dot(np.dot(next_w, W[:i].T), W[:i]).
[0060] Further, the step 6 comprises the following steps:
[0061] Finally, W new and W norm dist need to be obtained, if the value of norm dist is less than the set constant ε, ε is e -15 , then output W new as a separation matrix, otherwise jump back to step 4 to continue loop iteration until the maximum iteration number is reached. The formula for obtaining norm is as follows: The relevant code of dist is as follows: dist = np.abs(np.abs((w*next_w).sum())-1). Finally, the obtained W newThe matrix is the matrix after the electroencephalogram signal separation is successful, and the size is 4*20000, wherein W[0] represents the first group of signals after separation, W[1] represents the second group of signals after separation, W[2] represents the third group of signals after separation, and W[3] represents the fourth group of signals after separation. The four groups of signals after separation are drawn into a line chart by using the matplotlib library in Python, and the separation of the mixed complex electroencephalogram signal is completed.
[0062] According to the above idea, the technical solutions of the application mainly have the following two points:
[0063] (1) A genetic algorithm based on non-uniform mutation of PSO is proposed, which is different from the traditional genetic algorithm. The selection, crossover and mutation steps in the ordinary genetic algorithm are updated to roulette selection, simulated binary crossover and non-uniform mutation based on PSO, and then the first N populations with the optimal fitness value are selected from the parent and child populations.
[0064] (2) A method for separating electroencephalogram signals based on genetic algorithm and fast independent component analysis is proposed, which is different from the traditional ICA method for separating electroencephalogram signals. The improved genetic algorithm is combined with the FASTICA algorithm, the random selection matrix W in the FASTICA algorithm is updated to obtain the matrix W by the improved genetic algorithm, the objective function uses the cost function based on negative entropy maximization, and the matrix optimized by the genetic algorithm is combined with the FASTICA algorithm, so that the electroencephalogram signals are effectively separated.
[0065] The main beneficial effects produced by the cooperation of the above two contents are:
[0066] (1) The traditional genetic algorithm is modified, PSO is introduced into the genetic algorithm, the mutation probability and effect are changed, the local optimal solution is put into the non-uniform mutation algorithm, all individuals constantly approach the local optimal solution, and the local optimal solution constantly approaches the global optimal solution, so that the convergence of the algorithm is improved; from the overall performance, not only has the good mutation method of non-genetic mutation, but also inherits the idea of approaching the optimal particle of PSO algorithm, and the convergence performance of the overall algorithm is improved.
[0067] (2) The genetic algorithm based on non-uniform mutation of PSO is combined with the FASTICA algorithm, compared with the ordinary ICA algorithm, when separating the electroencephalogram signals, not only the separation speed is improved, but also the separation picture effect is improved. Using the improved genetic algorithm to obtain the transformation matrix W is better than using the random matrix. The combination of the two greatly improves the processing efficiency of the electroencephalogram signal problem. BRIEF DESCRIPTION OF DRAWINGS
[0068] Figure 1 is a flow chart of a brain wave signal separation method based on genetic algorithm and fast independent component analysis in the present application;
[0069] Figure 2 is a broken line graph of a mouse cerebral visual cortex local potential signal before separation.
[0070] Figure 3 is a broken line graph of a mouse cerebral visual cortex local potential signal after separation.
[0071] Figure 4(a) is a broken line graph of the first channel signal of the mouse cerebral visual cortex local potential after separation.
[0072] Figure 4(b) is a broken line graph of the second channel signal of the mouse cerebral visual cortex local potential after separation.
[0073] Figure 4(c) is a broken line graph of the third channel signal of the mouse cerebral visual cortex local potential after separation.
[0074] Figure 4(d) is a broken line graph of the fourth channel signal of the mouse cerebral visual cortex local potential after separation. DETAILED DESCRIPTION
[0075] The specific embodiments of the present application are described below in conjunction with the accompanying drawings, so that those skilled in the art can better understand the present application. It should be particularly noted that in the following description, detailed descriptions of known functions and designs may dilute the main content of the present application, and these descriptions will be omitted here.
[0076] As shown in Figure 1 , a brain wave signal separation method based on genetic algorithm and fast independent component analysis comprises the following steps:
[0077] Step 1: Obtain brain wave signal data, extract brain wave signal data and convert the data into numerical data that can be calculated according to different encoding formats;
[0078] Step 2: Data preprocessing is performed on the obtained brain wave signal data, and data initialization is performed using the methods of mean removal and whitening;
[0079] Step 3: Use genetic algorithm to find the initialization matrix W, and perform decorrelation processing on the W matrix;
[0080] Step 4: Set a new update mechanism to update the value of W new each time;
[0081] Step 5: Perform decorrelation processing on W new ;
[0082] Step 6: Calculate W newWith the norm of W, if the value converges to 0, the whole process is ended, otherwise, return to step 4 for a loop.
[0083] The step 1 comprises the following steps:
[0084] Step 1.1: First, prepare the brain wave signal data, and convert all data types into numerical data types for use. The data used in this patent is a set of 4*20000 numerical data, which is a mouse brain visual cortex local potential data set provided by GitHub. By matrix transformation of the mixed 4*20000 data, 4 sets of 1*20000 pure data are separated, so as to achieve the purpose of brain wave signal separation.
[0085] Step 1.2: The brain wave signal is read from the excel by using the pandas.read_csvh() function in Python, and the brain wave signal is composed of 4*20000 arrays, 4 representing 4 signal sources, and 20000 representing 20000 points of each signal source. The mixed data of the 4 sets of data is plotted into a line chart of mixed signals by using the plt.figure() function in Python.
[0086] The step 2 comprises the following steps:
[0087] Step 2.1: The obtained brain wave signal data is preprocessed, and first, it is centralized. The n row vectors of the matrix X formed by the brain wave signal data are averaged, and then the average value mean is subtracted from the corresponding row, that is, the mean function in Python is used to calculate the average value mean, and then the matrix X-=mean.
[0088] Step 2.2: The obtained brain wave signal data is preprocessed, and after centralization, the whitening step is performed. The essence of whitening is decorrelation. First, the covariance matrix COV_X of the centralized matrix X is found by using the cov function in the numpy library, and then the unit eigenvector P and the diagonal matrix D composed of eigenvalues of COV_X are calculated by using the linalg.elgh function in the numpy library, and finally the whitening matrix The whitening step is completed.
[0089] The step 3 comprises the following steps:
[0090] Step 3.1: The parameters of the genetic algorithm are initialized, such as the mutation parameter t1=20, the mutation probability pc=0.4, the crossover parameter t2=20, and the crossover probability pm=0.2.
[0091] Step 3.2: Selection of fitness function (objective function), in all the equal variance random variables, the entropy of Gaussian variable is maximum, so the entropy is used to measure the non-Gaussian, here the negative entropy is used as the fitness function, the negative entropy is defined as: J(Y) = H(Y gauss )-H(Y), where Y gauss is a random vector composed of n Gaussian random variables, with the same mean and covariance as Y; according to the mutual information, the negative entropy can be expressed as: Minimizing mutual information is equivalent to maximizing negative entropy, so the cost function based on negative entropy maximization is:
[0092] Step 3.3: After determining the objective function and the number of iterations N, the initial population is selected, crossed, and mutated for N iterations to select the final population. Among them, the selection method uses roulette selection, the crossover method uses SBX (simulated binary) crossover method, and the mutation uses non-uniform mutation algorithm based on PSO.
[0093] In the roulette selection algorithm: first, calculate the fitness of each individual f(i = 1, 2, …, M), M is the size of the population, then calculate the probability of each individual being passed to the next generation population, Then calculate the cumulative probability of each individual, referred to as the cumulative probability of chromosome x[i] (i = 1, 2, …, n)); finally, generate a pseudo-random number r with uniform distribution in the interval [0, 1], the counter a = 0, if and only if the pseudo-random number r > q i [j] and r < q i [j+1], loop new_popu[i][a] = population[j][a], a += 1, until a is greater than the upper limit of the dimension.
[0094] In the simulated binary crossover algorithm: set the crossover parameter 20, the crossover probability is 0.4, generate a pseudo-random number r in the interval [0, 1], when r is less than 0.4, generate a pseudo-random number a in the interval [0, 1] as a random parameter, put it into the crossover formula, new_popu[i][j] = a*new_popu[i][j] + (1-a)*new_popu[i+1][j], new_popu[i+1][j] = a*new_popu[i+1][j] + (1-a)*new_popu[i][j].
[0095] In the non-uniform mutation algorithm based on PSO: set the mutation probability to 0.2, introduce PSO into the traditional non-uniform mutation algorithm, and propose to use Ubest iThe algorithm replaces the upper and lower bounds of the objective function in the traditional non-uniform mutation algorithm with a predefined local optimum, Ubest, so that each individual moves closer to a local optimum in each iteration, and the local optimum moves closer to the global optimum, thus increasing the convergence of the entire algorithm. L U M After each iteration, Ubest is updated, and out-of-bounds handling is performed during each Ubest update. When a new point is updated, if the value is greater than 1, it is set to 1; if it is less than 0, it is set to 0. After selection, crossover, and mutation, the parent and offspring populations are merged to form a new population (size 2N). The fitness of the new population is calculated, and the top N populations with the best fitness are selected as the newly generated population.
[0096] The steps of the PSO-based non-uniform mutation genetic algorithm are as follows: initialize the population; calculate the fitness function; perform roulette wheel selection; simulate binary crossover; perform the PSO-based non-uniform mutation algorithm; merge the populations (2N); recalculate the fitness function; generate a new population (N); iterate to see if the maximum value has been reached. If it has, output the result; otherwise, return to roulette wheel selection and continue iterating until the maximum number of iterations is reached. These steps generate a 4*4 transformation matrix, which is used for subsequent EEG signal separation.
[0097] Step 4 above includes the following steps:
[0098] Set the formula for updating the W matrix: Let S = WZ, W new =E{g(s)Z T}-E{g′(s)}W, where g(s) is the distribution function of s, which is chosen here. Its derivative is g′(s)=1-g 2 In actual code, the constant alpha is also introduced, i.e., g(s) = tanh(alpha*s) and g′(s) = alpha(1-g). 2 (s)), and 1≤alpha≤2, so alpha is usually set to 1. Update W new The code is as follows:
[0099] next_w=(X*g(np.dot(wT),X))).mean(axis=1)\g_prime(np.dot(wT,X)).mean()*w
[0100] next_w / =np.linalg.norm(next_w).
[0101] Step 5 above includes the following steps:
[0102] After the update of W new is completed, the decorrelation processing can be performed on W new , and W is decorrelated, and the updated W T obtained in step 4 is put into the decorrelation formula: wherein is the inverse square root of WW T , which can be obtained by eigenvalue decomposition, and WW T =PDP new , wherein P is a unit eigenvector, and D is a diagonal matrix composed of eigenvectors, and then The relevant code for decorrelating the matrix W is as follows: next_w-=np.dot(np.dot(next_w,W[:i].T),W[:i]).
[0103] The above step 6 comprises the following steps:
[0104] Finally, W -15 and the norm dist of W new need to be obtained, if the value of the norm dist is less than a set constant epsilon, epsilon is e -15 , then W new is output as a separation matrix, otherwise, it is returned to step 4 to continue the loop iteration until the maximum iteration number is reached. The formula for obtaining the norm is as follows: The relevant code of dist is as follows: dist=np.abs(np.abs((w*next_w).sum())–1). The finally obtained W new matrix is the matrix after the electroencephalogram signal separation is successful, and the size is 4*20000, wherein W[0] represents the first group of signals after separation, that is, the first channel signal of the local potential of the visual cortex of the mouse brain; W[1] represents the second group of signals after separation, that is, the second channel signal of the local potential of the visual cortex of the mouse brain; W[2] represents the third group of signals after separation, that is, the third channel signal of the local potential of the visual cortex of the mouse brain; and W[3] represents the fourth group of signals after separation, that is, the fourth channel signal of the local potential of the visual cortex of the mouse brain. The matplotlib library in Python is used to draw the four groups of separated signals into a line chart, and the total chart of the four groups of separated signals is compared with the electroencephalogram signal chart, and thus the separation of the mixed complex electroencephalogram signal is completed.
[0105] In order to verify the feasibility of the algorithm, the non-uniform mutation algorithm based on particle swarm and the electroencephalogram signal separation method of fast independent component analysis are tested on the 4*20000 electroencephalogram signal data set. The test results are shown in the description accompanying drawings Figure 2 、 Figure 3 , Fig. 4(a), Fig. 4(b), Fig. 4(c), Fig. 4(d).
[0106] In conclusion, the EEG signal separation method based on genetic algorithm and fast independent component analysis can extract the required data information from the complex mixed signal, and the method can solve the separation problem of EEG signal. The genetic algorithm based on PSO non-uniform mutation is introduced in the framework of FASTICA, the conversion matrix is improved by the genetic algorithm based on PSO non-uniform mutation, and the convergence ability of the whole algorithm is improved, so that the processing efficiency of the whole EEG signal separation problem is improved.
Claims
1. A brain wave signal separation method based on a genetic algorithm and fast independent component analysis, characterized by, The method comprises the steps of: Step 1: obtaining brain wave signal data, extracting brain wave signal data and converting the data into numerical data for calculation according to different encoding formats; Step 2: data preprocessing is performed on the obtained source signal data, and two methods of mean removal and whitening are used for data initialization; The step 1 comprises the following steps: Step 4: Set up a new update mechanism to update W every cycle new the value of the variable; Step 5: decorrelating W new ; Step 6: Calculate W new With the norm of W, if the value converges to 0, end the entire process, otherwise return to step 4 for a loop; Step 1.1: first, prepare the brain wave signal data, convert all data types into numerical data types for use, and use a 4*20000 numerical data type for the mouse brain visual cortex local potential data set provided by GitHub; Step 1.2: the brain wave signal is read from the excel file using the pandas library in Python and converted into a numerical data type, the brain wave signal is composed of a 4*20000 array, 4 represents 4 signal sources, and 20000 represents 20000 points for each signal source, and the mixed data of the 4 groups of data is drawn into a line chart of the mixed signal by using the matplotlib library in Python; The step 2 comprises the following steps: Step 2.1: data preprocessing is performed on the obtained brain wave signal data, first, centralization, the n row vectors of the matrix X formed by the brain wave signal data are removed, then the mean value mean is calculated by using the mean function in Python, and then the matrix X-=mean; The step 3 comprises the following steps: Step 2.2: Data preprocessing is performed on the acquired brain wave signal data. After centralization, the white step is performed. The essence of whitening is decorrelation. First, the covariance matrix COV_X of the centralized matrix X is found using the cov function in the numpy library. Then, the unit eigenvector P and the diagonal matrix D composed of eigenvalues of COV_X are calculated using the linalg.elgh function in the numpy library. Finally, the whitening matrix W is calculated The whitening step is completed; Step 3.1: initialize the parameters of the genetic algorithm, such as mutation parameter t1, mutation probability pc, crossover parameter t2, crossover probability pm, and upper and lower bounds of the function; Where I is mutual information, minimizing mutual information is equivalent to maximizing negative entropy, so the cost function based on negative entropy maximization is: Step 3.2: Selection of fitness function, the entropy of Gaussian variable is the largest among all the isotropic random variables, so the entropy is used to measure the non-Gaussianity, and the negative entropy is used as the fitness function, and the negative entropy is defined as: J(Y) = H(Y gauss )-H(Y) where Y represents some signal, J(Y) is the negative entropy of Y, H is the differential entropy of a variable, Y gauss is a random vector consisting of n Gaussian random variables with the same mean and covariance as Y; the negative entropy is expressed in terms of mutual information as: Step 3.3: after determining the objective function and the number of iterations N, the initial population is selected, crossed and mutated for N iterations to select the final population; wherein the selection method uses roulette selection, the crossover method uses SBX simulated binary crossover method, and the mutation uses a non-uniform mutation algorithm based on PSO; wherein, is a cost function for negative entropy maximization, detW is the determinant of the W matrix; In the simulated binary crossover algorithm: set the crossover parameter to 20, the crossover probability to 0.4, and generate a pseudo-random number r in the interval [0,1], when r is less than 0.4, generate a pseudo-random number a in the interval [0,1] as a random parameter and put it into the crossover formula; In roulette wheel selection algorithm: first calculate the fitness of each individual f(x i ), i = 1, 2, …, M, M is the size of the population, and then calculate the probability of each individual to the next generation of population where P(x i ) is the population probability, f(x i ) is the fitness, and the cumulative probability of each individual is recalculated where q[i] is called cumulative probability of chromosome x[i], i = 1, 2, …, n, and a pseudo-random number r is generated in [0, 1] interval finally, and the counter a = 0, if and only if the pseudo-random number r > q i [j] and r < q i [j+1], the loop is performed new_popu[i][a] = population[j][a], where population[j][a] is a population array, new_popu[i][a] is a new population array generated, a += 1, until a is greater than the upper limit of the dimension. The whole step 3.3 process is as follows: In the non-uniform mutation algorithm based on PSO: set the mutation probability to 0.2, introduce PSO into the traditional non-uniform mutation algorithm, and propose to use Ubest i Instead of the upper and lower bounds of the objective function of the traditional non-uniform mutation algorithm, so that each individual approaches the local optimal solution at each iteration, and the local optimal solution continuously approaches the global optimal solution, thereby increasing the convergence of the entire algorithm. Replace the upper and lower bounds of the objective function in the original non-uniform mutation with the defined local optimal solution Ubest L , U M , update Ubest after each iteration, and perform out-of-bound processing when updating Ubest each time. When the value of the new point is greater than 1 after updating, it is set to 1, and when it is less than 0, it is set to 0. After selection, crossover, and mutation, the parent population and the child population are combined to form a new population with a size of 2N. Calculate the fitness of the new population, and select the top N populations with the best fitness as the newly generated population. Step 3.3.1: initialize the population; Step 3.3.2: calculate the fitness function; Step 3.3.3: roulette selection; Step 3.3.4: simulated binary crossover; Step 3.3.5: non-uniform mutation algorithm based on PSO; Step 3.3.6: merge the population; Step 3.3.7: recalculate the fitness function; Step 3.3.8: generate a new population; Step 3.3.9: whether the maximum value is reached, if the maximum value is reached, the whole process is ended, otherwise return to step 3.3.3; The step 4 comprises the following steps: A 4*4 transformation matrix is generated by the above steps, which is used for the following electroencephalogram signal separation, S=WZ, W new = E{g(s)Z T}- E{g'(s)}W Where g(s) is the distribution function of s, W is the signal source matrix, Z is the transformation matrix, S is the newly generated electroencephalogram matrix, and three optional functions are selected, and here Its derivative is g'(s) = 1 - g(s) 2 (s), in the actual code, alpha constant is also introduced, that is, g(s) = tanh(alpha*s), g'(s) = alpha(1 - g 2 (s)), and 1 ≤ alpha ≤ 2, alpha is usually set to 1, and after the update of W new , decorrelation processing can be performed on W The step 5 comprises the following steps: For W decorrelation, the updated W new Put into the decorrelation formula: where is the inverse square root of WW T , which is obtained using eigenvalue decomposition, WW T = PDP T where P is the matrix of unit eigenvectors and D is a diagonal matrix of eigenvalues, then The step 6 comprises the following steps: Finally, we need to find W new and W norm dist, if the value of the norm dist is less than the set constant ε, ε takes the value of e -15 , then output W new as a separation matrix, otherwise jump back to step 4 to continue the loop iteration until the maximum number of iterations is reached; the formula for finding the norm is: The final W new matrix is the matrix after the successful separation of the brain wave signal, with a size of 4*20000, where W[0] represents the first group of separated signals, W[1] represents the second group of separated signals, W[2] represents the third group of separated signals, and W[3] represents the fourth group of separated signals. Using the matplotlib library in Python, we can draw a line chart of the four groups of separated signals, which completes the separation of the mixed complex brain wave signal.