The perceptron algorithm is an online learning algorithm that operates by a principle called "error-driven learning". It iteratively improves a model by running it on training samples, then updating the model whenever it finds it has made an incorrect classification with respect to a supervised signal. The model learned by the standard perceptron algorithm is a linear binary classifier: a vector of weights that is used to classify a sample vector as class "one" or class "minus one" according to where a zero is arbitrarily mapped to one or minus one. In pseudocode, the perceptron algorithm is given by:
By contrast with the linear models learned by the perceptron, a kernel machine is a classifier that stores a subset of its training examples, associates with each a weight, and makes decisions for new samples by evaluating Here, is some kernel function. Formally, a kernel function is a non-negative semidefinite kernel, representing an inner product between samples in a high-dimensional space, as if the samples had been expanded to include additional features by a function :. Intuitively, it can be thought of as a similarity function between samples, so the kernel machine establishes the class of a new sample by weighted comparison to the training set. Each function serves as a basis function in the classification.
Algorithm
To derive a kernelized version of the perceptron algorithm, we must first formulate it in dual form, starting from the observation that the weight vector can be expressed as a linear combination of the training samples. The equation for the weight vector is where is the number of times was misclassified, forcing an update. Using this result, we can formulate the dual perceptron algorithm, which loops through the samples as before, making predictions, but instead of storing and updating a weight vector, it updates a "mistake counter" vector. We must also rewrite the prediction formula to get rid of : Plugging these two equations into the training loop turn it into the dual perceptron algorithm. Finally, we can replace the dot product in the dual perceptron by an arbitrary kernel function, to get the effect of a feature map without computing explicitly for any samples. Doing this yields the kernel perceptron algorithm:
Variants and extensions
One problem with the kernel perceptron, as presented above, is that it does not learn sparse kernel machines. Initially, all the are zero so that evaluating the decision function to get requires no kernel evaluations at all, but each update increments a single, making the evaluation increasingly more costly. Moreover, when the kernel perceptron is used in an online setting, the number of non-zero and thus the evaluation cost grow linearly in the number of examples presented to the algorithm. The forgetron variant of the kernel perceptron was suggested to deal with this problem. It maintains an active set of examples with non-zero, removing examples from the active set when it exceeds a pre-determined budget and "shrinking" old examples as new ones are promoted to non-zero. Another problem with the kernel perceptron is that it does not regularize, making it vulnerable to overfitting. The NORMA online kernel learning algorithm can be regarded as a generalization of the kernel perceptron algorithm with regularization. The sequential minimal optimization algorithm used to learn support vector machines can also be regarded as a generalization of the kernel perceptron. The voted perceptron algorithm of Freund and Schapire also extends to the kernelized case, giving generalization bounds comparable to the kernel SVM.