Kernel Fisher discriminant analysis

From Infogalactic: the planetary knowledge core
Jump to: navigation, search

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. Using the kernel trick, LDA is implicitly performed in a new feature space, which allows non-linear mappings to be learned.

Linear discriminant analysis

Intuitively, the idea of LDA is to find a projection where class separation is maximized. Given two sets of labeled data, \mathbf{C}_1 and \mathbf{C}_2, define the class means \mathbf{m}_1 and \mathbf{m}_2 to be


\mathbf{m}_i = \frac{1}{l_i}\sum_{n=1}^{l_i}\mathbf{x}_n^i,

where l_i is the number of examples of class \mathbf{C}_i. 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

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): J(\mathbf{w}) = \frac{\mathbf{w}^{\text{T}}\mathbf{S}_B\mathbf{w}}{\mathbf{w}^{\text{T}}\mathbf{S}_W\mathbf{w}},


where \mathbf{S}_B is the between-class covariance matrix and \mathbf{S}_W is the total within-class covariance matrix:

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \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}


Differentiating J(\mathbf{w}) with respect to \mathbf{w}, setting equal to zero, and rearranging gives

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): (\mathbf{w}^{\text{T}}\mathbf{S}_B\mathbf{w})\mathbf{S}_W\mathbf{w} = (\mathbf{w}^{\text{T}}\mathbf{S}_W\mathbf{w})\mathbf{S}_B\mathbf{w}.


Since we only care about the direction of \mathbf{w} and \mathbf{S}_B\mathbf{w} has the same direction as (\mathbf{m}_2-\mathbf{m}_1) , \mathbf{S}_B\mathbf{w} can be replaced by (\mathbf{m}_2-\mathbf{m}_1) and we can drop the scalars Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): (\mathbf{w}^{\text{T}}\mathbf{S}_B\mathbf{w})

and Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): (\mathbf{w}^{\text{T}}\mathbf{S}_W\mathbf{w})
to give

\mathbf{w} \propto \mathbf{S}^{-1}_W(\mathbf{m}_2-\mathbf{m}_1).

Kernel trick with LDA

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

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): J(\mathbf{w}) = \frac{\mathbf{w}^{\text{T}}\mathbf{S}_B^{\phi}\mathbf{w}}{\mathbf{w}^{\text{T}}\mathbf{S}_W^{\phi}\mathbf{w}},


where

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \begin{align} \mathbf{S}_B^{\phi} & = (\mathbf{m}_2^{\phi}-\mathbf{m}_1^{\phi})(\mathbf{m}_2^{\phi}-\mathbf{m}_1^{\phi})^{\text{T}} \\ \mathbf{S}_W^{\phi} & = \sum_{i=1,2}\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}}, \end{align}


and


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

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

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


\mathbf{w} = \sum_{i=1}^l\alpha_i\phi(\mathbf{x}_i).

Then note that

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \mathbf{w}^{\text{T}}\mathbf{m}_i^{\phi} = \frac{1}{l_i}\sum_{j=1}^{l}\sum_{k=1}^{l_i}\alpha_jk(\mathbf{x}_j,\mathbf{x}_k^i) = \mathbf{\alpha}^{\text{T}}\mathbf{M}_i,


where


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

The numerator of J(\mathbf{w}) can then be written as:

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \begin{align} \mathbf{w}^{\text{T}}\mathbf{S}_B^{\phi}\mathbf{w} & = \mathbf{w}^{\text{T}}(\mathbf{m}_2^{\phi}-\mathbf{m}_1^{\phi})(\mathbf{m}_2^{\phi}-\mathbf{m}_1^{\phi})^{\text{T}}\mathbf{w} \\ & = \mathbf{\alpha}^{\text{T}}\mathbf{M}\mathbf{\alpha}, \end{align}

where Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \mathbf{M} = (\mathbf{M}_2-\mathbf{M}_1)(\mathbf{M}_2-\mathbf{M}_1)^{\text{T}} . Similarly, the denominator can be written as

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \mathbf{w}^{\text{T}}\mathbf{S}_W^{\phi}\mathbf{w}=\mathbf{\alpha}^{\text{T}}\mathbf{N}\mathbf{\alpha},


where

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \mathbf{N} = \sum_{j=1,2}\mathbf{K}_j(\mathbf{I}-\mathbf{1}_{l_j})\mathbf{K}_j^{\text{T}},


with the Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): n^{\text{th}}, m^{\text{th}}

