Kernel Fisher discriminant analysis

From HandWiki

In statistics, kernel Fisher discriminant analysis (KFD),[1] also known as generalized discriminant analysis[2] and kernel discriminant analysis,[3] is a kernelized version of linear discriminant analysis (LDA). It is named after Ronald Fisher.

Linear discriminant analysis

Intuitively, the idea of LDA is to find a projection where class separation is maximized. Given two sets of labeled data, [math]\displaystyle{ \mathbf{C}_1 }[/math] and [math]\displaystyle{ \mathbf{C}_2 }[/math], we can calculate the mean value of each class, [math]\displaystyle{ \mathbf{m}_1 }[/math] and [math]\displaystyle{ \mathbf{m}_2 }[/math], as

[math]\displaystyle{ \mathbf{m}_i = \frac{1}{l_i}\sum_{n=1}^{l_i}\mathbf{x}_n^i, }[/math]

where [math]\displaystyle{ l_i }[/math] is the number of examples of class [math]\displaystyle{ \mathbf{C}_i }[/math]. The goal of linear discriminant analysis is to give a large separation of the class means while also keeping the in-class variance small.[4] This is formulated as maximizing, with respect to [math]\displaystyle{ \mathbf{w} }[/math], the following ratio:

[math]\displaystyle{ J(\mathbf{w}) = \frac{\mathbf{w}^{\text{T}}\mathbf{S}_B\mathbf{w}}{\mathbf{w}^{\text{T}}\mathbf{S}_W\mathbf{w}}, }[/math]

where [math]\displaystyle{ \mathbf{S}_B }[/math] is the between-class covariance matrix and [math]\displaystyle{ \mathbf{S}_W }[/math] is the total within-class covariance matrix:

[math]\displaystyle{ \begin{align} \mathbf{S}_B & = (\mathbf{m}_2-\mathbf{m}_1)(\mathbf{m}_2-\mathbf{m}_1)^{\text{T}} \\ \mathbf{S}_W & = \sum_{i=1,2}\sum_{n=1}^{l_i}(\mathbf{x}_n^i-\mathbf{m}_i)(\mathbf{x}_n^i-\mathbf{m}_i)^{\text{T}}. \end{align} }[/math]

The maximum of the above ratio is attained at

[math]\displaystyle{ \mathbf{w} \propto \mathbf{S}^{-1}_W(\mathbf{m}_2-\mathbf{m}_1). }[/math]

as can be shown by the Lagrange multiplier method (sketch of proof):

Maximizing [math]\displaystyle{ J(\mathbf{w}) = \frac{\mathbf{w}^{\text{T}}\mathbf{S}_B\mathbf{w}}{\mathbf{w}^{\text{T}}\mathbf{S}_W\mathbf{w}} }[/math] is equivalent to maximizing

[math]\displaystyle{ \mathbf{w}^{\text{T}}\mathbf{S}_B\mathbf{w} }[/math]

subject to

[math]\displaystyle{ \mathbf{w}^{\text{T}}\mathbf{S}_W\mathbf{w} = 1 . }[/math]

This, in turn, is equivalent to maximizing [math]\displaystyle{ I(\mathbf{w}, \lambda) = \mathbf{w}^{\text{T}}\mathbf{S}_B\mathbf{w} - \lambda (\mathbf{w}^{\text{T}}\mathbf{S}_W\mathbf{w} - 1) }[/math], where [math]\displaystyle{ \lambda }[/math] is the Lagrange multiplier.

At the maximum, the derivatives of [math]\displaystyle{ I(\mathbf{w}, \lambda) }[/math] with respect to [math]\displaystyle{ \mathbf{w} }[/math] and [math]\displaystyle{ \lambda }[/math] must be zero. Taking [math]\displaystyle{ \frac{dI}{d\mathbf{w}} = \mathbf{0} }[/math] yields

[math]\displaystyle{ \mathbf{S}_B\mathbf{w} - \lambda \mathbf{S}_W \mathbf{w} = \mathbf{0}, }[/math]

