String kernel

From HandWiki

In machine learning and data mining, a string kernel is a kernel function that operates on strings, i.e. finite sequences of symbols that need not be of the same length. String kernels can be intuitively understood as functions measuring the similarity of pairs of strings: the more similar two strings a and b are, the higher the value of a string kernel K(a, b) will be. Using string kernels with kernelized learning algorithms such as support vector machines allow such algorithms to work with strings, without having to translate these to fixed-length, real-valued feature vectors.[1] String kernels are used in domains where sequence data are to be clustered or classified, e.g. in text mining and gene analysis.[2]

Informal introduction

Suppose one wants to compare some text passages automatically and indicate their relative similarity. For many applications, it might be sufficient to find some keywords which match exactly. One example where exact matching is not always enough is found in spam detection.[3] Another would be in computational gene analysis, where homologous genes have mutated, resulting in common subsequences along with deleted, inserted or replaced symbols.

Motivation

Since several well-proven data clustering, classification and information retrieval methods (for example support vector machines) are designed to work on vectors (i.e. data are elements of a vector space), using a string kernel allows the extension of these methods to handle sequence data.

The string kernel method is to be contrasted with earlier approaches for text classification where feature vectors only indicated the presence or absence of a word. Not only does it improve on these approaches, but it is an example for a whole class of kernels adapted to data structures, which began to appear at the turn of the 21st century. A survey of such methods has been compiled by Gärtner.[4]

In bioinformatics string kernels are used especially to transform biological sequences such as proteins or DNA into vectors for further use in machine learning models. An example of a string kernel used for that purpose is the profile kernel.[5]

Definition

A kernel on a domain [math]\displaystyle{ D }[/math] is a function [math]\displaystyle{ K: D \times D \rightarrow \mathbb{R} }[/math] satisfying some conditions (being symmetric in the arguments, continuous and positive semidefinite in a certain sense).

Mercer's theorem asserts that [math]\displaystyle{ K }[/math] can then be expressed as [math]\displaystyle{ K(x,y)=\varphi(x)\cdot \varphi(y) }[/math] with [math]\displaystyle{ \varphi }[/math] mapping the arguments into an inner product space.

We can now reproduce the definition of a string subsequence kernel[1] on strings over an alphabet [math]\displaystyle{ \Sigma }[/math]. Coordinate-wise, the mapping is defined as follows:

[math]\displaystyle{ \varphi_u : \left\{ \begin{array}{l} \Sigma^n \rightarrow \mathbb{R}^{\Sigma^n} \\ s \mapsto \sum_{\mathbf{i} : u=s_{\mathbf{i}}} \lambda^{l(\mathbf{i})} \end{array} \right. }[/math]

The [math]\displaystyle{ \mathbf{i} }[/math] are multiindices and [math]\displaystyle{ u }[/math] is a string of length [math]\displaystyle{ n }[/math]: subsequences can occur in a non-contiguous manner, but gaps are penalized. The multiindex [math]\displaystyle{ \mathbf{i} }[/math] gives the positions of the characters matching [math]\displaystyle{ u }[/math] in [math]\displaystyle{ s }[/math]. [math]\displaystyle{ l(\mathbf{i}) }[/math] is the difference between the first and last entry in [math]\displaystyle{ \mathbf{i} }[/math], that is: how far apart in [math]\displaystyle{ s }[/math] the subsequence matching [math]\displaystyle{ u }[/math] is. The parameter [math]\displaystyle{ \lambda }[/math] may be set to any value between [math]\displaystyle{ 0 }[/math] (gaps are not allowed, as only [math]\displaystyle{ 0^0 }[/math] is not [math]\displaystyle{ 0 }[/math] but [math]\displaystyle{ 1 }[/math]) and [math]\displaystyle{ 1 }[/math] (even widely-spread "occurrences" are weighted the same as appearances as a contiguous substring, as [math]\displaystyle{ 1^{l(\mathbf{i})}=1 }[/math]).


For several relevant algorithms, data enters into the algorithm only in expressions involving an inner product of feature vectors, hence the name kernel methods. A desirable consequence of this is that one does not need to explicitly calculate the transformation [math]\displaystyle{ \phi(x) }[/math], only the inner product via the kernel, which may be a lot quicker, especially when approximated.[1]

References

  1. 1.0 1.1 1.2 Lodhi, Huma; Saunders, Craig; Shawe-Taylor, John; Cristianini, Nello; Watkins, Chris (2002). "Text classification using string kernels". Journal of Machine Learning Research: 419–444. 
  2. Leslie, C.; Eskin, E.; Noble, W.S. (2002), "The spectrum kernel: A string kernel for SVM protein classification", Proceedings of the Pacific Symposium on Biocomputing, 7, pp. 566–575, PMID 11928508 
  3. Amayri, O. (2009), "Improved Online Support Vector Machines Spam Filtering Using String Kernels", Progress in Pattern Recognition, Image Analysis, Computer Vision, and Applications, Lecture Notes in Computer Science, 5856, p. 621, doi:10.1007/978-3-642-10268-4_73, ISBN 978-3-642-10267-7, Bibcode2009LNCS.5856..621A 
  4. Gärtner, T. (2003), "A survey of kernels for structured data", ACM SIGKDD Explorations Newsletter (ACM) 5 (1): 58, doi:10.1145/959242.959248 
  5. Kuang, Rui; Ie, Eugene; Wang, Ke; Wang, Kai; Siddiqi, Mahira; Freund, Yoav; Leslie, Christina (2005-06-01). "Profile-based string kernels for remote homology detection and motif extraction". Journal of Bioinformatics and Computational Biology 3 (3): 527–550. doi:10.1142/s021972000500120x. ISSN 0219-7200. PMID 16108083.