\(\mu_i \leftarrow \text{mean}(D_i), i = 1,2\) =calculate the mean for
\(S_B \leftarrow \(\mu_1-\mu_2)(\mu_1-\mu_2)^T\)Calculate between class matrix by multiplying the two mean vectors
\(Z_i \leftarrow D_i-\mu_i^T, i = 1,2\)Subtract the mean from matrix
\(S_i \leftarrow Z^T_iZ_i, i= 1,2 \)S matrix is n * covariance matrix for each class
\(S_w \leftarrow S_1 + S_2\)Calculate Sw by summing the two S matricies
\(\lambda_1,w \leftarrow eigen(S^{-1}B)\)get dominant eigenvector,eigenvalue using the eigen function in the previous homework
5.
\(K(w) = \frac{w^TS_Ww}{w^TS_Bw}\)
\(\frac{d}{dx}\left(\frac{f(x)}{g(x)}\right) = \frac{f'(x)g(x) -
g'(x)f(x)}{g(x)^2} \) definition of derivative for multiple functions
\(\frac{d}{dw}K(w) = \frac{2S_ww(w^TS_Bw) - 2S_Bw(w^TS_Sw)}{(w^TS_Bw)^2} =
0\) set derivative equal to 0 to minimize the function.
\(2S_ww(w^TS_Bw) = 2S_Bw(w^TS_Sw)\) simplyifing
\(S_ww = S_Bw\frac{(w^TS_Sw)}{(w^TS_Bw)} = S_BwK(w) = \lambda S_Bw\) Substituting in K(w), which is by definition an eigenvalue of \(S_B\) and \(S_w\).
If \(S_B^{-1}\) exists (nonsingular), then \(S_B^{-1}S_ww = \lambda S_B^{-1}S_Bw =
\lambda w \) This changes the form to be the regular eigenvector eigenvalue equation.
\(S_B^{-1}S_ww = \lambda w\) this is the regular eigenvector eigenvalue equation, solvable using the LDA algorithm