| 查看: 2852 | 回复: 0 | |||
samggyy金虫 (小有名气)
|
[求助]
Matlab如何使用绘图画出3D SVM的decision boundary?
|
|
RT,Matlab中可以画出二维的SVM的decision boundary,代码如下, load fisheriris; features = meas(1:100, ;featureSelcted = features(1:100,1:2); groundTruthGroup = species(1:100); svmStruct = svmtrain(featureSelcted, groundTruthGroup, ... 'Kernel_Function', 'rbf', 'boxconstraint', Inf, 'showplot', true, 'Method', 'QP'); svmClassified = svmclassify(svmStruct,featureSelcted,'showplot',true); 如果使用三维的特征,即把代码改为featureSelcted = features(1:100,1:3); 无法出一个三维的超平面了。思路可能是: cubeXMin = min(featureSelcted(:,1))-0.5; cubeYMin = min(featureSelcted(:,2))-0.5; cubeZMin = min(featureSelcted(:,3))-0.5; cubeXMax = max(featureSelcted(:,1))+0.5; cubeYMax = max(featureSelcted(:,2))+0.5; cubeZMax = max(featureSelcted(:,3))+0.5; cubeMesh = meshgrid(cubeXMin:0.5:cubeXMax,cubeYMin:0.5:cubeYMax,cubeZMin:0.5:cubeZMax); sv = svmStruct.SupportVectors; alphaHat = svmStruct.Alpha; bias = svmStruct.Bias; kfun = svmStruct.KernelFunction; kfunargs = svmStruct.KernelFunctionArgs; f = (feval(kfun,sv,cubeMesh,kfunargs{:})'*alphaHat( ) + bias;decisionBoundary = sign(f); decisionBoundaryInd = find(decisionBoundary==0); figure, scatter3(featureSelcted(:,1),featureSelcted(:,2),featureSelcted(:,3)); surf(decisionBoundaryInd); 但是不知道怎么完成,请教有没有人知道怎么做的。谢谢! ![]() 有一个用R写的例子: http://stackoverflow.com/questio ... -svm-fit-hyperplane 还有两篇论文中也有做到: http://www.sciencedirect.com/sci ... i/S0304394010006324 http://www.mathematica-journal.c ... ation-with-kernels/ |
» 收录本帖的淘帖专辑推荐
MATLAB相关 |
» 猜你喜欢
浙大物院表面物理课题组长期招收普博及直博学生
已经有259人回复
【征稿】Springer Nature热电专题 Discover Materials / Discover Chemistry
已经有47人回复
物理学I论文润色/翻译怎么收费?
已经有240人回复
25届硕士申请,材料计算方向
已经有2人回复
课题组招1-2名硕士
已经有2人回复
机时越来越贵之后,我把一部分 DFT 流程搬到了 AI 计算平台上
已经有0人回复
斯坦福大学与Elsevier世界前2%学者新排名查询
已经有1人回复
27申博推荐:南京航空航天大学国际前沿院光学方向招收博士生!
已经有19人回复
华南师范大学+双一流学科物理学+广东省杰青团队2027年博士招生+机器学习驱动材料设计
已经有1人回复
apl投稿状态
已经有2人回复
华南师范大学+双一流学科物理学+广东省杰青团队2027年博士招生+机器学习驱动材料设计
已经有1人回复










;
回复此楼

点击这里搜索更多相关资源