<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.sarg.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=2001%3A720%3A101C%3A504%3A3850%3A56D9%3A23DD%3ADCB5</id>
	<title>Vero - Wikipedia - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.sarg.dev/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=2001%3A720%3A101C%3A504%3A3850%3A56D9%3A23DD%3ADCB5"/>
	<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php/Special:Contributions/2001:720:101C:504:3850:56D9:23DD:DCB5"/>
	<updated>2026-08-14T20:33:53Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.44.2</generator>
	<entry>
		<id>https://wiki.sarg.dev/index.php?title=Linear_classifier&amp;diff=66170</id>
		<title>Linear classifier</title>
		<link rel="alternate" type="text/html" href="https://wiki.sarg.dev/index.php?title=Linear_classifier&amp;diff=66170"/>
		<updated>2025-10-17T08:56:36Z</updated>

		<summary type="html">&lt;p&gt;2001:720:101C:504:3850:56D9:23DD:DCB5: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{short description|Statistical classification in machine learning}}&lt;br /&gt;
In [[machine learning]], a &#039;&#039;&#039;linear classifier&#039;&#039;&#039; makes a [[Statistical classification|classification]] decision for each object based on a [[linear combination]] of its [[Feature (machine learning)|features]].  A simpler definition is to say that a linear classifier is one whose decision boundaries are &#039;&#039;linear&#039;&#039;.  Such classifiers work well for practical problems such as [[document classification]], and more generally for problems with many variables ([[feature vector|features]]), reaching accuracy levels comparable to non-linear classifiers while taking less time to train and use.{{r|ieee}}&lt;br /&gt;
&lt;br /&gt;
== Definition ==&lt;br /&gt;
[[Image:Svm separating hyperplanes.png|thumb|right|In this case, the solid and empty dots can be correctly classified by any number of linear classifiers. H1 (blue) classifies them correctly, as does H2 (red). H2 could be considered &amp;quot;better&amp;quot; in the sense that it is also furthest from both groups.&lt;br /&gt;
H3 (green) fails to correctly classify the dots.]]&lt;br /&gt;
&lt;br /&gt;
If the input feature vector to the classifier is a [[real number|real]] vector &amp;lt;math&amp;gt;\vec x&amp;lt;/math&amp;gt;, then the output score is&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;y = f(\vec{w}\cdot\vec{x}) = f\left(\sum_j w_j x_j\right),&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where &amp;lt;math&amp;gt;\vec w &amp;lt;/math&amp;gt; is a real vector of weights and &#039;&#039;f&#039;&#039; is a function that converts the [[dot product]] of the two vectors into the desired output.  (In other words, &amp;lt;math&amp;gt;\vec{w}&amp;lt;/math&amp;gt; is a [[one-form]] or [[linear functional]] mapping &amp;lt;math&amp;gt;\vec x&amp;lt;/math&amp;gt; onto &#039;&#039;&#039;R&#039;&#039;&#039;.)  The weight vector &amp;lt;math&amp;gt;\vec w&amp;lt;/math&amp;gt; is learned from a set of labeled training samples. Often &#039;&#039;f&#039;&#039; is a &#039;&#039;&#039;threshold function&#039;&#039;&#039;, which maps all values of &amp;lt;math&amp;gt;\vec{w}\cdot\vec{x}&amp;lt;/math&amp;gt; above a certain threshold to the first class and all other values to the second class; e.g.,&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;&lt;br /&gt;
f(\mathbf{x}) = \begin{cases}1 &amp;amp; \text{if }\ \mathbf{w}^T \cdot \mathbf{x} &amp;gt; \theta,\\0 &amp;amp; \text{otherwise}\end{cases}&lt;br /&gt;
&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The superscript T indicates the transpose and &amp;lt;math&amp;gt; \theta &amp;lt;/math&amp;gt; is a scalar threshold. A more complex &#039;&#039;f&#039;&#039; might give the probability that an item belongs to a certain class.&lt;br /&gt;
&lt;br /&gt;
For a two-class classification problem, one can visualize the operation of a linear classifier as splitting a [[High-dimensional space|high-dimensional]] input space with a [[hyperplane]]: all points on one side of the hyperplane are classified as &amp;quot;yes&amp;quot;, while the others are classified as &amp;quot;no&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
A linear classifier is often used in situations where the speed of classification is an issue, since it is often the fastest classifier, especially when &amp;lt;math&amp;gt;\vec x&amp;lt;/math&amp;gt; is sparse. Also, linear classifiers often work very well when the number of dimensions in &amp;lt;math&amp;gt;\vec x&amp;lt;/math&amp;gt; is large, as in [[document classification]], where each element in &amp;lt;math&amp;gt;\vec x&amp;lt;/math&amp;gt; is typically the number of occurrences of a word in a document (see [[document-term matrix]]). In such cases, the classifier should be well-[[regularization (machine learning)|regularized]].&lt;br /&gt;
&lt;br /&gt;
==Generative models vs. discriminative models==&lt;br /&gt;
There are two broad classes of methods for determining the parameters of a linear classifier &amp;lt;math&amp;gt;\vec w&amp;lt;/math&amp;gt;. They can be [[Generative model|generative]] and [[Discriminative model|discriminative]] models.&amp;lt;ref&amp;gt;T. Mitchell, [https://www.cs.cmu.edu/~tom/mlbook/NBayesLogReg.pdf Generative and Discriminative Classifiers: Naive Bayes and Logistic Regression.] Draft Version, 2005&amp;lt;/ref&amp;gt;&amp;lt;ref&amp;gt;A. Y. Ng and M. I. Jordan. [http://www.cs.berkeley.edu/~jordan/papers/ng-jordan-nips01.ps On Discriminative vs. Generative Classifiers: A comparison of logistic regression and Naive Bayes.]  in NIPS 14, 2002.&amp;lt;/ref&amp;gt; Methods of the former model [[joint probability distribution]], whereas methods of the latter model [[Conditional probability distribution|conditional density functions]] &amp;lt;math&amp;gt;P({\rm class}|\vec x)&amp;lt;/math&amp;gt;. Examples of such algorithms include:&lt;br /&gt;
* [[linear discriminant analysis|Linear Discriminant Analysis]] (LDA)—assumes [[normal distribution|Gaussian]] conditional density models&lt;br /&gt;
* [[Naive Bayes classifier]] with multinomial or multivariate Bernoulli event models.&lt;br /&gt;
&lt;br /&gt;
The second set of methods includes [[discriminative model]]s, which attempt to maximize the quality of the output on a [[training set]]. Additional terms in the training cost function can easily perform [[regularization (machine learning)|regularization]] of the final model. Examples of discriminative training of linear classifiers include:&lt;br /&gt;
* [[Logistic regression]]—maximum likelihood estimation of &amp;lt;math&amp;gt;\vec w&amp;lt;/math&amp;gt; assuming that the observed training set was generated by a binomial model that depends on the output of the classifier.&lt;br /&gt;
* [[Perceptron]]—an algorithm that attempts to fix all errors encountered in the training set&lt;br /&gt;
* Fisher&#039;s Linear Discriminant Analysis—an algorithm (different than &amp;quot;LDA&amp;quot;) that maximizes the ratio of between-class scatter to within-class scatter, without any other assumptions. It is in essence a method of dimensionality reduction for binary classification.&amp;lt;ref&amp;gt;R.O. Duda, P.E. Hart, D.G. Stork, &amp;quot;Pattern Classification&amp;quot;, Wiley, (2001). {{ISBN|0-471-05669-3}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
* [[Support vector machine]]—an algorithm that maximizes the [[Margin (machine learning)|margin]] between the decision hyperplane and the examples in the training set.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Note:&#039;&#039;&#039;   Despite its name, LDA does not belong to the class of discriminative models in this taxonomy. However, its name makes sense when we compare LDA to the other main linear [[dimensionality reduction]] algorithm: [[principal components analysis]] (PCA). LDA is a [[supervised learning]] algorithm that utilizes the labels of the data, while PCA is an [[unsupervised learning]] algorithm that ignores the labels. To summarize, the name is a historical artifact.&amp;lt;ref&amp;gt;{{Cite book |last1=Duda |first1=Richard O. |title=Pattern classification |last2=Hart |first2=Peter E. |last3=Stork |first3=David G. |date=2001 |publisher=John Wiley &amp;amp; Sons, Inc |isbn=978-0-471-05669-0 |edition=Second |series=A Wiley-Interscience publication |location=New York Chichester Weinheim Brisbane Singapore Toronto |pages=117}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Discriminative training often yields higher accuracy than modeling the conditional density functions{{Citation needed|date=October 2017}}. However, handling missing data is often easier with conditional density models{{Citation needed|date=October 2017}}.&lt;br /&gt;
&lt;br /&gt;
All of the linear classifier algorithms listed above can be converted into non-linear algorithms operating on a different input space &amp;lt;math&amp;gt;\varphi(\vec x)&amp;lt;/math&amp;gt;, using the [[kernel trick]].&lt;br /&gt;
&lt;br /&gt;
===Discriminative training===&lt;br /&gt;
Discriminative training of linear classifiers usually proceeds in a [[supervised learning|supervised]] way, by means of an [[optimization algorithm]] that is given a training set with desired outputs and a [[loss function]] that measures the discrepancy between the classifier&#039;s outputs and the desired outputs. Thus, the learning algorithm solves an optimization problem of the form&amp;lt;ref name=&amp;quot;ieee&amp;quot;&amp;gt;{{cite journal |author1=Guo-Xun Yuan |author2=Chia-Hua Ho |author3=Chih-Jen Lin |title=Recent Advances of Large-Scale Linear Classification |journal=Proc. IEEE |volume=100 |issue=9 |year=2012|url=http://dmkd.cs.vt.edu/TUTORIAL/Bigdata/Papers/IEEE12.pdf |archive-url=https://web.archive.org/web/20170610105707/http://dmkd.cs.vt.edu/TUTORIAL/Bigdata/Papers/IEEE12.pdf |archive-date=2017-06-10 |url-status=live}}&amp;lt;/ref&amp;gt;&lt;br /&gt;
&lt;br /&gt;
:&amp;lt;math&amp;gt;\underset{\mathbf{w}}{\arg\min} \;R(\mathbf{w}) + C \sum_{i=1}^N L(y_i, \mathbf{w}^\mathsf{T} \mathbf{x}_i)&amp;lt;/math&amp;gt;&lt;br /&gt;
&lt;br /&gt;
where&lt;br /&gt;
&lt;br /&gt;
* {{math|&#039;&#039;&#039;w&#039;&#039;&#039;}} is a vector of classifier parameters,&lt;br /&gt;
* {{math|&#039;&#039;L&#039;&#039;(&#039;&#039;y&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;&#039;&#039;, &#039;&#039;&#039;w&#039;&#039;&#039;&amp;lt;sup&amp;gt;T&amp;lt;/sup&amp;gt;&#039;&#039;&#039;x&#039;&#039;&#039;&amp;lt;sub&amp;gt;&#039;&#039;i&#039;&#039;&amp;lt;/sub&amp;gt;)}} is a loss function that measures the discrepancy between the classifier&#039;s prediction and the true output {{mvar|y&amp;lt;sub&amp;gt;i&amp;lt;/sub&amp;gt;}} for the {{mvar|i}}&#039;th training example,&lt;br /&gt;
* {{math|&#039;&#039;R&#039;&#039;(&#039;&#039;&#039;w&#039;&#039;&#039;)}} is a [[Regularization (mathematics)|regularization]] function that prevents the parameters from getting too large (causing [[overfitting]]), and&lt;br /&gt;
* {{mvar|C}} is a scalar constant (set by the user of the learning algorithm) that controls the balance between the regularization and the loss function.&lt;br /&gt;
&lt;br /&gt;
Popular loss functions include the [[hinge loss]] (for linear SVMs) and the [[log loss]] (for linear logistic regression). If the regularization function {{mvar|R}} is [[convex function|convex]], then the above is a [[convex optimization|convex problem]].{{r|ieee}} Many algorithms exist for solving such problems; popular ones for linear classification include ([[Stochastic gradient descent|stochastic]]) [[gradient descent]], [[L-BFGS]], [[coordinate descent]] and [[Newton method]]s.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[Backpropagation]]&lt;br /&gt;
* [[Linear regression]]&lt;br /&gt;
* [[Perceptron]]&lt;br /&gt;
* [[Quadratic classifier]]&lt;br /&gt;
* [[Support vector machines]]&lt;br /&gt;
* [[Winnow (algorithm)]]&lt;br /&gt;
&lt;br /&gt;
== Notes ==&lt;br /&gt;
&amp;lt;references/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Further reading ==&lt;br /&gt;
# Y. Yang, X. Liu, &amp;quot;A re-examination of text categorization&amp;quot;, Proc. ACM SIGIR Conference, pp.&amp;amp;nbsp;42–49, (1999). [http://citeseer.ist.psu.edu/yang99reexamination.html paper @ citeseer]&lt;br /&gt;
# R. Herbrich, &amp;quot;Learning Kernel Classifiers: Theory and Algorithms,&amp;quot; MIT Press, (2001). {{ISBN|0-262-08306-X}}&lt;br /&gt;
&lt;br /&gt;
{{DEFAULTSORT:Linear Classifier}}&lt;br /&gt;
[[Category:Classification algorithms]]&lt;br /&gt;
[[Category:Statistical classification]]&lt;/div&gt;</summary>
		<author><name>2001:720:101C:504:3850:56D9:23DD:DCB5</name></author>
	</entry>
</feed>