# Adaptive Feature Extraction of Motor Imagery EEG with Optimal Wavelet Packets and SE-Isomap
## 2 Primary Theory
### Explicit-MDS  
Utilizing the explicit-MDS algorithm on the global geodesic distance matrix \(\mathbf{G}\), the corresponding mapping \(\mathbf{f}=R^{D}\to R^{d}\) can be obtained while obtaining the low-dimensional representation of the data, where \(\mathbf{f}=\left(f_{1},f_{2},\ldots,f_{d}\right)^{\mathrm{T}}\). For any \(\mathbf{x}\in R^{D}\),  
\[y=f(x)=\mathbf{W}^{\mathrm{T}}\mathbf{\Phi}(x) \tag{8}\]  
where \(\mathbf{W}\in R^{r\times d}\) denotes the weight coefficient matrix, \(\mathbf{\Phi}(\mathbf{x})=\left(\mathbf{\Phi}_{1}(\mathbf{x}),\mathbf{\Phi}_{2}(x),\ldots,\mathbf{\Phi }_{r}(\mathbf{x})\right)^{\mathrm{T}}\) is the column vector, \(\mathbf{y}\in R^{d}\) is the optimal low-dimensional expression of the original data in the target space and \(\mathbf{\Phi}_{j}\colon R^{D}\to R^{1}(j=1,\ldots,r)\) is a set of non-liner basis functions. Here, the radial basis function (RBF) is selected to construct the functions:  
\[\mathbf{\Phi}_{j}(\mathbf{x}_{i})=\exp\Biggl{\{}-\frac{\parallel\mathbf{x}_{i}-\mathbf{c}_{j }\parallel^{2}}{\beta}\Biggr{\}} \tag{9}\]  
where \(\mathbf{c}_{j}(j=1,2,\ldots,1)\) denotes the centers of the RBF \(\mathbf{\Phi}_{j}(\cdot)\) and \(\beta\) denotes the bandwidth parameter determined by the mean distance of the dataset. Correspondingly, the objective function is constructed as:  
\[\mathbf{\varepsilon}(\mathbf{W})=\sum_{i=1}^{n}\sum_{j=1}^{l}\bigl{(}g_{ij}-q_{ij}( \mathbf{W})\bigr{)}^{2} \tag{10}\]  
where \(q_{ij}(\mathbf{W})=\parallel\mathbf{W}^{\mathrm{T}}\bigl{(}\mathbf{\Phi}_{i}-\mathbf{\Phi}_{j }\bigr{)}\parallel\) denotes the pairwise Euclidean distance between the constructed points in the target space after dimensionality reduction. The problem is transformed to obtain the optimal weight matrix \(\mathbf{W}\) that can minimize the objective function. An iterative optimization algorithm is used to resolve the problem of least squares on \(\mathbf{W}\). The algorithm steps are as follows:  
Step 1. Let \(t=0\), and initialize the weight matrix \(\mathbf{W}^{(t)}\);  
Step 2. Let \(\mathbf{V}=\mathbf{W}^{(t)}\);  
Step 3. Update \(\mathbf{W}^{(t+1)}=\underset{\mathbf{W}}{\mathrm{argmin}}\mathbf{\varepsilon}_{\mathrm{m} }(\mathbf{W},\mathbf{V})\); \(\mathbf{W}^{(t+1)}\) is the solution of minimization problem \(\mathbf{\varepsilon}_{\mathrm{m}}(\mathbf{W},\mathbf{V})\), and \(\mathbf{W}=\mathbf{A}^{+}\mathbf{B}(\mathbf{V})\mathbf{V}\), where:  
\[\mathbf{A}=\sum_{i,j}\bigl{(}\mathbf{\[PERSON]}_{i}-\mathbf{\[PERSON]}_{j}\bigr{)}\bigl{(}\mathbf{\[PERSON]}_ {i}-\mathbf{\[PERSON]}_{j}\bigr{)}^{\mathrm{T}} \tag{11}\]  
\(\mathbf{A}^{+}\) is the Moore-Penrose inverse of \(\mathbf{A}\),  
\[\mathbf{B}(\mathbf{V})=\sum_{i,j}b_{ij}(\mathbf{V})\bigl{(}\mathbf{\[PERSON]}_{i}-\mathbf{\[PERSON]}_{j} \bigr{)}\bigl{(}\mathbf{\[PERSON]}_{i}-\mathbf{\[PERSON]}_{j}\bigr{)}^{\mathrm{T}} \tag{12}\]\[b_{ij}=\left\{\begin{array}{c}\frac{Sij}{q_{ij}(V)},q_{ij}(\mathbf{V})>0;\\ 0,\;q_{ij}(\mathbf{V})=0\end{array}\right. \tag{13}\]  
Step 4. Check for convergence. If not, then let \(t=t+1\), and go to Step 2 to continue the iteration; otherwise, stop.  
Finally, the optimal expression \(\mathbf{y}\in R^{1\times d}\) of the original data in the target space and the corresponding mapping weight matrix \(\mathbf{W}_{\text{opt}}\) are obtained. The nonlinear manifold structure feature of a new test sample can be obtained by the explicit relation matrix \(\mathbf{W}_{\text{opt}}\), multiplying its base function, that is, \(\mathbf{y}_{\text{test}}=\mathbf{W}_{\text{opt}}^{\text{T}}\mathbf{\Phi}(\mathbf{x}_{\text{test}})\), through which the efficiency of the algorithm has been improved.