which is trivially satisfied by [math]\displaystyle{ \mathbf{w} = c \mathbf{S}^{-1}_W(\mathbf{m}_2-\mathbf{m}_1) }[/math] and [math]\displaystyle{ \lambda = (\mathbf{m}_2-\mathbf{m}_1)^{\text{T}} \mathbf{S}^{-1}_W(\mathbf{m}_2-\mathbf{m}_1). }[/math]

Extending LDA

To extend LDA to non-linear mappings, the data, given as the [math]\displaystyle{ \ell }[/math] points [math]\displaystyle{ \mathbf{x}_i, }[/math] can be mapped to a new feature space, [math]\displaystyle{ F, }[/math] via some function [math]\displaystyle{ \phi. }[/math] In this new feature space, the function that needs to be maximized is[1]

[math]\displaystyle{ J(\mathbf{w}) = \frac{\mathbf{w}^{\text{T}}\mathbf{S}_B^{\phi}\mathbf{w}}{\mathbf{w}^{\text{T}}\mathbf{S}_W^{\phi}\mathbf{w}}, }[/math]

where

[math]\displaystyle{ \begin{align} \mathbf{S}_B^{\phi} & = \left (\mathbf{m}_2^{\phi}-\mathbf{m}_1^{\phi} \right ) \left (\mathbf{m}_2^{\phi}-\mathbf{m}_1^{\phi} \right )^{\text{T}} \\ \mathbf{S}_W^{\phi} & = \sum_{i=1,2} \sum_{n=1}^{l_i} \left (\phi(\mathbf{x}_n^i)-\mathbf{m}_i^{\phi} \right ) \left (\phi(\mathbf{x}_n^i)-\mathbf{m}_i^{\phi} \right)^{\text{T}}, \end{align} }[/math]

and

[math]\displaystyle{ \mathbf{m}_i^{\phi} = \frac{1}{l_i}\sum_{j=1}^{l_i}\phi(\mathbf{x}_j^i). }[/math]

Further, note that [math]\displaystyle{ \mathbf{w}\in F }[/math]. Explicitly computing the mappings [math]\displaystyle{ \phi(\mathbf{x}_i) }[/math] and then performing LDA can be computationally expensive, and in many cases intractable. For example, [math]\displaystyle{ F }[/math] may be infinitely dimensional. Thus, rather than explicitly mapping the data to [math]\displaystyle{ F }[/math], the data can be implicitly embedded by rewriting the algorithm in terms of dot products and using kernel functions in which the dot product in the new feature space is replaced by a kernel function,[math]\displaystyle{ k(\mathbf{x},\mathbf{y}) =\phi( \mathbf{x}) \cdot\phi(\mathbf{y}) }[/math].

LDA can be reformulated in terms of dot products by first noting that [math]\displaystyle{ \mathbf{w} }[/math] will have an expansion of the form[5]

[math]\displaystyle{ \mathbf{w} = \sum_{i=1}^l\alpha_i\phi(\mathbf{x}_i). }[/math]

Then note that

[math]\displaystyle{ \mathbf{w}^{\text{T}}\mathbf{m}_i^{\phi} = \frac{1}{l_i}\sum_{j=1}^{l}\sum_{k=1}^{l_i}\alpha_jk \left (\mathbf{x}_j,\mathbf{x}_k^i \right ) = \mathbf{\alpha}^{\text{T}}\mathbf{M}_i, }[/math]

where

[math]\displaystyle{ (\mathbf{M}_i)_j = \frac{1}{l_i}\sum_{k=1}^{l_i}k(\mathbf{x}_j,\mathbf{x}_k^i). }[/math]

The numerator of [math]\displaystyle{ J(\mathbf{w}) }[/math] can then be written as:

[math]\displaystyle{ \mathbf{w}^{\text{T}}\mathbf{S}_B^{\phi}\mathbf{w} = \mathbf{w}^{\text{T}} \left (\mathbf{m}_2^{\phi}-\mathbf{m}_1^{\phi} \right ) \left (\mathbf{m}_2^{\phi}-\mathbf{m}_1^{\phi} \right )^{\text{T}}\mathbf{w} = \mathbf{\alpha}^{\text{T}}\mathbf{M}\mathbf{\alpha}, \qquad \text{where} \qquad \mathbf{M} = (\mathbf{M}_2-\mathbf{M}_1)(\mathbf{M}_2-\mathbf{M}_1)^{\text{T}}. }[/math]

