Perceptual machine Algorithm (MATLAB)

Source: Internet
Author: User

The perceptron algorithm belongs to a relatively simple classifier algorithm, but it belongs to the construction classification super plane as the logistic regression and support vector machine.

the difference is that the perceptual machine uses the distance of the split-error sample and the classified super-plane as the loss function, The following algorithm is based on the stochastic gradient descent method, and the convergence State is achieved by asynchronous method.

function [W,b]=perceptionlearn (X,y,learningrate,maxepoch)% Perception learn algorithm% x, y row is a sample, Y value { -1,+1}[m,n]= Size (x); W=zeros (n,1); b=0;finish=true;for Epoch=1:maxepoch    for samlendex=1:m        if sign (x (Samlendex,:) *w+b) ~= Y (samlendex)            finish=false;            W=w+learningrate*y (Samlendex) *x (samlendex,:) '            %w=w/(w ' *w);            B=b+learningrate*y (Samlendex)        end    End    if finish==true break        ;    EndEnd

Test function:

CLEAR;CLC;X=[3,3;4,3;1,1];Y=[1,1,-1]; [W,b]=perceptionlearn (x,y,1,20)

Perceptual machine Algorithm (MATLAB)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.