## 4 Results and Discussion
### Comparison with Other P300 Detectors
#### 4.3.2. BLDA  
The decision function of BLDA has the same form as that of FLDA expressed in Equation (14), but the weight vector \(\mathbf{w}\) is optimized based on a different approach. The BLDA implemented in our experiment is the same as the one described in [37]. In BLDA, the basic assumption is the regression targets:  
\[\mathbf{y}=\mathbf{w}^{\dagger}\mathbf{X}+\mathbf{n} \tag{15}\]  
where \(\mathbf{y}=\left[y_{1},y_{2},\ldots,y_{L}\right]\) is the regression target vector containing the class labels \(y_{i}\), \(\mathbf{X}=\left[\mathbf{x}_{1},\mathbf{x}_{2},\ldots,\mathbf{x}_{L}\right]\) is the \(d\times L\) training data matrix (\(d\) and \(L\) are the number of features and number of training data, respectively), and \(\mathbf{n}\) is the noise vector. The likelihood function can be written as  
\[p\left(D|\beta,\mathbf{w}\right)=\left(\frac{\beta}{2\pi}\right)^{\frac{L}{2} }\exp\left(-\frac{\beta}{2}\|\ \mathbf{w}^{\dagger}\mathbf{X}-\mathbf{y}\ \|^{2}\right) \tag{16}\]  
where \(D\) denotes the pair of \(\left(\mathbf{X},\mathbf{y}\right)\), and \(\beta\) represents the inverse variance of the noise. To perform the Bayesian inference, a prior distribution for the weight vector \(\mathbf{w}\) needs to be specified. The expression for the prior (also assumed to be Gaussian) is  
\[p\left(\mathbf{w}|\alpha\right)=\prod_{i=1}^{d}\left(\frac{\alpha_{i}}{2\pi} \right)^{\frac{1}{2}}\exp\left(-\frac{1}{2}\mathbf{w}^{\dagger}\mathbf{I}^{ \prime}\left(\alpha\right)\mathbf{w}\right) \tag{17}\]  
where \(\alpha_{i}\)s are the hyperparameters representing the inverse relevance of each feature, and \(\mathbf{I}^{\prime}\left(\alpha\right)=diag\left(\alpha_{1},\alpha_{2},\ldots,\alpha_{d}\right)\) is a \(d\ \times\ d\) diagonal matrix. Since both likelihood and prior are Gaussian, the posterior is also Gaussian. The covariance \(\mathbf{C}\) and the mean \(\mathbf{m}\) of the posterior are Equations (18) and (19), respectively.  
\[\mathbf{C}=\beta\left(\beta\mathbf{X}\mathbf{X}^{t}+\mathbf{I}^{\prime}\left( \alpha\right)\right)^{-1} \tag{18}\]  
\[\mathbf{m}=\beta\mathbf{C}\mathbf{Y}^{t} \tag{19}\]  
The predictive distribution for a new input \(\mathbf{x}\) is also Gaussian and can be characterized by its mean \(\mathbf{\mu}\) and variance \(\sigma^{2}\):  
\[\mathbf{\mu}=\mathbf{m}^{t}\mathbf{x} \tag{20}\]  
\[\sigma^{2}=\frac{1}{\beta}+\mathbf{x}^{t}\mathbf{C}\mathbf{x} \tag{21}\]  
By marginalizing (16), we obtain the likelihood \(p\left(D|\beta,\alpha\right)\) as  
\[p\left(D|\beta,\alpha\right)=\int p\left(D|\beta,\mathbf{w}\right)p\left( \mathbf{w}|\alpha\right)d\mathbf{w} \tag{22}\]  
which leads to a maximization problem: to find the hyperparameters \(\beta\) and \(\alpha\) such that the log likelihood is maximum. The maximum likelihood solution for the hyperparameters can be found with a simple iterative manner [28]. Taking partial derivatives to the log likelihood with respect to \(\alpha\) and \(\beta\), and setting the results to zero yields the upload equations for \(\alpha\) and \(\beta\):  
\[\alpha_{i}=\frac{1}{c_{ii}+m_{i}^{2}}\,,\forall i=1,\ldots,d \tag{23}\]  
\[\beta=\frac{d}{tr\left(\mathbf{X}\mathbf{X}^{t}\mathbf{C}\right)+\left\|\ \mathbf{m}^{t}\mathbf{X}-\mathbf{y}\ \right\|^{2}} \tag{24}\]where \(c_{i\beta}\) are the diagonal elements of \(\mathbf{C}\), \(m_{i}s\) are the elements of \(\mathbf{m}\), and \(tr\) denotes the trace of a matrix. Equations (18), (19), (23), and (24) are performed iteratively until no significant changes of the values of \(\beta\) and \(\alpha_{i}\) are observed. The mean of the posterior \(\mathbf{m}\) expressed in (19) then can be computed using the optimal values of \(\beta\) and \(\alpha\). Finally, the posterior mean \(\mathbf{m}\) is taken as the optimal value of the weight vector \(\mathbf{w}\)[37].