| 1 | 1/1 | 返回列表 |
| 查看: 2681 | 回復(fù): 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相關(guān) |
| 1 | 1/1 | 返回列表 |
| 最具人氣熱帖推薦 [查看全部] | 作者 | 回/看 | 最后發(fā)表 | |
|---|---|---|---|---|
|
[考研] 085600材料與化工調(diào)劑 +8 | kikiki7 2026-03-30 | 8/400 |
|
|---|---|---|---|---|
|
[考研] 085602化工求調(diào)劑(331分) +7 | 111@127 2026-03-30 | 7/350 |
|
|
[考研] 292求調(diào)劑 +13 | 是妍子也是研子 2026-03-30 | 13/650 |
|
|
[考研] 求調(diào)劑 +7 | 研研,接電話 2026-03-24 | 8/400 |
|
|
[考研] 085602 化學(xué)工程專碩 340分求調(diào)劑 +4 | qianbai11 2026-03-29 | 4/200 |
|
|
[考研] 化學(xué)工程085602 305分求調(diào)劑 +25 | RichLi_ 2026-03-25 | 25/1250 |
|
|
[考研] 一志愿南航 335分 | 0856 | GPA 4.07 | 有科研經(jīng)歷 +8 | cccchenso 2026-03-29 | 8/400 |
|
|
[考研] 考研調(diào)劑 +7 | 小蠟新筆 2026-03-29 | 7/350 |
|
|
[考研] 289求調(diào)劑 +5 | BrightLL 2026-03-29 | 5/250 |
|
|
[考研] 332求92調(diào)劑 +8 | 蕉蕉123 2026-03-28 | 8/400 |
|
|
[考研] 283求調(diào)劑 +3 | A child 2026-03-28 | 3/150 |
|
|
[考研] 材料與化工(0856)304求B區(qū)調(diào)劑 +8 | 邱gl 2026-03-27 | 8/400 |
|
|
[考研] 086502化學(xué)工程342求調(diào)劑 +6 | 阿姨復(fù)古不過 2026-03-27 | 6/300 |
|
|
[考研] 352分 化工與材料 +5 | 海納百川Ly 2026-03-27 | 5/250 |
|
|
[考研] 一志愿南師大0703化學(xué) 275求調(diào)劑 +4 | Ripcord上岸 2026-03-27 | 4/200 |
|
|
[考研] 348求調(diào)劑 +4 | 小懶蟲不懶了 2026-03-27 | 5/250 |
|
|
[考研]
|
WWW西西弗斯 2026-03-24 | 8/400 |
|
|
[考研] 打過很多競賽,085406控制工程300分,求調(diào)劑 +3 | askeladz 2026-03-26 | 3/150 |
|
|
[考研] 一志愿哈工大,085400,320,求調(diào)劑 +4 | gdlf9999 2026-03-24 | 4/200 |
|
|
[考研] 考研一志愿蘇州大學(xué)初始315(英一)求調(diào)劑 +3 | sbdksD 2026-03-24 | 4/200 |
|