Tutorials › Multi-Omics Data Integration › Linear, Polynomial, and Gaussian Omics Kernels

Similarity Network Fusion and Kernel Methods · Tutorial 338 of 597

Linear, Polynomial, and Gaussian Omics Kernels

Learn to calculate three standard omics kernels and diagnose the similarity patterns created by their parameters and preprocessing.

Advanced 9 min read

What You'll Learn

  • Calculate linear, polynomial, and Gaussian kernel entries from patient profiles.
  • Interpret how profile magnitude and direction affect a linear kernel.
  • Explain how polynomial degree and offset alter similarity patterns.
  • Choose and interpret the Gaussian bandwidth using squared profile distances.
  • Check kernel assumptions, preprocessing, and common parameter-related failure modes.

Why Choose Among Omics Kernels?

A kernel matrix records pairwise similarities between patient profiles, but the word “similarity” does not specify what pattern is being emphasized. A linear kernel rewards profiles with aligned feature values and can reflect their magnitudes. A polynomial kernel can emphasize higher-order combinations of features. A Gaussian kernel makes similarity depend on how close two profiles are in the chosen feature space, with a bandwidth parameter controlling how quickly similarity decays with distance. These distinctions matter before a kernel is used to represent patient relationships.

Here, \(x_i\in\mathbb{R}^p\) denotes the \(p\)-feature profile for patient \(i\), and \(K_{ij}\) is the kernel similarity between patients \(i\) and \(j\). All profiles in a kernel calculation must use the same features, in the same order, and the same preprocessing. In multi-omics work, this generally means that a particular kernel is calculated within a specified omics view. Features measured on very different scales can dominate dot products or distances unless they are transformed appropriately.

Definition: Given profiles \(x_1,\ldots,x_n\), a kernel function \(k(x_i,x_j)\) assigns a similarity to each pair, and the corresponding kernel matrix has entries \(K_{ij}=k(x_i,x_j)\). A valid positive semidefinite kernel produces a symmetric matrix for which \(a^\mathsf{T}Ka\geq 0\) for every real vector \(a\). The three kernels studied here are the linear kernel, the polynomial kernel, and the Gaussian (radial basis function) kernel.

Three Kernel Definitions

The linear kernel is the dot product of the two profiles. It is a direct measure of alignment in the original feature coordinates, affected by both profile direction and profile magnitude.

$$ k_{\mathrm{lin}}(x_i,x_j)=x_i^\mathsf{T}x_j $$

The polynomial kernel transforms the dot product before comparing profiles. A common form is \(k_{\mathrm{poly}}(x_i,x_j)=(\gamma x_i^\mathsf{T}x_j+c)^d\), where \(d\) is a positive integer, \(\gamma\geq 0\), and \(c\geq 0\). The parameter \(c\) is the offset; it affects the contribution of lower-order terms. The parameter \(\gamma\) scales the dot product. Higher degree can make the kernel more sensitive to strong dot products and to combinations of features.

$$ k_{\mathrm{poly}}(x_i,x_j)=(\gamma x_i^\mathsf{T}x_j+c)^d $$

The Gaussian kernel is an exponential function of squared Euclidean distance. With \(\gamma>0\), nearby profiles have similarity near one, while more distant profiles have smaller similarity. This convention uses \(\gamma\) as the inverse distance-scale parameter: increasing \(\gamma\) makes similarity decay more rapidly.

$$ k_{\mathrm{Gauss}}(x_i,x_j)=\exp\!\left(-\gamma\lVert x_i-x_j\rVert^2\right) $$

For the Gaussian kernel, \(\gamma\) has units inverse to squared feature distance. If all features are dimensionless standardized measurements, \(\gamma\) is dimensionless in that standardized coordinate system. The Gaussian kernel always has \(K_{ii}=1\). By contrast, linear and polynomial self-similarities can vary with profile magnitude.

Why These Kernels Are Positive Semidefinite

The positive semidefinite property matters because it guarantees a coherent kernel similarity representation. The linear case is immediate: for any \(a\in\mathbb{R}^n\),

$$ a^\mathsf{T}Ka =\sum_{i=1}^n\sum_{j=1}^n a_i a_j x_i^\mathsf{T}x_j =\left\lVert\sum_{i=1}^n a_i x_i\right\rVert^2 \geq 0. $$

For the polynomial kernel, expand by the binomial theorem:

$$ (\gamma x_i^\mathsf{T}x_j+c)^d =\sum_{m=0}^{d}\binom{d}{m}\gamma^m c^{d-m}(x_i^\mathsf{T}x_j)^m. $$