Similarly, the denominator can be written as

[math]\displaystyle{ \mathbf{w}^{\text{T}}\mathbf{S}_W^{\phi}\mathbf{w}=\mathbf{\alpha}^{\text{T}}\mathbf{N}\mathbf{\alpha},\qquad \text{where} \qquad \mathbf{N} = \sum_{j=1,2}\mathbf{K}_j(\mathbf{I}-\mathbf{1}_{l_j})\mathbf{K}_j^{\text{T}}, }[/math]

with the [math]\displaystyle{ n^{\text{th}}, m^{\text{th}} }[/math] component of [math]\displaystyle{ \mathbf{K}_j }[/math] defined as [math]\displaystyle{ k(\mathbf{x}_n,\mathbf{x}_m^j), \mathbf{I} }[/math] is the identity matrix, and [math]\displaystyle{ \mathbf{1}_{l_j} }[/math] the matrix with all entries equal to [math]\displaystyle{ 1/l_j }[/math]. This identity can be derived by starting out with the expression for [math]\displaystyle{ \mathbf{w}^{\text{T}} \mathbf{S}_W^{\phi}\mathbf{w} }[/math] and using the expansion of [math]\displaystyle{ \mathbf{w} }[/math] and the definitions of [math]\displaystyle{ \mathbf{S}_W^{\phi} }[/math] and [math]\displaystyle{ \mathbf{m}_i^{\phi} }[/math]

[math]\displaystyle{ \begin{align} \mathbf{w}^{\text{T}}\mathbf{S}_W^{\phi}\mathbf{w} &= \left(\sum_{i=1}^l\alpha_i\phi^{\text{T}}(\mathbf{x}_i)\right)\left(\sum_{j=1,2}\sum_{n =1}^{l_j} \left (\phi(\mathbf{x}_n^j)-\mathbf{m}_j^{\phi} \right ) \left (\phi(\mathbf{x}_n^j)-\mathbf{m}_j^{\phi} \right )^{\text{T}}\right) \left(\sum_{k=1}^l\alpha_k\phi(\mathbf{x}_k)\right)\\ &= \sum_{j=1,2}\sum_{i=1}^l\sum_{n =1}^{l_j}\sum_{k=1}^l \left (\alpha_i\phi^{\text{T}} (\mathbf{x}_i) \left (\phi(\mathbf{x}_n^j)-\mathbf{m}_j^{\phi} \right ) \left (\phi(\mathbf{x}_n^j)-\mathbf{m}_j^{\phi} \right )^{\text{T}} \alpha_k\phi(\mathbf{x}_k) \right ) \\ & = \sum_{j=1,2}\sum_{i=1}^l\sum_{n =1}^{l_j}\sum_{k=1}^l \left(\alpha_ik(\mathbf{x}_i,\mathbf{x}_n^j)-\frac{1}{l_j}\sum_{p=1}^{l_j}\alpha_ik(\mathbf{x}_i,\mathbf{x}_p^j)\right) \left(\alpha_kk(\mathbf{x}_k,\mathbf{x}_n^j)-\frac{1}{l_j}\sum_{q=1}^{l_j}\alpha_kk(\mathbf{x}_k,\mathbf{x}_q^j)\right) \\ & = \sum_{j=1,2}\left( \sum_{i=1}^l\sum_{n =1}^{l_j}\sum_{k=1}^l \left ( \alpha_i\alpha_kk(\mathbf{x}_i,\mathbf{x}_n^j)k(\mathbf{x}_k,\mathbf{x}_n^j) - \frac{2\alpha_i\alpha_k}{l_j}\sum_{p=1}^{l_j}k(\mathbf{x}_i,\mathbf{x}_n^j)k(\mathbf{x}_k,\mathbf{x}_p^j) + \frac{\alpha_i\alpha_k}{l_j^2}\sum_{p=1}^{l_j}\sum_{q=1}^{l_j} k(\mathbf{x}_i,\mathbf{x}_p^j)k(\mathbf{x}_k,\mathbf{x}_q^j) \right) \right )\\ & = \sum_{j=1,2}\left( \sum_{i=1}^l\sum_{n =1}^{l_j}\sum_{k=1}^l\left( \alpha_i\alpha_kk(\mathbf{x}_i,\mathbf{x}_n^j)k(\mathbf{x}_k,\mathbf{x}_n^j) - \frac{\alpha_i\alpha_k}{l_j}\sum_{p=1}^{l_j}k(\mathbf{x}_i,\mathbf{x}_n^j)k(\mathbf{x}_k,\mathbf{x}_p^j) \right)\right) \\[6pt] & = \sum_{j=1,2} \mathbf{\alpha}^{\text{T}} \mathbf{K}_j\mathbf{K}_j^{\text{T}}\mathbf{\alpha} - \mathbf{\alpha}^{\text{T}} \mathbf{K}_j\mathbf{1}_{l_j}\mathbf{K}_j^{\text{T}}\mathbf{\alpha} \\[4pt] & = \mathbf{\alpha}^{\text{T}}\mathbf{N}\mathbf{\alpha}. \end{align} }[/math]

