fitcsvm error - "only floating-point data for x"

Hi, I am trying to train my SVM model (emotion classification using EEG).
I get several errors from the below line of code:
>>SVMmodelA=fitcsvm(D,Abin,'KernelFunction','Linear','Standardize',true,'ClassNames',{'low arousal','high arousal'})
Error using ClassificationSVM.prepareData (line 618)
You can pass only floating-point data for X to SVM.
Error in classreg.learning.FitTemplate/fit (line 213)
this.PrepareData(X,Y,this.BaseFitObjectArgs{:});
Error in ClassificationSVM.fit (line 239)
this = fit(temp,X,Y);
Error in fitcsvm (line 278)
obj = ClassificationSVM.fit(X,Y,varargin{:});
________________
Re the first error, another post on here says convert your array into a matrix which I have already done.
Can anyone help??
Are there any other functions or ways of training an SVM?

2 件のコメント

Julia Down
Julia Down 2016 年 9 月 25 日
This was the answer: SVMmodelA=fitcsvm(T.data,Abin,'KernelFunction','Linear','Standardize',true,'ClassNames',{'0','1'})
Walter Roberson
Walter Roberson 2016 年 9 月 25 日
Yup, that would do it.

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

回答 (2 件)

Walter Roberson
Walter Roberson 2016 年 9 月 24 日

0 投票

SVMmodelA = fitcsvm(double(D), double(Abin), 'KernelFunction', 'Linear', 'Standardize', true, 'ClassNames', {'low arousal', 'high arousal'})

2 件のコメント

Julia Down
Julia Down 2016 年 9 月 25 日
Hi Walter, thank you for your answer. What does using double on the data and label attribute do?
I did it and got this error: Error using double Conversion to double from struct is not possible.
Thanks
Walter Roberson
Walter Roberson 2016 年 9 月 25 日
Which MATLAB version are you using?
Please show how D and Abin are constructed and what their class() and size() are.
fitcsvm() accepts only table objects or a numeric array for its first argument, but it appears you are passing in a struct for the first argument.

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

ALi Arshad
ALi Arshad 2016 年 11 月 18 日

0 投票

Hi, I am trying to train my SVM model i am getting below error
Error in fitcsvm (line 278) obj = ClassificationSVM.fit(X,Y,varargin{:});
Error in ali3 (line 8) SVMMod = fitcsvm(Data1, ClassName);

1 件のコメント

Walter Roberson
Walter Roberson 2016 年 11 月 18 日
What is class(Data1) and class(ClassName) and the size() of each of those?

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

カテゴリ

質問済み:

2016 年 9 月 24 日

コメント済み:

2016 年 11 月 18 日

Community Treasure Hunt

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

Start Hunting!

Translated by