SOLUTION1:
Dudaらに従って。(パターンクラシフィケーション)@lucasの代替ソリューションがあり、この場合、手作業で非常に簡単に計算できます。(この代替ソリューションが役立つことを期待してください!! :))
2クラスLDAの目的は次のとおりです。
wTSBwwTSWw
SB=(m1−m2)(m1−m2)TSW=S1+S2S1,S2m1,m2
この一般化されたローリー商の解は、一般化された固有値プローブです。
SBw=λSWw→SW−1SBw=λw
SBm1−m2w∝SW−1(m1−m2)
w
SW−1(m1−m2)=(S1+S2)−1(m1−m2)=([2001]+[1001])−1([00]−[44])=([1/3001/2])([00]−[44])=[−1.3333−2.0000]∝[0.55470.8321]
Ref: Pattern Classification by Duda, Hart, Stork
SOLUTION2:
Alternatively, it can be solved by finding eigen vector to the generalized eigen value problem.
SBw=λSWw
A polynomial in lambda can be formed by determinant(SB−λSW) and the solutions to that polynomial will be the eigen value for SBw=λSWw.
Now lets say you got a set of eigen values λ1,λ2,...,λn, as roots of the polynomial.
Now substitute λ=λi,i∈{1,2,..,n} and get the corresponding eigen vector as solution to the linear system of equations SBwi=λiSWwi. By doing this for each i you can get a set of vectors {wi}ni=1 and it is a set of eigen vectors as solutions.
determinant(SB−λSW)=[16−3λ161616−2λ]=6λ2−80λ, So eigen values are roots to polynomial 6λ2−80λ.
So λ= 0 and 40/3 are the two solutions.
For LDA, eigen vector corresponding to highest eigen value is the solution.
Solution to system of equation (SB−λiSW)wi=0 and λi=40/3
which turns out to be [16−3λ161616−2λ]wi∝[−724848−32]wi=0
Solution to the above system of equation is [−0.5547−0.8321]∝[0.55470.8321] which is same as previous solution.
Alternatively, we can say that [0.55470.8321] lies in the null space of [−724848−32].
For two class LDA, eigen vector with highest eigen value is the solution. In general, for C class LDA, the first C - 1 eigen vectors to highest C - 1 eigen values constitute the solution.
This video explains how to compute eigen vectors for simple eigen value problem. ( https://www.khanacademy.org/math/linear-algebra/alternate_bases/eigen_everything/v/linear-algebra-finding-eigenvectors-and-eigenspaces-example )
Following is an example.
http://www.sosmath.com/matrix/eigen2/eigen2.html
Multi-class LDA:
http://en.wikipedia.org/wiki/Linear_discriminant_analysis#Multiclass_LDA
Calculating Null Space of a matrix:
https://www.khanacademy.org/math/linear-algebra/vectors_and_spaces/null_column_space/v/null-space-2-calculating-the-null-space-of-a-matrix