필터 지우기
필터 지우기

Qury for SVM classifier : svmtrain function

조회 수: 2 (최근 30일)
hamed abdulaziz
hamed abdulaziz 2014년 4월 20일
댓글: Isra Anwar 2016년 4월 18일
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{:});

답변 (1개)

Ping-Chang Shih
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
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.

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

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

Start Hunting!

Translated by