查看单个帖子
旧 2019-12-14, 20:13   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,008
声望力: 66
poster 正向着好的方向发展
帖子 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

回答:

MATLAB目前不支持多类SVM。您可以使用svmtrain (2类)实现此目的,但是使用标准SVM软件包会容易得多。

我使用过LIBSVM ,可以确认它非常易于使用。

%%# 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);

更多&回答...
poster 当前离线   回复时引用此帖