MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   Matlab中的支持向量机 (https://www.labfans.com/bbs/showthread.php?t=26325)

poster 2019-12-14 20:13

Matlab中的支持向量机
 
您能否在Matlab中使用支持向量机(SVM)给出4类分类的示例,例如:

atribute_1 atribute_2 atribute_3 atribute_4 class 1 2 3 4 0 1 2 3 5 0 0 2 6 4 1 0 3 3 8 1 7 2 6 4 2 9 1 7 10 3

[B]回答:[/B]

MATLAB目前不支持多类SVM。您可以使用[URL="http://www.mathworks.com/help/toolbox/bioinfo/ref/svmtrain.html"]svmtrain[/URL] (2类)实现此目的,但是使用标准SVM软件包会容易得多。

我使用过[URL="http://www.csie.ntu.edu.tw/~cjlin/libsvm/"][B]LIBSVM[/B][/URL] ,可以确认它非常易于使用。

%%# Your data D = [ 1 2 3 4 0 1 2 3 5 0 0 2 6 4 1 0 3 3 8 1 7 2 6 4 2 9 1 7 10 3]; %%# For clarity Attributes = D(:,1:4); Classes = D(:,5); train = [1 3 5 6]; test = [2 4]; %%# Train model = svmtrain(Classes(train),Attributes(train,:),'-s 0 -t 2'); %%# Test [predict_label, accuracy, prob_estimates] = svmpredict(Classes(test), Attributes(test,:), model);

[url=https://stackoverflow.com/questions/4976539]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 05:02

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.