Perceptron algorithm learns the weights for features. It functions if there is a hyperplane dividing dataset into two classes, which means data is linearly seperable.

Set a=d=1Dwdxda=\sum_{d=1}^D w_dx_d. xdx_d is the ddth feature of an input vector(sample, instance). wdw_d is the ddth weight corresponding to dth feature. If a0a \ge 0, it "fires".

For mathmetical convinience, threshold can be added into weight vector as w0w_0. Meanwhile x0=1x_0 = 1 is added into input vector.