ML perceptron

Read this in "about 4 minutes".

Perceptron is a linear classifier which is the basis of SVM and neural network.

Input & output

the input , d is the dimension of feature vector x.

the output , y is the true / false label set.

Main idea

The only thing is about the trained weight matrix .

Learning method

First, randomly initialize the , then correct it via the samples that are wrongly classified.

1.When the training step is , the matrix is , then a mistake point can be checked via the following condition

2.The next step is to correct , the M is the wrongly classified points set, there are two ways of thinking:

  • Stochastic gradient descent
      considering the natural solution is to set the number of the wrongly classified points as loss function, but it is not easy to optimize, so to use the cumulative distance of all wrong points instead.

  The distance of point to the line is

  The cumulative distances of wrong points to the line is

  Simplify the , the loss function is

  do SGD, get the update rule

  (Note that here we can also set learning rate when update, default is 1.)

  • Two-dimension illustration
19012401.png

When the point is wrongly classified, if the true label is +1, then the false , it means the angle between and is larger than 90 percent, then do will lower the angle.

For another side, if the true label is -1, then the false , it means the angle between and is less than 90 percent, then do will enlarge the angle.

So the update rule should be .

Halt proof

Since we know to update is to correct, to get closer to the perfect classifier, and there do exists a perfect to stop the training process, then it is necessary to prove the process of learning will halt.

1.First, since is the perfect weight matrix, the space is , there should be an instance that is closest to the space.
For any instance ,

Then to update by correcting the point ,


It means that is getting larger, but we still need to prove that the is not getting too large, then it can be proved the angle between and is getting smaller.


2.How many times to update until halt? That is to calculate the following formula: given,
since,

so


Example in practise

IPython file

Goodbye!


Author

Typing Theme

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Tempora non aut eos voluptas debitis unde impedit aliquid ipsa.

 The comment for this post is disabled.