how to make the X,Y for fitcsvm,as i get error using it?

1 回表示 (過去 30 日間)
Sheema Khattak
Sheema Khattak 2014 年 8 月 19 日
コメント済み: Shashank Prasanna 2014 年 8 月 22 日
SVMModel = fitcsvm(X,Y,'KernelFunction','rbf','Standarize',true,'ClassNames',{'negClass','posClass'});
Undefined function 'fitcsvm' for input arguments of type 'cell'.
In the description of fitcsvm ,Y can be a categorical or character array, logical or numeric vector, or cell array of strings is mentioned how can I build it to be ready to fit in fitcsvm. my x is 6*12 and y=[1;1;1;-1;-1;-1]; for which I get error.It also has mentioned that Y — Array of class labels with each row corresponding to the value of the corresponding row in X. Y can be a character array, categorical, logical or numeric vector, or vector cell array of strings. Column vector with each row corresponding to the value of the corresponding row in X. How can I build Y be a "character array, categorical, logical or numeric vector, or vector cell array of strings"

回答 (1 件)

Shashank Prasanna
Shashank Prasanna 2014 年 8 月 19 日
What version of MATLAB are you using? fitcsvm was introduced in MATLAB R2014a. If you are using an earlier version of MATLAB you may have to use svmtrain:
You can check the version of MATLAB by typing:
>>ver
  4 件のコメント
Sheema Khattak
Sheema Khattak 2014 年 8 月 22 日
Yes it is installed Statistics toolbox 8.3 and 2014a has statistics toolbox 9.0.
Shashank Prasanna
Shashank Prasanna 2014 年 8 月 22 日
shah, this is confusing, you just mentioned that you don't have R2014a if your previous post.
In any case, if you have the toolbox you should be able to access svmtrain function. If you can't then you may have a path issue, try the following:
>> restoredefaultpath
>> rehash tolboxcache
If you still have trouble, I recommend contacting technical support. I also recommend trying some example code from the documentation directly to make sure it is not working after the above steps.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeCluster Analysis and Anomaly Detection についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by