当前位置:网站首页>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);
边栏推荐
- Introduction to victoriametrics
- Reading experience of just because
- C语言,实现三子棋小游戏
- [Jianzhi offer] 56 - ii Number of occurrences of numbers in the array II
- kubernetes资源对象介绍及常用命令(四)
- *C language final course design * -- address book management system (complete project + source code + detailed notes)
- Infrastructure is code: a change is coming
- Try to get property'num for PHP database data reading_ rows' of non-object?
- Unity3d learning notes 4 - create mesh advanced interface
- GEE:(二)对影像进行重采样
猜你喜欢
A specially designed loss is used to deal with data sets with unbalanced categories
pip安装whl文件报错:ERROR: ... is not a supported wheel on this platform
Scrcpy this software solves the problem of sharing mobile screen with colleagues | community essay solicitation
*C language final course design * -- address book management system (complete project + source code + detailed notes)
How to write a good program when a big book speaks every day?
[shutter] shutter gesture interaction (click event handling | click OnTap | double click | long press | click Cancel | press ontapdown | lift ontapup)
CVPR论文解读 | 弱监督的高保真服饰模特生成
Etcd Raft 协议
Gee: (II) resampling the image
[zero foundation I] Navicat download link
随机推荐
20220702-程序员如何构建知识体系?
[Yu Yue education] reference materials of analog electronic technology of Nanjing Institute of information technology
Technological Entrepreneurship: failure is not success, but reflection is
Etcd raft protocol
Reading experience of just because
A specially designed loss is used to deal with data sets with unbalanced categories
The book "new programmer 002" is officially on the market! From "new database era" to "software defined car"
From personal heroes to versatile developers, the era of programmer 3.0 is coming
Unity3d learning notes 4 - create mesh advanced interface
Unity3D学习笔记4——创建Mesh高级接口
:last-child 不生效解决
服务可见可观测性
技术人创业:失败不是成功,但反思是
100 important knowledge points that SQL must master: management transaction processing
关于PHP-数据库的 数据读取,Trying to get property 'num_rows' of non-object?
Ransack组合条件搜索实现
Riding the wind of "cloud native" and stepping on the wave of "digitalization", new programmer 003 starts pre-sale
Necessary browser plug-ins for network security engineers
Read a doctor, the kind that studies cows! Dr. enrollment of livestock technology group of Leuven University, milk quality monitoring
[zero foundation I] Navicat download link