当前位置:网站首页>Perceptron model and Application
Perceptron model and Application
2022-07-02 22:25:00 【Eric%258436】
** If there is a mistake , Thank you for correcting **
If there is a mistake , Thank you for correcting , Please send a private message to the blogger , There is a red envelope for hard work , Worship “ one-word teacher ”.
Please find the paragraphs you need according to the table of contents
Introduction : This blog is for individuals to sort out the learning records of digital analog Algorithm , If there is a mistake , Thank you for correcting . System learning , Welcome to continue to pay attention , Follow up updates
Java communication qq Group 383245788
order
The purpose of this article is to record the experience of preparing for the personal digital simulation American competition . Reprint please indicate the source .
The perceptron model involved in this paper is only a brief introduction and digital analog usage , And the application scope is small , It's a side door
Perceptron model
perceptron Pereptron) It's a two class linear classification model , The input is the eigenvector of the instance , The output is the category of the instance , take +1 and 1. The perceptron corresponds to the input space ( The feature space ) The instance is divided into positive and negative separated hyperplanes , It's a discriminant model .
The history of machine learning 
Perceptron model biological mechanism 
Input: The vector of the instance , Each column - - Features
Weight: The weight , Set initial value , And use the gradient descent method to update
Bias: bias , Allow the classifier to move the decision boundary left and right , Contribute to better , Faster training model .
Weighted sum: The weighted sum is Input Vector and weight Product sum of
Output: Output as category , take +1,-1
In short , The perceptron model is After feature extraction , Multiplicative weight , Sum using gradient descent , Training , Add bias to assist classification , The last two points .

Mathematical model of perceptron model
Given the training data set :
T={ (x1,y1) ,(x2,)2)…(x.n,yn) }
among xi∈Rn, yi ∈{+1-1},i=1,2,.,.n,
Input x Represents the eigenvector of an instance , Points corresponding to the input space , Output y Represents the category of the sample ..
Then the perceptron model is :
The symbolic function is :
Geometric interpretation 
linear equation :wx+b=0
Corresponding hyperplane S,w For the normal vector ,b intercept , Separate positive and negative classes
Only two points can be solved , If the difference is not obvious or cross , It's hard to solve . Typical error driven algorithms .


Model solving

Input : Training data set T={(x1,y1),(x2,)2)…(xn,yn)}
among xi∈R, yi∈{-1,+1}, i=12…N
Learning rate η (0<n<=1) ;
Output : w,b
Perceptron model : f(x)=sign(wx+b)
(1) Select the initial value w0,b0
(2) Select data in the training set (xi,yi)
(3) If yi(w*xi+b)<=0
(4) Finding partial derivatives , Update parameters
(5) repeat (2) Until there are no misclassification points in the training set
Divisible 
Hard to distinguish 
matlab Code
function [W,b] = perceptron(X,y,Maxstep)
% Perceptron learning algorithm
%W Is the weight vector to be solved ,b For deviation
%X For input space , This time, take two-dimensional ,y For output space , The value is [-1,1]
[n,m] = size(X);% Solving the matrix X Size
% Assign initial values to weights and deviations , Specify the learning step size
W = zeros(m, 1);%W by m Row column vector
b=0;% Set the initial value of the deviation to 0
mu= 0.5;% Set the learning step to 0.5,0<mu<=1
for step = 1:Maxstep% Iteratively update parameter values
miss_flag=true;% Set a flag bit to judge whether there are misclassification points
fori=1:n%
if (i)*(X(;)*W+b))< =0% Judge whether the randomly selected point is a misclassification point
miss_ flag = false;% If the randomly selected point is misclassification point , Then set the flag bit to false
% Update the weight and deviation parameters according to the gradient descent method
W = W + mu*y(i)*X(i;);
b= b + mu*y(i); .
end
end
if miss_ flag == true% If the flag bit is true, Indicates that the number of misclassification points is 0, The algorithm has achieved correct classification , There is no need to continue iterating and updating , Jump out of circulation
break
end
end
clc
% Specify the input space
X = [3,3;4,3;1,1];
% Specify the output space
y=[1,1,-1];
n = size(y,2);% solve y Column length of
% Draw the instance points in the feature space
forj = 1:n
if y(j) == 1% Draw positive instance points
plot(X(,1),X(j,2),r*);
end
if y(j) == -1% Draw negative instance points
plot(XGj,1),X(j,2),b*);
end
hold on % This statement can draw a new image based on the original image , If you don't add it, you can only see the last one
end
% Call the function to update the parameters
[W,b] = perceptron(X,y,2000);
xlabel =linspace(0,5,500);
ylabel = -(W(1)/W(2))*xlabel -b/W(2);% take X(2) Look at the genetic variables ,X (1) As an independent variable , Therefore, the hyperplane drawn by the algorithm can be obtained
plot(xlabel,ylabel);
边栏推荐
- Une semaine de vie
- Try to get property'num for PHP database data reading_ rows' of non-object?
- Web side defense Guide
- Servicemesh mainly solves three pain points
- 关于PHP-数据库的 数据读取,Trying to get property 'num_rows' of non-object?
- What "real skills" should a million year old cloud native developer master? Alibaba, Tencent, meituan and byte decrypt together
- Landingsite eband B1 smoke test case
- 100 important knowledge points that SQL must master: using cursors
- Etcd raft protocol
- C language, to achieve three chess games
猜你喜欢

