python svm向量

介绍: (Introduction:)

The support vector machines algorithm is a supervised machine learning algorithm that can be used for both classification and regression. In this article, we will be discussing certain parameters concerning the support vector machines and try to understand this algorithm in detail.

支持向量机算法是一种可监督的机器学习算法,可用于分类和回归。 在本文中,我们将讨论与支持向量机有关的某些参数,并尝试详细了解该算法。

几何解释: (Geometrical Interpretation:)

For understanding, let us consider the SVM used for classification. The following figure shows the geometrical representation of the SVM classification.

为了理解,让我们考虑用于分类的SVM。 下图显示了SVM分类的几何表示。

After taking a look at the above diagram you might notice that the SVM classifies the data a bit differently as compared to the other algorithms. Let us understand this figure in detail. The Red-colored line is called as the ‘hyperplane’. This is basically the line or the plane which linearly separates the data. Along with the hyperplane, two planes that are parallel to the hyperplane are created. While creating these two planes, we make sure that they pass through the points that are closest to the hyperplane. These points can be called as the nearest points. The hyperplane is adjusted in such a way that it lies exactly in the middle of the two parallel planes. The distance between these two planes is called the ‘margin’. The advantage of these two parallel planes is that it helps us to classify the two classes in a better way. Now a question arises that there can be multiple hyperplanes and out of them why did we select the one in the above diagram? The answer to that is we select the hyperplane for which the margin i.e the distance between the two parallel planes is maximum. The points that are on these two parallel planes are called support vectors. The above figure is obtained after training the data. Now for the classification of unknown data or the testing data, the algorithm will only take into consideration the reference of the support vectors for classification.

看了上面的图后,您可能会注意到SVM与其他算法相比对数据的分类有些不同。 让我们详细了解该图。 红色线称为“超平面”。 这基本上是线性分离数据的线或平面。 与超平面一起,创建了与超平面平行的两个平面。 在创建这两个平面时,我们确保它们穿过最靠近超平面的点。 这些点可以称为最近点。 超平面的调整方式使其恰好位于两个平行平面的中间。 这两个平面之间的距离称为“边距”。 这两个平行平面的优势在于,它可以帮助我们以更好的方式对这两个类别进行分类。 现在出现一个问题,可能有多个超平面,为什么我们从上图中选择一个? 答案是选择超平面,其裕度即两个平行平面之间的距离最大。 这两个平行平面上的点称为支持向量。 上图是训练数据后获得的。 现在,对于未知数据或测试数据的分类,该算法将仅考虑参考支持向量进行分类。

Python实现: (Python Implementation:)

The python implementation is shown below. The data is divided into a training dataset and a testing dataset. The notations used are X_train, X_test, y_train, y_test. This is done with the help of the ‘train-test-split function’. Now let's get to the implementation part. First, we start off by importing the libraries that are required to implement the SVM algorithm.

python实现如下所示。 数据分为训练数据集和测试数据集。 使用的符号是X_train,X_test,y_train,y_test。 这是通过“ train-test-split函数”来完成的。 现在让我们进入实现部分。 首先,我们首先导入实现SVM算法所需的库。

# Import SVM from sklearn import svm# Creating a SVM Classifierclassifier = svm.SVC(C=0.01, break_ties=False, cache_size=200,  class_weight=None, coef0=0.0, decision_function_shape='ovr', degree=1, gamma='scale', kernel='rbf',max_iter=-1,probability=False, random_state=None, shrinking=True,tol=0.001, verbose=False)# Training the modelclassifier.fit(X_train, y_train)

As seen from the above code block, the implementation is quite easy. Let us discuss the parameters that we need to specify in the brackets. These parameters are used to tune the model to obtain better accuracy. The most commonly used parameters that we use for tuning are:

从上面的代码块可以看出,实现非常容易。 让我们讨论一下我们需要在方括号中指定的参数。 这些参数用于调整模型以获得更好的精度。 我们用于调优的最常用参数是:

C : This is the regularization parameter. It is inversely proportional to C. The most common values that we use for C are 1, 10, 100, 1000.

C:这是正则化参数。 它与C成反比。我们为C使用的最常见值为1、10、100、1000。

kernel: The most commonly used kernels are, ‘linear’, ‘poly’, ‘rbf’. When the data is linearly separable, we can use the linear kernel. When the data is not linearly separable and the relationship is of a higher degree then we use ‘poly’ as the kernel. The ‘rbf’ is used when we don't exactly know which kernel is to be specified.

