svmtrain错误"组必须是向量." [英] svmtrain error "Group must be a vector."
问题描述
我正在尝试使用 LibSVM 的Matlab界面训练SVM a>,但出现以下错误
I am trying to train a SVM with the Matlab interface of LibSVM, but I get following error
model = svmtrain(Classes(train),Attributes(train,:),'-s 0 -t 2');
??? Error using ==> svmtrain at 172 Group must be a vector.
另请参阅此处的评论:在matlab中支持矢量机
See also comment here: support vector machines in matlab
推荐答案
问题是,Matlab正在使用其拥有自己的SVM实现,该实现除其他外还以不同的顺序获取变量.
The problem is, that Matlab is using its own SVM implementation which takes among other things the variables in different order.
要使其工作,请确保LibSVM库是Matlab搜索路径的一部分.一种选择是使用Matlab文件浏览器(<当前目录> )进入LibSVM文件夹,并使用菜单添加到路径
-> 选定的文件夹和子文件夹代码>.如果这解决了您的问题,并且您需要定期使用LibSVM,请使用
To make it work, make sure that the LibSVM library is part of your Matlab's Search Path. One option would be to use the Matlab filebrowser (Current Folder
) to go the LibSVM folder and use the menu Add to Path
-> Selected Folders and Subfolders
. If this solves your problem and you need LibSVM regularly, add the folder to your startup.m
using addpath
.
另请参阅:错误:类型为"double"的输入参数的未定义函数或方法"svmtrain"
这篇关于svmtrain错误"组必须是向量."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!