GEE:(二)对影像进行重采样

CVPR论文解读 | 弱监督的高保真服饰模特生成

VictoriaMetrics 简介

发现你看不到的物体!南开&武大&ETH提出用于伪装目标检测SINet,代码已开源!...

TinyMCE visual editor adds Baidu map plug-in

Landingsite eband B1 smoke test case
![[shutter] shutter custom fonts (download TTF fonts | pubspec.yaml configure font resources | synchronize resources | globally apply fonts | locally apply fonts)](/img/27/8594ba0b49d5008b7469967babed17.jpg)
[shutter] shutter custom fonts (download TTF fonts | pubspec.yaml configure font resources | synchronize resources | globally apply fonts | locally apply fonts)

Micro service gateway selection, please accept my knees!

Scrcpy this software solves the problem of sharing mobile screen with colleagues | community essay solicitation
![[shutter] shutter opens a third-party application (url|launcher plug-in search and installation | url| launcher plug-in official example | open browser | open a third-party application)](/img/f7/cb41d159e5c5ef3f4f1b9468d52ccc.jpg)
[shutter] shutter opens a third-party application (url|launcher plug-in search and installation | url| launcher plug-in official example | open browser | open a third-party application)
随机推荐
Learn computer knowledge from scratch
Market Research - current situation and future development trend of cell-based seafood market
Five message formats of OSPF
Off chip ADC commissioning record
Market Research - current market situation and future development trend of aircraft audio control panel system
使用 EMQX Cloud 实现物联网设备一机一密验证
【剑指 Offer】57. 和为s的两个数字
Web side defense Guide
记录一下微信、QQ、微博分享web网页功能
sql service 截取字符串
Secondary development of ANSYS APDL: post processing uses command flow to analyze the result file
Market Research - current situation and future development trend of carob chocolate market
一周生活
Introduction to victoriametrics
20220702 how do programmers build knowledge systems?
VIM command-t plugin error: unable to load the C extension - VIM command-t plugin error: could not load the C extension
"New programmer 003" was officially launched, and the cloud native and digital practical experience of 30+ companies such as Huawei and Alibaba
[shutter] shutter gesture interaction (click event handling | click OnTap | double click | long press | click Cancel | press ontapdown | lift ontapup)
Market Research - current market situation and future development trend of aircraft front wheel steering system
*C language final course design * -- address book management system (complete project + source code + detailed notes)