| 查看: 2667 | 回复: 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相关 |
» 猜你喜欢
数学教学论硕士可以读数学物理博士吗?
已经有0人回复
德国亥姆霍兹Hereon中心汉堡分部招镁合金腐蚀裂变SCC课题方向2026公派博士生
已经有4人回复
物理学I论文润色/翻译怎么收费?
已经有106人回复
澳门大学 应用物理及材料工程研究院 潘晖教授课题组诚招博士后
已经有11人回复
求助NH4V4O10晶体的CIF文件
已经有0人回复
英国全奖博士招聘-深度学习与量子物理
已经有0人回复
间接带隙半导体有效质量求助
已经有1人回复
投稿chemical physical letters不送审?
已经有2人回复
南开大学物理学院张书辉副教授招收凝聚态物理理论方向博士生、硕士生
已经有22人回复
杂志要求提供official language-editing certificate
已经有4人回复
深圳大学2026年秋博士招生-物理学-活性胶体方向-高永祥课题组
已经有16人回复













;
回复此楼

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