ArticleslgStudy

computer science

String kernel

String kernel is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand String kernel rather than just read about it. In short: 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.

Key takeaways

  • String kernel belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect String kernel to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of String kernel from memory before moving on to harder problems.

Reference excerpt

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. String kernels are used in domains where sequence data are to be clustered or classified, e.g. in text mining and gene analysis.

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. 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. 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.

Definition A kernel on a domain D {\displaystyle D} is a function K : D × D → R {\displaystyle K:D\times D\rightarrow \mathbb {R} }

satisfying some conditions (being symmetric in the arguments, continuous and positive semidefinite in a certain sense). Mercer's theorem asserts that K {\displaystyle K} can then be expressed as K ( x , y ) = φ ( x ) ⋅ φ ( y ) {\displaystyle K(x,y)=\varphi (x)\cdot \varphi (y)} with φ {\displaystyle \varphi } mapping the arguments into an inner product space. We can now reproduce the definition of a string subsequence kernel on strings over an alphabet Σ {\displaystyle \Sigma } . Coordinate-wise, the mapping is defined as follows:

φ u : { Σ n → R Σ n s ↦ ∑ i : u = s i λ l ( i ) {\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.}

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with String kernel

Start with the simplest possible case. Write down what String kernel claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to String kernel before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about String kernel ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of String kernel

In research
String kernel appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses String kernel in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
String kernel is common in secondary-school and first-year university syllabi. It links to neighbouring topics Algorithms on strings, Kernel methods for machine learning, Natural language processing, so understanding it makes those chapters shorter.
In everyday life
Look for String kernel outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “String kernel” →

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study String kernel in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what String kernel means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain String kernel out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is String kernel in simple terms?

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 stri…

Why does String kernel matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study String kernel?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on String kernel.

Tags

  • Algorithms on strings
  • Kernel methods for machine learning
  • Natural language processing
  • String metrics

Keep exploring