Qury for SVM classifier : svmtrain function
1 次查看(过去 30 天)
显示 更早的评论
I want to use SVMStruct = svmtrain(Training,Group) for two classes (Noraml and Abnormal)images classification purpose,and the size of the Training matrix is 1*40 cells each cell is 75 rows * 10 columns so I want to give this Training matrix to the svmtrain function but after calling the svmtrain function I got this error :
*Error using svmtrain (line 241)
TRAINING must be a numeric matrix*
Could anyone guide how to correct this error,because I am really stuck in that error,thank you.
The following are code lines what I tried :
clc
clear all;
close all;
%% After creating them in another section of code this section for loading two training matrices
load('norGlobal_matrix_train_variablek10bin25md.mat')
load('abGlobal_matrix_train_variablek10bin25md.mat')
counter_im=1;
[row ,col]=size(norGlobal_matrix_train_variablek10bin25md);
for i=1:10:row temp=norGlobal_matrix_train_variablek10bin25md(i:i+9,1:end);
trasposed_temp=temp';
normal_features {counter_im} =trasposed_temp;
traininglabel{counter_im}=1 ;
counter_im=counter_im+1;
end
svm=svmtrain(normal_features{:}, traininglabel{:});
0 个评论
回答(1 个)
Ping-Chang Shih
2014-9-29
Since the two training matrices are not attached to this question, the only conjecture I could make is some elements in "norGlobal_matrix_train_variablek10bin25md" are not numeric variables. An easy test can be perform to test if all elements in "normal_features" are numeric values: You can use
isnumeric([normal_features{:}]);
If this function returns 1, then all elements in normal_features are numeric. Please note that "normal_features{:}" is wrapped in brackets because "normal_features{:}" itself returns multiple arguments, but function "isnumeric" only takes one argument as input.
If this does not answer your question, please attach the "MAT" files required to execute the code.
1 个评论
Isra Anwar
2016-4-18
Even I am facing the same issue. The size of the Training matrix is 40*1 cells each cell is 200*1 so I want to give this Training matrix to the svmtrain function but after calling the svmtrain function I got this error: Error using svmtrain (line 241) TRAINING must be a numeric matrix.
I have also attached my mat file.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Logical 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!