内核:最常用的内核是“线性”,“多边形”,“ rbf”。 当数据是线性可分离的时,我们可以使用线性核。 当数据不是线性可分离的并且关系具有更高的程度时,我们使用“ poly”作为内核。 当我们不完全知道要指定哪个内核时,将使用“ rbf”。

gamma: This parameter is used to handle non-linear classification. When the points are not linearly separable, we need to transform them into a higher dimension. A small gamma will result in low bias and high variance while a large gamma will result in higher bias and low variance. Thus we need to find the best combination of ‘C’ and ‘gamma’.

gamma:此参数用于处理非线性分类。 当这些点不能线性分离时,我们需要将它们转换为更高的维度。 较小的伽玛将导致低偏差和高方差,而较大的伽玛将导致较高的偏差和低方差。 因此,我们需要找到“ C”和“γ”的最佳组合。

结论: (Conclusion:)

Support Vector Machines is one of the widely used algorithms in machine learning. I hope that the geometrical interpretation along with its implementation in python along with the parameter tuning is understood. Happy learning!

支持向量机是机器学习中广泛使用的算法之一。 我希望可以理解几何解释及其在python中的实现以及参数调整。 学习愉快!

翻译自: https://medium.com/analytics-vidhya/support-vector-machines-svm-and-its-python-implementation-c8bc9549f46d

python svm向量


http://www.taodudu.cc/news/show-1873888.html

相关文章:

  • 游戏世界观构建_我们如何构建技术落后的世界
  • 信任的机器_您应该信任机器人吗?
  • ai第二次热潮:思维的转变_基于属性的建议:科技创业公司如何使用AI来转变在线评论和建议
  • 建立RoBERTa模型以发现Reddit小组的情绪
  • 谷歌浏览器老是出现花_Google全新的AI平台值得您花时间吗?
  • nlp gpt论文_开放AI革命性的新NLP模型GPT-3
  • 语音匹配_什么是语音匹配?
  • 传统量化与ai量化对比_量化AI偏差的风险
  • ai策略机器人研究a50_跟上AI研究的策略
  • ai人工智能 工业运用_人工智能在老年人健康中的应用
  • 人工智能民主化无关紧要,数据孤岛以及如何建立一家AI公司
  • 心公正白壁无瑕什么意思?_人工智能可以编写无瑕的代码后,编码会变得无用吗?
  • 人工智能+社交 csdn_关于AI和社交媒体虚假信息,我们需要尽快进行三大讨论
  • 标记偏见_人工智能的影响,偏见和可持续性
  • gpt2 代码自动补全_如果您认为GPT-3使编码器过时,则您可能不编写代码
  • 机器学习 深度学习 ai_什么是AI? 从机器学习到决策自动化
  • 艺术与机器人
  • 中国ai人工智能发展太快_中国的AI:开放采购和幕后玩家
  • 让我们手动计算:深入研究Logistic回归
  • vcenter接管_人工智能接管广告创意
  • 人工智能ai算法_当AI算法脱轨时
  • 人工智能 企业变革_我们如何利用(人工)情报变革医院的运营管理
  • ai 道德_AI如何提升呼叫中心的道德水平?
  • 张北草原和锡林郭勒草原区别_草原:比您不知道的恶魔还强
  • keras pytorch_使用PyTorch重新创建Keras功能API
  • 人工智能ai应用高管指南_解决AI中的种族偏见:好奇心指南
  • 人工智能ai以算法为基础_IT团队如何为AI项目奠定正确的基础
  • ai人工智能_AI偏见如何发生?
  • unityui计分_铅计分成长
  • ml工程师_ML工程师正在失业。 仍然学习ML