Each term is positive semidefinite. For \(m\geq1\), \((x_i^\mathsf{T}x_j)^m\) is the dot product between the \(m\)-fold tensor products \(x_i^{\otimes m}\) and \(x_j^{\otimes m}\); for \(m=0\), the term is the constant kernel. Every coefficient in the expansion is nonnegative under the stated conditions. A nonnegative weighted sum of positive semidefinite matrices is positive semidefinite, so the polynomial kernel is valid.

For the Gaussian kernel, use the identity \(\lVert x_i-x_j\rVert^2=\lVert x_i\rVert^2+\lVert x_j\rVert^2-2x_i^\mathsf{T}x_j\):

$$ \exp(-\gamma\lVert x_i-x_j\rVert^2) =\exp(-\gamma\lVert x_i\rVert^2) \exp(-\gamma\lVert x_j\rVert^2) \exp(2\gamma x_i^\mathsf{T}x_j). $$

The last factor has the power-series expansion \(\sum_{m=0}^{\infty}(2\gamma)^m(x_i^\mathsf{T}x_j)^m/m!\). Each power term is positive semidefinite by the tensor-product argument above, and its coefficient is nonnegative. Thus the series gives a positive semidefinite matrix. Multiplying its \(i,j\) entry by \(q_iq_j\), where \(q_i=\exp(-\gamma\lVert x_i\rVert^2)\), preserves positive semidefiniteness: the resulting quadratic form is the original one evaluated at the vector with entries \(a_iq_i\). This establishes the Gaussian kernel’s positive semidefiniteness.

Worked Example: A Linear Kernel for Three Profiles

Suppose three hypothetical patients have two standardized expression features, with profiles \(A=(1,0)\), \(B=(0,1)\), and \(C=(1,1)\). Standardization and common feature ordering are assumed to have been applied consistently. Calculate the linear kernel matrix.

The relevant dot products are \(A^\mathsf{T}A=1\), \(B^\mathsf{T}B=1\), \(C^\mathsf{T}C=2\), \(A^\mathsf{T}B=0\), and \(A^\mathsf{T}C=B^\mathsf{T}C=1\). Therefore,

$$ K_{\mathrm{lin}}= \begin{pmatrix} 1&0&1\\ 0&1&1\\ 1&1&2 \end{pmatrix}. $$

Patients \(A\) and \(B\) have orthogonal profiles, so their dot product is zero. Patient \(C\) has a positive dot product with each, and its self-similarity is 2 because it has squared norm 2. These values describe dot-product similarity, not a correlation: in particular, they have not been divided by the profile norms.

Worked Example: A Degree-Two Polynomial Kernel

Use the same hypothetical profiles \(A\), \(B\), and \(C\), but set \(\gamma=1\), \(c=1\), and \(d=2\). For any pair, calculate \(K_{ij}=(x_i^\mathsf{T}x_j+1)^2\). For \(A\) with \(B\), the dot product is zero, so \(K_{AB}=(0+1)^2=1\). For \(A\) with \(C\), it is one, so \(K_{AC}=(1+1)^2=4\). The diagonal entries are \(K_{AA}=(1+1)^2=4\), \(K_{BB}=4\), and \(K_{CC}=(2+1)^2=9\). Thus,

$$ K_{\mathrm{poly}}= \begin{pmatrix} 4&1&4\\ 1&4&4\\ 4&4&9 \end{pmatrix}. $$

Compared with the linear kernel, the offset makes even the zero-dot-product pair have a positive similarity. The square then increases the value for larger dot products. The entries are not probabilities and need not be bounded above by one. They also depend on the chosen feature scale, degree, and offset.

Worked Example: A Gaussian Kernel and Its Bandwidth

Consider three hypothetical patients with profiles \(U=(0,0)\), \(V=(1,0)\), and \(W=(2,0)\), in two consistently scaled features. Let \(\gamma=0.5\) per squared feature unit. Their squared distances are \(\lVert U-V\rVert^2=1\), \(\lVert V-W\rVert^2=1\), and \(\lVert U-W\rVert^2=4\). Hence,

$$ K_{UV}=K_{VW}=e^{-0.5(1)}\approx0.6065,\qquad K_{UW}=e^{-0.5(4)}=e^{-2}\approx0.1353. $$

Every diagonal entry is \(e^0=1\), so the matrix is approximately

$$ K_{\mathrm{Gauss}}= \begin{pmatrix} 1&0.6065&0.1353\\ 0.6065&1&0.6065\\ 0.1353&0.6065&1 \end{pmatrix}. $$

The equally spaced neighboring pairs receive equal similarity, while the pair four squared units apart receives a lower value. If \(\gamma\) were increased, all three off-diagonal similarities would decrease, but the more distant pair would decline more sharply.

How the Similarity Patterns Differ