component of \mathbf{K}_j defined as k(\mathbf{x}_n,\mathbf{x}_m^j), \mathbf{I} is the identity matrix, and \mathbf{1}_{l_j} the matrix with all entries equal to 1/l_j. This identity can be derived by starting out with the expression for Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \mathbf{w}^{\text{T}}\mathbf{S}_W^{\phi}\mathbf{w}
and using the expansion of \mathbf{w} and the definitions of \mathbf{S}_W^{\phi} and \mathbf{m}_i^{\phi}
Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \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}(\phi(\mathbf{x}_n^j)-\mathbf{m}_j^{\phi})(\phi(\mathbf{x}_n^j)-\mathbf{m}_j^{\phi})^{\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\alpha_i\phi^{\text{T}}(\mathbf{x}_i)(\phi(\mathbf{x}_n^j)-\mathbf{m}_j^{\phi})(\phi(\mathbf{x}_n^j)-\mathbf{m}_j^{\phi})^{\text{T}} \alpha_k\phi(\mathbf{x}_k) \\ & = \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\Bigg( \alpha_i\alpha_kk(\mathbf{x}_i,\mathbf{x}_n^j)k(\mathbf{x}_k,\mathbf{x}_n^j)\right.\\ & \left.{} - \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) \left. + \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) \\ & = \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} \\ & = \mathbf{\alpha}^{\text{T}}\mathbf{N}\mathbf{\alpha}. \end{align}


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

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): J(\mathbf{\alpha}) = \frac{\mathbf{\alpha}^{\text{T}}\mathbf{M}\mathbf{\alpha}}{\mathbf{\alpha}^{\text{T}}\mathbf{N}\mathbf{\alpha}}.


Then, differentiating and setting equal to zero gives

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): (\mathbf{\alpha}^{\text{T}}\mathbf{M}\mathbf{\alpha})\mathbf{N}\mathbf{\alpha} = (\mathbf{\alpha}^{\text{T}}\mathbf{N}\mathbf{\alpha})\mathbf{M}\mathbf{\alpha}.


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


\mathbf{\alpha} = \mathbf{N}^{-1}(\mathbf{M}_2- \mathbf{M}_1).

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


\mathbf{N}_{\epsilon} = \mathbf{N}+\epsilon\mathbf{I}.

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


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

Multi-class KFD

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

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): y_i = \mathbf{w}_i^{\text{T}}\phi(\mathbf{x}) \qquad i= 1,\ldots,c-1.


This can be written in matrix notation

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \mathbf{y} = \mathbf{W}^{\text{T}}\phi(\mathbf{x}),


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

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \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}},


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

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \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}},


The solution is now obtained by maximizing

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): 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|}.


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

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \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|},


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

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \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}


The \mathbf{M}_i are defined as in the above section and \mathbf{M}_{*} is defined as


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

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

Failed to parse (Missing <code>texvc</code> executable. Please see math/README to configure.): \mathbf{y}(\mathbf{x}_t) = \left(\mathbf{A}^{*}\right)^{\text{T}}\mathbf{K}_t,


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

Classification using KFD

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


f(\mathbf{x}) = arg\min_j D(\mathbf{y}(\mathbf{x}),\bar{\mathbf{y}}_j),

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

Applications

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

See also

References

  1. 1.0 1.1 1.2 1.3 1.4 Lua error in package.lua at line 80: module 'strict' not found.
  2. 2.0 2.1 2.2 Lua error in package.lua at line 80: module 'strict' not found.
  3. 3.0 3.1 Lua error in package.lua at line 80: module 'strict' not found.
  4. Lua error in package.lua at line 80: module 'strict' not found.
  5. Lua error in package.lua at line 80: module 'strict' not found.
  6. 6.0 6.1 Lua error in package.lua at line 80: module 'strict' not found.
  7. 7.0 7.1 7.2 7.3 7.4 Lua error in package.lua at line 80: module 'strict' not found.
  8. Lua error in package.lua at line 80: module 'strict' not found.
  9. Lua error in package.lua at line 80: module 'strict' not found.
  10. Lua error in package.lua at line 80: module 'strict' not found.
  11. Lua error in package.lua at line 80: module 'strict' not found.
  12. Lua error in package.lua at line 80: module 'strict' not found.
  13. Lua error in package.lua at line 80: module 'strict' not found.
  14. Lua error in package.lua at line 80: module 'strict' not found.

External links