Dictionary of Applied Machine Learning: 151 machine-learning terms, each with a definition, a figure, citations and a Python demo · All terms · Demos · Start here
Updated on 2026-11-16
Readiness 100/100
See also binary classification decision boundary decision region logistic regression support vector machine empirical risk minimization $\bf 0/1$ loss ridge regression feature transformation
A linear classifier is a classifier whose decision regions are separated by hyperplanes. Each linear classifier is obtained by comparing the value of a linear hypothesis map against a threshold. For binary classification, the sign of the value can be used to determine the predicted label, and the absolute value divided by the Euclidean norm of the weight vector is the distance of the data point from the decision boundary. The model parameters of a linear classifier are the weight vector of the underlying hypothesis map and the offset. They are learned by empirical risk minimization (ERM) with different loss functions: logistic regression uses the logistic loss and the support vector machine (SVM) the hinge loss. For multi-class classification, a linear classifier is characterized by several linear model hypothesis maps, one per label value, and the resulting decision regions are intersections of halfspaces.

linclass.py, which recomputes what the entry states: the script block by block · open in ColabB-fitAn aerial photograph of a wine-growing
region is divided into small areas, and each area is to be classified as
vineyard or not. Each area is a data point characterized by two
features obtained from the photograph
(Fig. 1). The label of each area indicates whether
the area belongs to a vineyard ($y = 1$) or not
($y = -1$). The labeled areas form the training set. A
linear classifier separates the two classes by a straight line, its
decision boundary, which is fixed by a normal vector, and
it classifies a new area by its signed distance from that
line.
pythondemos/linclass.py
Consider a feature vector ${\mathbf x}$ and any vector ${\mathbf x}'$ on the decision boundary, $h({\mathbf x}') = 0$. Subtracting ${\mathbf w}^{\top} {\mathbf x}' + b = 0$ from $h({\mathbf x})$ gives \[ h({\mathbf x}) = {\mathbf w}^{\top} \big( {\mathbf x} - {\mathbf x}' \big) \text{.} \] The Cauchy-Schwarz inequality bounds the right-hand side in magnitude by $\left\lVert {\mathbf w} \right\rVert_{2} \left\lVert {\mathbf x} - {\mathbf x}' \right\rVert_{2}$ (Axler, 2024, Thm. 6.14). Every vector of the decision boundary is therefore at distance at least $|h({\mathbf x})| / \left\lVert {\mathbf w} \right\rVert_{2}$ from ${\mathbf x}$. That distance is attained by the orthogonal projection \[ {\mathbf x}' = {\mathbf x} - \frac{h({\mathbf x})} {\left\lVert {\mathbf w} \right\rVert_{2}^{2}} \, {\mathbf w} \text{.} \] The distance of ${\mathbf x}$ from the decision boundary is thus $|h({\mathbf x})| / \left\lVert {\mathbf w} \right\rVert_{2}$ (Bishop, 2006, Sect. 4.1.1; Hastie et al., 2009, Sect. 4.5, Eq. (4.40)). Fig. 1 illustrates the distance to the decision boundary for one data point.
B-scaleThe value $|h({\mathbf x})|$ is a measure of the noise tolerance at the feature vector ${\mathbf x}$. Perturbing ${\mathbf x}$ by a vector $\boldsymbol{\delta}$ changes the hypothesis value by ${\mathbf w}^{\top} \boldsymbol{\delta}$, which the Cauchy-Schwarz inequality bounds in magnitude by $\left\lVert {\mathbf w} \right\rVert_{2} \left\lVert \boldsymbol{\delta} \right\rVert_{2}$. The sign of $h({\mathbf x})$, and with it the prediction, is therefore unchanged by every perturbation with $\left\lVert \boldsymbol{\delta} \right\rVert_{2} < |h({\mathbf x})| / \left\lVert {\mathbf w} \right\rVert_{2}$.
Multiplying $h({\mathbf x})$ by the label $y$ gives the margin. A positive margin means that the data point is correctly classified, a negative margin that it is misclassified, and a zero margin that it lies on the decision boundary, where the rule above assigns $\widehat{y} = 1$.
The model parameters $({\mathbf w}, b)$ are learned from a training set $\mathcal{D}^{(\rm train)} = \{ ({\mathbf x}^{(r)}, y^{(r)}) \}_{r = 1}^{m}$ by empirical risk minimization (ERM). Using the $0/1$ loss results in an objective function that is piecewise constant, and minimizing it is computationally hard in general (Shalev-Shwartz and Ben-David, 2014, Sect. 9.1). Practical methods replace the $0/1$ loss by a convex loss of the margin: logistic regression uses the logistic loss and the support vector machine (SVM) uses the hinge loss. For a linearly separable training set, the SVM with a sufficiently small regularization parameter $\alpha$, the factor that scales its penalty term, learns the linear classifier whose smallest margin is largest (Shalev-Shwartz and Ben-David, 2014, Sect. 15.1, Eq. (15.1)). Both learn the model parameters of a linear classifier by minimizing a convex objective function: gradient descent (GD) minimizes the smooth objective function of logistic regression, and subgradient descent the non-smooth objective function of the SVM (Murphy, 2012, Sect. 8.3.2; Shalev-Shwartz and Ben-David, 2014, Sect. 14.2.3, Example 14.2). The squared error loss is a function of the margin as well, since $(y - h({\mathbf x}))^{2} = (1 - y \, h({\mathbf x}))^{2}$ for $y \in \{-1, +1\}$, so linear regression, ridge regression, and least absolute shrinkage and selection operator (Lasso) applied to the labels $\pm 1$ also learn linear classifiers (Bishop, 2006, Sect. 4.1.3).
B-robustFor multi-class problems, with label space $\mathcal{Y} = \{1,
\ldots, K\}$ and $K > 2$, a linear
classifier uses one
linear model hypothesis
$g_{c}({\mathbf x}) = \big( {\mathbf w}^{(c)}
\big)^{\top} {\mathbf x} + b^{(c)}$ per
label value $c \in \mathcal{Y}$ and predicts the
value with the largest score,
$\widehat{y} = \mathop{\mathrm{arg\,max}}_{c \in \mathcal{Y}}
g_{c}({\mathbf x})$. The decision region
$\mathcal{R}_{c}$ is then an intersection of
$K - 1$ halfspaces and is therefore a
convex set. The border between two decision regions
$\mathcal{R}_{c}$ and $\mathcal{R}_{c'}$ lies in the
hyperplane on which the two scores agree
(Bishop, 2006, Sect. 4.1.2, Eq. (4.10)). The resulting
partition of the feature space is shown in
Fig. 2 for a linear classifier
with $K = 3$ classes.
See also: classifier, binary classification, decision boundary, decision region, hyperplane, halfspace, linear model, margin, logistic regression, support vector machine, empirical risk minimization, $\bf 0/1$ loss, ridge regression, least absolute shrinkage and selection operator, feature transformation.
@misc{dictml_linclass,
author = {Jung, Alexander},
editor = {Olioumtsevits, Konstantina and Schnoor, Ekkehard},
title = {linear classifier},
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-11-26},
url = {https://dictionaryofml.org/terms/linclass.html}
}