KernelSimilarity emphasizesParameter or scale sensitivityUseful diagnostic
LinearDot-product alignment and profile magnitudeFeature scales and large profile normsInspect norms and the range of off-diagonal entries
PolynomialDot products transformed to emphasize higher-order combinationsFeature scales, degree \(d\), offset \(c\), and scale \(\gamma\)Inspect diagonals and whether a few entries dominate
GaussianCloseness under Euclidean distanceFeature scales and bandwidth parameter \(\gamma\)Inspect off-diagonal values and the fraction near zero or one

A cosine similarity is a useful comparison for linear dot products: it divides a dot product by the product of the two profile norms, emphasizing direction rather than magnitude. It is not the same as the linear kernel, and a cosine-based construction must be assessed under its own conventions. A distance-based approach describes separation directly; the Gaussian kernel converts squared distance into a bounded similarity. The distance-based kernel tutorial treats that conversion more broadly, while the present formulas specify three common choices and their distinct patterns.

A Gaussian kernel with very small \(\gamma\) can make nearly all patient pairs appear similar, since \(\exp(-\gamma d^2)\) is then close to one over the observed distance range. With very large \(\gamma\), distinct profiles can have similarities close to zero, leaving a matrix close to the identity. Neither pattern is automatically informative. Polynomial kernels can likewise be dominated by a few large dot products, particularly when feature scales or profile norms vary substantially.

Assumptions, Diagnostics, and Limitations

The formulas assume that each patient is represented by a well-defined vector with the same features in the same order. Euclidean distances and dot products are meaningful only relative to the chosen representation and its scaling. Before calculating a kernel, decide how to handle missing values and transform features; do not calculate pairwise distances on different feature subsets and treat them as if all entries came from one common geometry. If a kernel is to be used with methods requiring a valid kernel matrix, also retain the parameter restrictions that guarantee positive semidefiniteness.

Useful checks include confirming symmetry, verifying the expected diagonal (one for the Gaussian kernel), and inspecting off-diagonal ranges and profile norms. A materially negative eigenvalue beyond numerical tolerance can signal an implementation error, inconsistent preprocessing, or a construction that is not positive semidefinite. Small numerical negatives can arise from rounding, so they should be assessed relative to matrix scale and computation precision rather than interpreted automatically as a substantive failure.

  • Scale dominance: if one feature has much larger numerical variation than others, it can dominate dot products or squared distances. Check feature scales and use a scientifically defensible transformation.
  • Gaussian saturation: if nearly all off-diagonal entries are near zero or near one, the chosen bandwidth may not resolve meaningful variation in this data set. Compare the kernel values with the distribution of pairwise distances.
  • Polynomial explosion: a high degree or large dot products can produce very large entries. Check whether a small number of profiles dominate the range; changing degree or scaling should be considered on scientific grounds.
  • Magnitude mistaken for resemblance: a large linear dot product can reflect large norms, not just similar profile direction. Examine norms or use a direction-focused alternative when that is the intended notion.

These kernels do not establish biological causation, remove batch effects, or guarantee that the resulting similarities capture a clinically relevant structure. They express geometry in the supplied feature space. Their usefulness therefore depends on preprocessing, parameter choice, and whether the represented geometry matches the scientific question. Centering or normalizing a kernel can also change its entries and interpretation; any such transformation should be applied consistently and checked for its intended properties.

Key takeaway: A kernel’s formula is a choice about what counts as similar. Linear kernels emphasize dot products, polynomial kernels transform dot products to emphasize higher-order structure, and Gaussian kernels emphasize proximity at a scale controlled by \(\gamma\). Check feature scaling and resulting matrix patterns before interpreting patient similarities.

Check Your Understanding

Answer each question, then compare your reasoning with the solutions below.

  1. For \(x=(1,2)\) and \(y=(2,0)\), calculate the linear kernel value and the degree-two polynomial kernel value using \(\gamma=1\) and \(c=1\).
  2. For a Gaussian kernel with \(\gamma=0.25\), calculate the similarity for squared distance 4. What happens to that similarity if \(\gamma\) increases to 0.5?
  3. Why can a linear kernel value not generally be interpreted as a correlation?
  4. A Gaussian kernel has off-diagonal entries almost all equal to one. What is a likely explanation, and what diagnostic should be checked?

Solutions. (1) \(x^\mathsf{T}y=1(2)+2(0)=2\), so the linear value is 2 and the polynomial value is \((2+1)^2=9\). (2) At \(\gamma=0.25\), the value is \(e^{-0.25(4)}=e^{-1}\approx0.3679\). At \(\gamma=0.5\), it is \(e^{-2}\approx0.1353\), which is smaller because similarity decays more rapidly. (3) A dot product is not normalized by the profiles’ norms and is affected by magnitude; a correlation has a different centering and scaling interpretation. (4) The bandwidth may be too small relative to the observed distances, so the exponential values remain near one. Inspect the pairwise distance scale and compare it with the chosen \(\gamma\).

Clinical Biostats