当前位置:网站首页>ML10自学笔记-SVM
ML10自学笔记-SVM
2022-07-29 05:22:00 【十九岁的花季少女】
SVM(分类问题)

SVM 推导
想要两类之间最大间隔
要计算距离。假设决策边界是这样一个平面,那就是计算这个点到直线的距离。
平面的定义:WTX=b。WT为法向量。我们要算的就是dist(x,h),但是直接计算比较麻烦,通常情况下这样计算。
找平面内两个点x’ 和x’’,可以将这两个点带入平面公式,两个点组成一个向量,dist这个向量与x’ 和x’’组成的向量垂直。如②式子,法向量与平面内任意一个向量垂直。
因为计算直线距离不好计算,所以改为计算两点之间的距离,可以计算X与X’之间的距离然后在竖直方向做投影就可以得到dist(x,h),如最后一行的公式。后面一个等号进行化简,将X’用①公式代入。
数据
y(xi)是预测值,Yi是标签值。
目标函数
原来距离为|wtx+b|,是带着绝对值的,但是之前的决策方程中y(xi)与yi的乘积始终是正数,所以在本节的式子中相乘之后可以直接把绝对值去掉。
min后面是要求的距离决策边界最近的点(样本),求出这个距离,max是最大的距离,使得刚刚这个求得的距离最大。目标即什么样的w使得这个目标函数最大。
目标函数求解
实际为求w的最小值。因为求w和w2的最小值是一样的,所以求1/2w2的最小值也是一样的。
使用拉格朗日乘子法求解。
有一个对偶性质。要求最小值,就可以求偏导。
什么样的w,b使得L最小,然后把w,b代回原式子
下一步,求什么样的αi使得整体最大。通常情况下会把求极大值转化成极小值(加了负号)。
SVM求解实例

括号内点乘是内积。即代入数据。
求解,求偏导。因为所有αi,都要大于零(约束条件),但是当对α2求偏导等于零时,求得的值为复数,所以最值在边界上,令α1和α2分别取零。第二种满足,可以根据之前的式子求得α3.
带回w求解。对于样本点来说,只要α为零了,那他就没有意义了,不会再加入计算,根据之前的图像,x2就不会算入计算式子了,最终的结果是由边界上的样本构成的,所以x2非边界上的点不算入计算式子。
软间隔

目标函数也发生了变化。
多加了参数。
核变换
之前是线性的,没有使用Φ(x)函数,只是用了简单的x,
因为映射到高维有时候很难计算,先映射到高维,高维多个数据求内积比较麻烦,但是通过先求内积再映射的方式,先求内积,然后再映射可以达到同样的效果,但是计算复杂度降低。
没有做核函数时,分类不太好(那条实线),使用高斯核函数后分类较好,圈圈。核函数就是将低维不可分,转换为高维可分。
边栏推荐
- 个人学习网站
- These process knowledge you must know
- isAccessible()方法:使用反射技巧让你的性能提升数倍
- 备份谷歌或其他浏览器插件
- C connect to SharePoint online webservice
- 【Transformer】ACMix:On the Integration of Self-Attention and Convolution
- Android studio login registration - source code (connect to MySQL database)
- 五、图像像素统计
- 虚假新闻检测论文阅读(三):Semi-supervised Content-based Detection of Misinformation via Tensor Embeddings
- 【Clustrmaps】访客统计
猜你喜欢

These process knowledge you must know

tensorboard使用

NLP领域的AM模型

DataX installation

Briefly talk about the difference between pendingintent and intent
![[semantic segmentation] Introduction to mapillary dataset](/img/3d/49b1b6007c1f97b1ba8ac438097590.png)
[semantic segmentation] Introduction to mapillary dataset

虚假新闻检测论文阅读(四):A novel self-learning semi-supervised deep learning network to detect fake news on...

Is flutter being quietly abandoned? On the future of flutter

Interesting talk about performance optimization thread pool: is the more threads open, the better?

MySQL inserts millions of data (using functions and stored procedures)
随机推荐
[convolution kernel design] scaling up your kernels to 31x31: revising large kernel design in CNN
These process knowledge you must know
关于Flow的原理解析
Valuable blog and personal experience collection (continuous update)
Are you sure you know the interaction problem of activity?
虚假新闻检测论文阅读(四):A novel self-learning semi-supervised deep learning network to detect fake news on...
AttributeError: module ‘tensorflow‘ has no attribute ‘placeholder‘
Briefly talk about the difference between pendingintent and intent
虚假新闻检测论文阅读(一):Fake News Detection using Semi-Supervised Graph Convolutional Network
【CV】请问卷积核(滤波器)3*3、5*5、7*7、11*11 都是具体什么数?
【目标检测】Generalized Focal Loss V1
MySQL inserts millions of data (using functions and stored procedures)
[network design] convnext:a convnet for the 2020s
NLP领域的AM模型
Spring, summer, autumn and winter with Miss Zhang (2)
MarkDown简明语法手册
【Clustrmaps】访客统计
虚假新闻检测论文阅读(三):Semi-supervised Content-based Detection of Misinformation via Tensor Embeddings
[database] database course design - vaccination database
Android studio login registration - source code (connect to MySQL database)