## 2 Methods  
### Brief Introduction of EEG Sparse Modeling  
The sparse modeling of the signal is the process of representing the signal \(\mathbf{Y}=[\mathbf{y}_{1},\mathbf{y}_{2}\dots,\mathbf{y}_{N}]\in\mathbb{R}_{M\times N}\) by linearly combining the atoms \(\mathbf{d}_{k}\) in the dictionary \(\mathbf{D}=[\mathbf{d}_{1},\mathbf{d}_{2}\dots,\mathbf{d}_{K}]\in\mathbb{R}_{M\times K}\), as shown in Equation (1).  
\[\mathbf{Y}=\mathbf{D}\mathbf{A}+\mathbf{e} \tag{1}\]  
In Equation (1), \(\mathbf{e}\) is the model approximation error, \(\mathbf{A}=[\mathbf{a}_{1},\mathbf{a}_{2}\dots,\mathbf{a}_{N}]\in\mathbb{R}_{K\times N}\) is the sparse coefficient vector. The sparse modeling of the signal can be seen as solving the following optimization problem in Equation (2).  
\[\left(P_{(0,\varepsilon)}\right)\min_{\mathbf{a}_{i}}\left\|\mathbf{a}_{i}\right\|_{0} \text{ s.t. }\left\|\mathbf{y}_{i}-\mathbf{D}\mathbf{a}_{i}\right\|_{2}\leq\varepsilon \tag{2}\]  
In Equation (2), \(\left\|\mathbf{A}\right\|_{0}\) represents the \(l_{0}\) norm of the sparse coefficient vector \(\mathbf{A}\). \(\left\|A\right\|_{0}\) is much smaller than the dictionary dimension \(K\). The process of dictionary learning is to train a dictionary \(D\) for a training set \(Y=\mathbf{y}_{i}\mid i=1,2,3\dots,P\), and solve the optimization problem in (2) through this dictionary, and to get the sparse reconstruction coefficients \(\mathbf{A}=[\mathbf{a}_{1},\mathbf{a}_{2}\dots,\mathbf{a}_{N}]\) corresponding to each \(y_{i}\). \(\mathbf{A}_{i}\) makes the linear reconstruction \(\mathbf{y}_{i}=\mathbf{D}\mathbf{A}_{i}+\mathbf{e}_{i}\) have the smallest error \(\mathbf{e}_{i}\). This is an optimization problem, and the objective function with the \(l_{0}\) norm as a constraint condition can be expressed as Equation (3).  
\[\mathbf{D}=\arg\min_{\text{D}}\sum_{i=1}^{N}\min_{a_{i}}\left\{||\text{Da}_{i}-\text {y}_{i}||^{2}+\lambda||\mathbf{a}_{i}||_{1}\right\} \tag{3}\]  
\(D\) represents the sparse dictionary, and \(\mathbf{a}_{i}\), \(\mathbf{y}_{i}\) represent the reconstruction coefficient vector and the original \(i\)th training sample, respectively. \(\lambda\) is the penalty function correction coefficient.  
When performing sparse modeling of EEG signals containing ERP waveforms, due to the over-completeness of the dictionary, the ERP waveforms will be distributed in multiple atoms. The commonly used sparse decomposition methods with better effects have no additional constraints in this regard. Therefore, it is difficult for the coefficients corresponding to atoms to establish a stable and reliable relationship with ERP waveforms, which affects the accuracy of recognition, and it is also difficult to derive electrophysiological meanings from dictionary atoms. The proposed classification feature extraction method uses the following steps to solve this problem. First, the EEG signal is divided into frames, and the EEG signal after the frame is sparsely modeled using the K-SVD method to train the sparse dictionary. Then, perform self-organizing mapping analysis on the dictionary atoms to aggregate the ERP waveforms scattered in the atoms, calculate the cosine similarity between all EEG samples and the code vector of the SOM network neurons as the classification feature, and train the classification to identify whether there is a target ERP waveform in the sample to be recognized. Using SOM for feature extraction has two advantages. First, the architecture of the SOM network can be easily accelerated by parallel computing [30]. Second, the waveforms of each type of atoms can be well-preserved for analysis. Third, in the process of self-organizing mapping, by mapping dictionary atoms to a two-dimensional plane, the positional relationship on this plane can indicate the degree of similarity between atoms, which is helpful for subsequent analysis.