python svm向量_支持向量机(SVM)及其Python实现相关推荐

  1. Python,OpenCV基于支持向量机SVM的手写数字OCR

    Python,OpenCV基于支持向量机SVM的手写数字OCR 1. 效果图 2. SVM及原理 2. 源码 2.1 SVM的手写数字OCR 2.2 非线性SVM 参考 上一节介绍了基于KNN的手写数 ...

  2. python机器学习库sklearn——支持向量机svm

    分享一个朋友的人工智能教程.零基础!通俗易懂!风趣幽默!还带黄段子!大家可以看看是否对自己有帮助:点击打开 全栈工程师开发手册 (作者:栾鹏) python数据挖掘系列教程 支持向量机svm的相关的知 ...

  3. python编程基础_月隐学python第2课

    python编程基础_月隐学python第2课 学习目标 掌握变量的输入和输出 掌握数据类型的基本概念 掌握算数运算 1.变量的输入和输出 1.1 变量输入 使用input输入 input用于输入数据 ...

  4. 查看Python的版本_查看当前安装Python的版本

    一.查看Python的版本_查看当前安装Python的版本 具体方法: 首先按[win+r]组合键打开运行: 然后输入cmd,点击[确定]: 最后执行[python --version]命令即可. 特 ...

  5. python支持向量机_支持向量机(SVM)Python实现

    什么是支持向量机? "支持向量机"(SVM)是一种监督机器学习算法,可用于分类或回归挑战.然而,它主要用于分类问题.在这个算法中,我们将每一个数据项作为一个点在n维空间中(其中n是 ...

  6. python定义距离_距离度量以及python实现(一)

    1.欧氏距离(Euclidean Distance) 欧氏距离是最易于理解的一种距离计算方法,源自欧氏空间中两点间的距离公式. (1)二维平面上两点a(x1,y1)与b(x2,y2)间的欧氏距离: ( ...

  7. python opencv手册_教你用Python实现5毛钱特效(给你的视频来点料)

    一.前言 请务必看到最后.Python牛已经不是一天两天的事了,但是我开始也没想到,Python能这么牛.前段时间接触了一个批量抠图的模型库,而后在一些视频中找到灵感,觉得应该可以通过抠图的方式,给视 ...

  8. python并行运算库_最佳并行绘图Python库简介:“ HiPlot”

    python并行运算库 HiPlot is Facebook's Python library to support visualization of high-dimensional data ta ...

  9. python新手难点_初学两天python的操作难点总结

    已经学习两天python,将我认为的操作难点进行总结 1 在cmd下 盘与盘之间的切换 直接 D或d: 就好 2 查找当前盘或者文件下面的目录 直接 dir 3 想在一个盘下进去一个文件夹,用cd空格 ...

  10. python内存泄漏_诊断和修复Python中的内存泄漏

    python内存泄漏 Fugue uses Python extensively throughout the Conductor and in our support tools, due to i ...

最新文章

  1. 图像去雾----暗通道
  2. ajax formdata提交上传,Ajax提交用FormData()上传文件
  3. android getitem,android – ItemDecoration重写getItemOffsets()和动画
  4. 【C++ Primer 第15章】定义派生类拷贝构造函数、赋值运算符
  5. Java对象如何实现比较规则
  6. 台式电脑键盘字母乱了_键盘侠的育儿经利用键盘引导学龄前儿童正确使用电脑、学习英文字母和拼音...
  7. 文件流对象 c# 1614525948
  8. 安装 virtualenvwrapper
  9. JPack插件停止更新,希望玩wow的朋友可以继续开发这个插件
  10. 浪漫爱心表白网页模板
  11. 会声会影安装闪退解决办法_会声会影导出时闪退怎么回事 - 卡饭网
  12. 百度网盘免费高速下载(详细过程)
  13. 同学们 给你十个理由别去买iPad
  14. 联通光猫后台 192.168.1.1登录
  15. Java中 支持多继承吗?
  16. 图片识别 python 神经网络,人工神经网络图像识别
  17. 好书推荐:《商贸与文明》
  18. Bugku 杂项 中国菜刀
  19. Telegram公布个人身份验证工具,可共享财务及ICO数据
  20. 3DMax插件开发—可编辑多边形-多顶点统一坐标工具

热门文章

  1. 互联网带来的颠覆,改变了传统的营销套路
  2. ZeroClipboard / jquery.zclip.min.js跨浏览器复制插件使用中遇到的问题解决
  3. ZOJ 1111 Poker Hands
  4. VC实现文件拖拽获取文件名
  5. 2020-11-30 OpenCV人工智能图像处理学习笔记 第3章 计算机视觉加强之几何变换 warpAffine
  6. 第五章 线性回归 学习笔记上
  7. smtp发送邮件和pop3收取邮件
  8. Atitit 命令行返回 cli 返回解析 tab分割csv格式 v4 t34.docx Atitit 命令行返回 cli 返回解析 csv 格式 cliutil 目录 1.1. 线使用tab
  9. Atitit q2016 q5 doc list on home ntpc.docx
  10. Atitit 项目语言的选择 java c#.net  php??