Dictionary of Applied Machine Learning
Typeset PDF version — the authoritative form of this entry
Python demo — a script that recomputes what this entry states and prints one line per check
A Hilbert space is an inner product space that is complete: every Cauchy sequence of its elements has a limit that again belongs to the space. Three examples are used throughout machine learning (ML): the Euclidean space of a fixed dimension, the space of random variables (RVs) with finite variance on a common probability space, and a reproducing kernel Hilbert space (RKHS). Linear regression uses a Euclidean space as its feature space and to parameterize its hypothesis space. Optimal estimation amounts to a projection in a Hilbert space consisting of RVs. A kernel method uses an RKHS as its transformed feature space and as its hypothesis space.
B-cauchyConsider some machine learning (ML) method with a hypothesis space that is equipped with a metric, i.e., a metric space. An iterative training method improves a hypothesis step by step, producing a sequence $\hypothesis^{(1)}, \hypothesis^{(2)}, \ldots$ of hypotheses. To ensure that this sequence converges to some optimal hypothesis $\hypothesis^{\star}$, it is necessary that the hypotheses are increasingly close to each other, i.e., that they form a Cauchy sequence. Being a Cauchy sequence is not sufficient on its own. What turns it into convergence for every such sequence is a property of the underlying metric space, namely that it is complete. A prime example of a complete metric space is a Euclidean space $\reals^{\nrfeatures}$ of finite dimension $\nrfeatures$.
B-rvspaceA Hilbert space is a
generalization of a Euclidean space to possibly infinite dimensions.
In particular, a Hilbert space $(\hilbertspace, \innerprod{\cdot}{\cdot})$ is an
inner product space in which
every Cauchy sequence of its elements has a limit that again
belongs to $\hilbertspace$ (Bauschke and Combettes, 2011, Sect. 1.12)
(see Fig. 1).
pythondemos/hilbertspace.py
Three examples of Hilbert spaces are used throughout ML: the Euclidean space $\reals^{\featuredim}$ of feature vectors, the space of RVs with finite variance on a common probability space, and a reproducing kernel Hilbert space (RKHS) of functions. The first of them carries the standard inner product $\innerprod{\vu}{\vv} = \vu^{\top} \vv$, and its completeness follows from that of the real numbers (Rudin, 1976, Thm. 3.11). Linear regression uses the Euclidean space $\reals^{\featuredim}$ in two roles. The feature vectors $\featurevec \in \reals^{\featuredim}$ of the data points it is applied to are vectors of this space, and so are the weights $\weights \in \reals^{\featuredim}$ that parameterize its hypothesis space $\big\{ \hypothesis(\featurevec) = \innerprod{\weights}{\featurevec} \, : \, \weights \in \reals^{\featuredim} \big\}$. Gradient descent (GD) searching for those weights produces a sequence $\weights^{(1)}, \weights^{(2)}, \ldots$ of model parameters. These are vectors in the second role, so the question the opening paragraph asks has a reassuring answer here: $\reals^{\featuredim}$ is complete, and a Cauchy sequence of model parameters converges to model parameters.
The second example is the set of all RVs $x$ with finite variance, defined on a common probability space (Gray and Davisson, 2004, Sect. 5.8.1). Here, two RVs are identified whenever the expectation of their squared difference is zero, $\expect\big\{ (x - x')^{2} \big\} = 0$, i.e., whenever $x = x'$ with probability one. With this identification, the expectation $\innerprod{x}{x'} \defeq \expect\{ x x' \}$ is an inner product, and the resulting space is complete (Gray and Davisson, 2004, Lem. 5.1).
B-projIn the Hilbert space of finite-variance RVs on a common
probability space, optimal linear estimation is an
orthogonal projection
(see Fig. 2). A linear
estimator $\predictedlabel$ of an RV $\truelabel$
from an observed RV $\feature$ is an element of the
subspace $\big\{ a \feature \, : \, a \in \reals \big\}$
spanned by $\feature$. The corresponding estimation error
$\truelabel - \predictedlabel$
is measured by the induced norm
$\sqrt{\innerprod{\truelabel - \predictedlabel}{\truelabel - \predictedlabel}}$.
The smallest error is obtained by the linear estimator whose
error is orthogonal to $\feature$ (Gray and Davisson, 2004, Thm. 4.9),
\begin{align}
0 & = \innerprod{\truelabel - \predictedlabel}{\feature} \nonumber \\
& = \expect \big\{ \big(\truelabel - \predictedlabel \big) \feature \big\} \text{.} \nonumber
\end{align}
When the RVs $\truelabel,\feature$
are zero-mean, this orthogonality means that the error
$\truelabel - \predictedlabel$ is uncorrelated with $\feature$.
B-rkhsThe third example is an RKHS. It is a Hilbert space $\hilbertspace$ of functions $\hypothesis: \featurespace \to \reals$ whose inner product reproduces point evaluations. In particular, each RKHS is associated with a kernel $\kernelmap{\cdot}{\cdot}$ such that $\kernelmap{\featurevec}{\cdot} \in \hilbertspace$ for every $\featurevec \in \featurespace$ and \[ \hypothesis(\featurevec) = \innerprod{\hypothesis}{\kernelmap{\featurevec}{\cdot}} \quad \text{for every } \hypothesis \in \hilbertspace \text{.} \] Thus, each vector $\hypothesis \in \hilbertspace$ is itself a hypothesis map $\featurespace \to \reals$, evaluated by taking an inner product with $\kernelmap{\featurevec}{\cdot}$. This construction of a hypothesis map generalizes the linear model, which uses the standard inner product of the Euclidean space. The map $\featurevec \mapsto \kernelmap{\featurevec}{\cdot}$ is a feature transformation, carrying the feature vector of a data point into $\hilbertspace$. A kernel method uses an RKHS in two roles. It is the transformed feature space, in which a data point is represented by $\kernelmap{\featurevec}{\cdot}$, and it is the hypothesis space from which a hypothesis is learned (Hastie et al., 2009, Sect. 12.3.3; Schölkopf and Smola, 2002). These are the two roles of $\reals^{\featuredim}$ in linear regression, with one difference: there a vector parameterizes a hypothesis, here a vector is one.
See also: inner product, vector space, norm, Cauchy sequence, Euclidean space, random variable, variance, expectation, conditional expectation, reproducing kernel Hilbert space, kernel method, orthogonal projection.
@misc{dictml_hilbertspace,
author = {Jung, Alexander},
title = {Hilbert space},
howpublished = {Dictionary of Applied Machine Learning (course edition)},
year = {2026},
doi = {10.5281/zenodo.21569296},
note = {ISBN 978-952-64-3013-3, CC BY 4.0, retrieved 2026-08-21},
url = {https://dictionaryofml.org/terms/hilbertspace.html}
}