With these equations for the numerator and denominator of [math]\displaystyle{ J(\mathbf{w}) }[/math], the equation for [math]\displaystyle{ J }[/math] can be rewritten as

[math]\displaystyle{ J(\mathbf{\alpha}) = \frac{\mathbf{\alpha}^{\text{T}}\mathbf{M}\mathbf{\alpha}}{\mathbf{\alpha}^{\text{T}}\mathbf{N}\mathbf{\alpha}}. }[/math]

Then, differentiating and setting equal to zero gives

[math]\displaystyle{ (\mathbf{\alpha}^{\text{T}}\mathbf{M}\mathbf{\alpha})\mathbf{N}\mathbf{\alpha} = (\mathbf{\alpha}^{\text{T}}\mathbf{N}\mathbf{\alpha})\mathbf{M}\mathbf{\alpha}. }[/math]

Since only the direction of [math]\displaystyle{ \mathbf{w} }[/math], and hence the direction of [math]\displaystyle{ \mathbf{\alpha}, }[/math] matters, the above can be solved for [math]\displaystyle{ \mathbf{\alpha} }[/math] as

[math]\displaystyle{ \mathbf{\alpha} = \mathbf{N}^{-1}(\mathbf{M}_2- \mathbf{M}_1). }[/math]

Note that in practice, [math]\displaystyle{ \mathbf{N} }[/math] is usually singular and so a multiple of the identity is added to it [1]

[math]\displaystyle{ \mathbf{N}_{\epsilon} = \mathbf{N}+\epsilon\mathbf{I}. }[/math]

Given the solution for [math]\displaystyle{ \mathbf{\alpha} }[/math], the projection of a new data point is given by[1]

[math]\displaystyle{ y(\mathbf{x}) = (\mathbf{w}\cdot\phi(\mathbf{x})) = \sum_{i=1}^l\alpha_ik(\mathbf{x}_i,\mathbf{x}). }[/math]

Multi-class KFD

The extension to cases where there are more than two classes is relatively straightforward.[2][6][7] Let [math]\displaystyle{ c }[/math] be the number of classes. Then multi-class KFD involves projecting the data into a [math]\displaystyle{ (c-1) }[/math]-dimensional space using [math]\displaystyle{ (c-1) }[/math] discriminant functions

[math]\displaystyle{ y_i = \mathbf{w}_i^{\text{T}}\phi(\mathbf{x}) \qquad i= 1,\ldots,c-1. }[/math]

This can be written in matrix notation

[math]\displaystyle{ \mathbf{y} = \mathbf{W}^{\text{T}}\phi(\mathbf{x}), }[/math]

