You are on page 1of 1

3

class variance. This section will explain these three 1 N c


ni
µ= ∑ xi = ∑ µi (3)
steps in detail, and then the full description of the LDA N i=1 i=1 N
algorithm will be given. Figures (1 and 2) are used to
visualize the steps of the LDA technique. where c represents the total number of classes (in our
example c = 3).
2.2. Calculating the Between-Class Variance (SB )
The term (µi − µ)(µi − µ)T in Equation (1) repre-
The between-class variance of the ith class (SBi ) rep- sents the separation distance between the mean of the
resents the distance between the mean of the ith class ith class (µi ) and the total mean (µ), or simply it repre-
(µi ) and the total mean (µ). LDA technique searches sents the between-class variance of the ith class (SBi ).
for a lower-dimensional space, which is used to max- Substitute SBi into Equation (1) as follows:
imize the between-class variance, or simply maxi-
mize the separation distance between classes. To ex- (mi − m)2 = W T SBi W (4)
plain how the between-class variance or the between- The total between-class variance is calculated as fol-
class matrix (SB ) can be calculated, the following as- lows, (SB = ∑ci=1 ni SBi ). Figure (1, step (D)) shows first
sumptions are made. Given the original data matrix how the between-class matrix of the first class (SB1 ) is
X = {x1 , x2 , . . . , xN }, where xi represents the ith sam- calculated and then how the total between-class matrix
ple, pattern, or observation and N is the total num- (SB ) is then calculated by adding all the between-class
ber of samples. Each sample is represented by M fea- matrices of all classes.
tures (xi ∈ R M ). In other words, each sample is repre-
sented as a point in M-dimensional space. Assume the 2.3. Calculating the Within-Class Variance (SW )
data matrix is partitioned into c = 3 classes as follows,
X = [ω1 , ω2 , ω3 ] as shown in Fig. (1, step (A)). Each The within-class variance of the ith class (SWi ) rep-
class has five samples (i.e. n1 = n2 = n3 = 5), where ni resents the difference between the mean and the sam-
represents the number of samples of the ith class. The ples of that class. LDA technique searches for a lower-
total number of samples (N) is calculated as follows, dimensional space, which is used to minimize the dif-
N = ∑3i=1 ni . ference between the projected mean (mi ) and the pro-
To calculate the between-class variance (SB ), the jected samples of each class (W T xi ), or simply min-
separation distance between different classes which is imizes the within-class variance [83,36]. The within-
denoted by (mi − m) will be calculated as follows: class variance of each class (SW j ) is calculated as in
Equation (5).

(mi − m)2 = (W T µi −W T µ)2 = W T (µi − µ)(µi − µ)T W


(1) ∑ (W T xi − m j )2
xi ∈ω j , j=1,...,c
where mi represents the projection of the mean of the
= ∑ (W T xi j −W T µ j )2
ith class and it is calculated as follows, mi = W T µi ,
xi ∈ω j , j=1,...,c
where m is the projection of the total mean of all
classes and it is calculated as follows, m = W T µ, W = ∑ W T (xi j − µ j )2W
represents the transformation matrix of LDA1 , µi (1 × xi ∈ω j , j=1,...,c
M) represents the mean of the ith class and it is com-
= ∑ W T (xi j − µ j )(xi j − µ j )T W
puted as in Equation (2), and µ(1×M) is the total mean xi ∈ω j , j=1,...,c
of all classes and it can be computed as in Equation (3)
[83,36]. Figure (1) shows the mean of each class and = ∑ W T SW j W
the total mean in step (B and C), respectively. xi ∈ω j , j=1,...,c
(5)
1
µj = xi (2)
n j xi∑
∈ω j From Equation (5), the within-class variance for
each class can be calculated as follows, SW j = d Tj ∗d j =
nj
∑i=1 (xi j − µ j )(xi j − µ j )T , where xi j represents the ith
1 The transformation matrix (W ) will be explained in Sect. 2.4 sample in the jth class as shown in Fig. (1, step (E,

You might also like