当前位置:网站首页>统计学习方法——感知机
统计学习方法——感知机
2022-07-07 13:53:00 【_春天_】
感知机是机器学习的最基本模型之一,是神经网络和支持向量机的基础。
感知机的关键词
- 二分类
- 判别模型、线性模型
- 数据集线性可分时,有无穷多个解
- 无法解决XOR问题
感知机的原理
感知机是根据数据实例的特征向量x对其进行二类分类的线形分类模型,输出为+1或-1。感知机的函数为:
f ( x ) = s i g n ( w ⋅ x + b ) f(x)=sign(w·x+b) f(x)=sign(w⋅x+b)
其中 w w w是权值, b b b是偏置, w ⋅ x w·x w⋅x是 w w w和 x x x的内积, s i g n sign sign是符号函数,即,
s i g n ( x ) = { + 1 x ≥ 0 − 1 x < 0 sign(x) = \begin{cases} +1 & x\ge 0\\ -1 & x <0 \end{cases} sign(x)={ +1−1x≥0x<0当wx+b大于0时,根据sign函数,输出为1,对应正类;当wx+b小于0,输出为-1,对应负类。
感知机的几何解释:线性方程 w ⋅ x + b = 0 w·x+b=0 w⋅x+b=0 对应于特征空间中一个超平面 S S S,这个超平面将特征空间划分为两个部分,位于两部分的点(特征向量)分别被分为正、负两类。超平面 S S S也被称为分离超平面。
一个线性方程将特征空间分成两部分。在二维特征空间内,wx+b=0即为一条之间,将平面分为两部分,直线上方的点带入wx+b计算值大于0,为正类,对应y值为+1,直线下方的点小于0,为负类,对应y值为-1。
感知机学习的策略是极小化损失函 数:
m i n w , b L ( w , b ) = − ∑ y i ( w ⋅ x i + b ) , x i ∈ M min_w, _bL(w,b)=-\sum y_i(w·x_i+b), x_i \in M minw,bL(w,b)=−∑yi(w⋅xi+b),xi∈M
损失函数对应误分类点到分离超平面的总距离。该处的损失函数关注的是误分类点,而不是所有点。损失函数最小为零,即所有的点都分类正确。因此也导致了有无穷多个解。
感知机学习算法是基于随机梯度下降法的对损失函数的最优化算法。在原始形式中,首先选取一个超平面,然后用梯度下降法不断极小化目标函数,在这个过程中,一次随机选取一个误分类点使其梯度下降。
当训练数据集线性可分时[补充1],感知机学习算法是收敛的,但是存在无穷多个解,这些解既依赖于处值的选择,也依赖于迭代过程中误分类点的选择顺序。
如果想要得到唯一的超平面,就需要对分离超平面增加约束条件。可参考支持向量机
为什么不能解决异或(XOR)问题
异或问题为二进制运算中,值相同为0,不相同为1。
把异或问题映射到二维空间里,可表示为:
在这个二维空间下,我们找不到一条直线将其分成两类。也就是说无法通过感知机模型将X分到直线的一边,同时将O分到直线的另一边。所以感知机解决不了异或问题。
补充知识
- 补充1:数据集的线性可分性
给定一个数据集
T = { ( x 1 , y 1 ) , ( x 2 , y 2 ) , … , ( x N , y N ) } T=\{(x_1, y_1), (x_2, y_2),…, (x_N, y_N)\} T={ (x1,y1),(x2,y2),…,(xN,yN)}
其中, x i ∈ X = R n x_i \in X = R^n xi∈X=Rn, y i ∈ Y = { + 1 , − 1 } y_i \in Y=\{+1,-1\} yi∈Y={ +1,−1}, i = 1 , 2 , … , N i=1,2,…,N i=1,2,…,N,如果存在某个超平面 S S S
w ⋅ x + b = 0 w·x+b=0 w⋅x+b=0能够将数据集的正实例点和负实例点完全正确地划分到超平面的两侧,即对所有 y i = + 1 y_i=+1 yi=+1的实例 i i i,有 w ⋅ x i + b > 0 w·x_i+b>0 w⋅xi+b>0,对所有 y i = − 1 y_i=-1 yi=−1的实例 i i i,有 w ⋅ x i + b < 0 w·x_i+b<0 w⋅xi+b<0,则称数据集 T T T为线性可分数据集(Linearly separable data set);否则,称数据集 T T T线形不可分。
推荐阅读:
边栏推荐
- Unity3D_ Class fishing project, bullet rebound effect is achieved
- 121. 买卖股票的最佳时机
- Unity3D_ Class fishing project, control the distance between collision walls to adapt to different models
- Dotween -- ease function
- Getting started with webgl (1)
- Virtual memory, physical memory /ram what
- SPI master rx time out中断
- Three. JS introductory learning notes 15: threejs frame animation module
- A link opens the applet code. After compilation, it is easy to understand
- Syntaxhighlight highlights the right scroll bar
猜你喜欢
Plate - forme de surveillance par étapes zabbix
分步式监控平台zabbix
Annexb and avcc are two methods of data segmentation in decoding
企业级日志分析系统ELK
C4D learning notes 3- animation - animation rendering process case
MySQL数据库基本操作-DQL-基本查询
Three. JS introductory learning notes 11:three JS group composite object
After UE4 is packaged, mesh has no material problem
分步式監控平臺zabbix
Postman generate timestamp, future timestamp
随机推荐
融云斩获 2022 中国信创数字化办公门户卓越产品奖!
Aerospace Hongtu information won the bid for the database system research and development project of a unit in Urumqi
XMIND frame drawing tool
Cut ffmpeg as needed, and use emscripten to compile and run
Vertex shader to slice shader procedure, varying variable
Enterprise log analysis system elk
无线传感器网络--ZigBee和6LoWPAN
Getting started with webgl (4)
Annexb and avcc are two methods of data segmentation in decoding
C4D learning notes 2- animation - timeline and time function
The unity vector rotates at a point
招标公告:福建省农村信用社联合社数据库审计系统采购项目(重新招标)
20th anniversary of agile: a failed uprising
AB package details in unity (super detail, features, packaging, loading, manager)
强化实时数据管理,英方软件助力医保平台安全建设
Step by step monitoring platform ZABBIX
应用程序和matlab的通信方式
asyncio 概念和用法
Syntaxhighlight highlights the right scroll bar
Shader_ Animation sequence frame