where the [math]\displaystyle{ \mathbf{w}_i }[/math] are the columns of [math]\displaystyle{ \mathbf{W} }[/math].[6] Further, the between-class covariance matrix is now

[math]\displaystyle{ \mathbf{S}_B^{\phi} = \sum_{i=1}^c l_i(\mathbf{m}_i^{\phi}-\mathbf{m}^{\phi})(\mathbf{m}_i^{\phi}-\mathbf{m}^{\phi})^{\text{T}}, }[/math]

where [math]\displaystyle{ \mathbf{m}^\phi }[/math] is the mean of all the data in the new feature space. The within-class covariance matrix is

[math]\displaystyle{ \mathbf{S}_W^{\phi} = \sum_{i=1}^c \sum_{n=1}^{l_i}(\phi(\mathbf{x}_n^i)-\mathbf{m}_i^{\phi})(\phi(\mathbf{x}_n^i)-\mathbf{m}_i^{\phi})^{\text{T}}, }[/math]

The solution is now obtained by maximizing

[math]\displaystyle{ J(\mathbf{W}) = \frac{\left|\mathbf{W}^{\text{T}}\mathbf{S}_B^{\phi}\mathbf{W}\right|}{\left|\mathbf{W}^{\text{T}}\mathbf{S}_W^{\phi}\mathbf{W}\right|}. }[/math]

The kernel trick can again be used and the goal of multi-class KFD becomes[7]

[math]\displaystyle{ \mathbf{A}^* = \underset{\mathbf{A}}{\operatorname{argmax}} = \frac{\left|\mathbf{A}^{\text{T}}\mathbf{M}\mathbf{A}\right|}{\left|\mathbf{A}^{\text{T}}\mathbf{N}\mathbf{A}\right|}, }[/math]

where [math]\displaystyle{ A = [\mathbf{\alpha}_1,\ldots,\mathbf{\alpha}_{c-1}] }[/math] and

[math]\displaystyle{ \begin{align} M & = \sum_{j=1}^cl_j(\mathbf{M}_j-\mathbf{M}_{*})(\mathbf{M}_j-\mathbf{M}_{*})^{\text{T}} \\ N & = \sum_{j=1}^c\mathbf{K}_j(\mathbf{I}-\mathbf{1}_{l_j})\mathbf{K}_j^{\text{T}}. \end{align} }[/math]

The [math]\displaystyle{ \mathbf{M}_i }[/math] are defined as in the above section and [math]\displaystyle{ \mathbf{M}_{*} }[/math] is defined as

[math]\displaystyle{ (\mathbf{M}_{*})_j = \frac{1}{l}\sum_{k=1}^{l}k(\mathbf{x}_j,\mathbf{x}_k). }[/math]

[math]\displaystyle{ \mathbf{A}^{*} }[/math] can then be computed by finding the [math]\displaystyle{ (c-1) }[/math] leading eigenvectors of [math]\displaystyle{ \mathbf{N}^{-1}\mathbf{M} }[/math].[7] Furthermore, the projection of a new input, [math]\displaystyle{ \mathbf{x}_t }[/math], is given by[7]

[math]\displaystyle{ \mathbf{y}(\mathbf{x}_t) = \left(\mathbf{A}^{*}\right)^{\text{T}}\mathbf{K}_t, }[/math]

where the [math]\displaystyle{ i^{th} }[/math] component of [math]\displaystyle{ \mathbf{K}_t }[/math] is given by [math]\displaystyle{ k(\mathbf{x}_i,\mathbf{x}_t) }[/math].

Classification using KFD

In both two-class and multi-class KFD, the class label of a new input can be assigned as[7]

[math]\displaystyle{ f(\mathbf{x}) = arg\min_j D(\mathbf{y}(\mathbf{x}),\bar{\mathbf{y}}_j), }[/math]

where [math]\displaystyle{ \bar{\mathbf{y}}_j }[/math] is the projected mean for class [math]\displaystyle{ j }[/math] and [math]\displaystyle{ D(\cdot,\cdot) }[/math] is a distance function.

Applications

