问题
I am running
SVMStruct = svmtrain(xTrain, yTrain);
and the error I get is
Undefined function or method 'svmtrain' for input arguments of type 'double'
I am pretty sure xTrain and yTrain are matrices though:
size(xTrain)
ans =
544 28
size(yTrain)
ans =
544 1
Any idea what's going on here?
回答1:
It sounds like the svmtrain
function isn't on your path. If
which svmtrain
displays "svmtrain not found", then you should make sure that you have the bioinformatics toolbox (type ver
and see if it is in the list) and it is in your path.
回答2:
It might be that you are missing the bioinformatics toolbox as others have said. But it could also be that you want the LibSVM library. This was the case in third-party code I had to run. Get the library here: http://www.csie.ntu.edu.tw/~cjlin/libsvm/
回答3:
The second argument to svmtrain
should be a vector of integers or logicals, where the value in each row corresponds to the values in the same row of the training matrix/vector. It sounds like your case may be more regression if you're trying to output double values for the training data. In that case, you may want to look into regression algorithms. If you still want multi-class classification, you need to adjust your output accordingly.
回答4:
yes the bioinformatics toolbox is the key point! install it using a longer key! you will see it in your custom intall selection!
来源:https://stackoverflow.com/questions/10115219/error-undefined-function-or-method-svmtrain-for-input-arguments-of-type-doub