Can I plot the SVM decision boundary for 3 feature

2019-07-20 18:45发布

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?

1条回答
来,给爷笑一个
2楼-- · 2019-07-20 19:46

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.

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

查看更多
登录 后发表回答