Kernel discriminant analysis has been used in a variety of applications. These include:

  • Face recognition[3][8][9] and detection[10][11]
  • Hand-written digit recognition[1][12]
  • Palmprint recognition[13]
  • Classification of malignant and benign cluster microcalcifications[14]
  • Seed classification[2]
  • Search for the Higgs Boson at CERN[15]

See also

References

  1. 1.0 1.1 1.2 1.3 1.4 Mika, S; Rätsch, G.; Weston, J.; Schölkopf, B.; Müller, KR (1999). "Fisher discriminant analysis with kernels". Neural Networks for Signal Processing IX: Proceedings of the 1999 IEEE Signal Processing Society Workshop (Cat. No.98TH8468). IX. 41–48. doi:10.1109/NNSP.1999.788121. ISBN 978-0-7803-5673-3. 
  2. 2.0 2.1 2.2 Baudat, G.; Anouar, F. (2000). "Generalized discriminant analysis using a kernel approach". Neural Computation 12 (10): 2385–2404. doi:10.1162/089976600300014980. PMID 11032039. 
  3. 3.0 3.1 Li, Y.; Gong, S.; Liddell, H. (2003). "Recognising trajectories of facial identities using kernel discriminant analysis". Image and Vision Computing 21 (13–14): 1077–1086. doi:10.1016/j.imavis.2003.08.010. 
  4. Bishop, CM (2006). Pattern Recognition and Machine Learning. New York, NY: Springer. 
  5. Scholkopf, B; Herbrich, R.; Smola, A. (2001). "A Generalized Representer Theorem". Computational Learning Theory. Lecture Notes in Computer Science. 2111. pp. 416–426. doi:10.1007/3-540-44581-1_27. ISBN 978-3-540-42343-0. 
  6. 6.0 6.1 Duda, R.; Hart, P.; Stork, D. (2001). Pattern Classification. New York, NY: Wiley. 
  7. 7.0 7.1 7.2 7.3 7.4 Zhang, J.; Ma, K.K. (2004). Kernel fisher discriminant for texture classification. 
  8. Liu, Q.; Lu, H.; Ma, S. (2004). "Improving kernel Fisher discriminant analysis for face recognition". IEEE Transactions on Circuits and Systems for Video Technology 14 (1): 42–49. doi:10.1109/tcsvt.2003.818352. 
  9. Liu, Q.; Huang, R.; Lu, H.; Ma, S. (2002). "Face recognition using kernel-based Fisher discriminant analysis". IEEE International Conference on Automatic Face and Gesture Recognition. 
  10. Kurita, T.; Taguchi, T. (2002). "A modification of kernel-based Fisher discriminant analysis for face detection". Proceedings of Fifth IEEE International Conference on Automatic Face Gesture Recognition. pp. 300–305. doi:10.1109/AFGR.2002.1004170. ISBN 978-0-7695-1602-8. 
  11. Feng, Y.; Shi, P. (2004). "Face detection based on kernel fisher discriminant analysis". IEEE International Conference on Automatic Face and Gesture Recognition. 
  12. Yang, J.; Frangi, AF; Yang, JY; Zang, D., Jin, Z. (2005). "KPCA plus LDA: a complete kernel Fisher discriminant framework for feature extraction and recognition". IEEE Transactions on Pattern Analysis and Machine Intelligence 27 (2): 230–244. doi:10.1109/tpami.2005.33. PMID 15688560. 
  13. Wang, Y.; Ruan, Q. (2006). "Kernel fisher discriminant analysis for palmprint recognition". International Conference on Pattern Recognition. 
  14. Wei, L.; Yang, Y.; Nishikawa, R.M.; Jiang, Y. (2005). "A study on several machine-learning methods for classification of malignant and benign clustered microcalcifications". IEEE Transactions on Medical Imaging 24 (3): 371–380. doi:10.1109/tmi.2004.842457. PMID 15754987. 
  15. Malmgren, T. (1997). "An iterative nonlinear discriminant analysis program: IDA 1.0". Computer Physics Communications 106 (3): 230–236. doi:10.1016/S0010-4655(97)00100-8. Bibcode1997CoPhC.106..230M. 

External links