我可以使用Scikit Learn绘制3个要素(在3D空间中)的SVM决策边界吗? [英] Can I plot the SVM decision boundary for 3 features(in 3D space) using Scikit learn?

查看:338
本文介绍了我可以使用Scikit Learn绘制3个要素(在3D空间中)的SVM决策边界吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用scikit-learn了解支持向量机(SVM)。我想绘制由SVM计算的决策边界。 SVM使用3个功能。因此,决策边界必须在3D空间中绘制。可以使用scikit-learn吗?
我只能在官方网站上找到SVM决策边界的二维图。
但是我发现stackoverflow上的链接表明使用 matlab r 。有没有一种方法可以使用scikit-learn实现相同目的?

I am using scikit-learn to understand Support Vector Machines(SVM). I want to plot the decision boundary computed by SVM. The SVM uses 3 features. So the decision boundary must be drawn in 3D space. Is this possible using scikit-learn? I could find only 2D plots of SVM decision boundary at the official website. However I found links on stackoverflow which show this is possible using matlab and r. Is there a way in which I can achieve the same using scikit-learn?

推荐答案

您无需使用scikit-learn在Python中绘制内容。您必须使用其他软件包,如果您查看scikit-learn的示例,您会发现它们使用了matplotlib。您可以使用matplotlib创建3D图,此处是本教程。用法与2D基本相同,不同之处在于您为第三维添加了一个参数。

You don't use scikit-learn to plot things in Python. You have to use another package, and if you check scikit-learn's examples, you will see they use matplotlib. You can create 3D plots with matplotlib, here is the tutorial. The usage is basically the same than in 2D, except you add an argument for the third dimension.

您可以使用的另一个流行的软件包是 mayavi ,它是专为3D绘图而设计的。

Another popular package you could use is mayavi, which was conceived especially for 3D plotting.

这篇关于我可以使用Scikit Learn绘制3个要素(在3D空间中)的SVM决策边界吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