Not enough input arguments

1 view (last 30 days)
Feyza Zehra Asik
Feyza Zehra Asik on 16 Oct 2021
Answered: yanqi liu on 27 Dec 2021
I'm very new to MATLAB and I am having some trouble. It says error using predict (line 70) Not enough input arguments. It gives this error for line [c_matrix,Result,RefereceResult]= confusion.getMatrix(actual,predict);
load veri.mat
load etiket.mat
figure;
plot(veri(1,:))
%özellik çıkarımı
for i=1:length(etiket)
x=veri(i,:);
ozellik(1,i)=(1/length(x))*sum(x.^2); %enerji
ozellik(2,i)=std(x); %standart
ozellik(3,i)=mean(abs(x)); %mutlak değerin ortalamaası
ozellik(4,i)=skewness(x); %agirlik
ozellik(5,i)=kurtosis(x); %basiklik
end
%4 katli capraz doğrulama
fold=cvpartition(etiket, 'kfold',4);
label=etiket;
%egitim ve test idelerinin ayrilmasi
trainIdx=fold.training(1); testIdx=fold.test(1);
%egitim verisinin ayrilmasi
Xtrain=ozellik(:,trainIdx); Ytrain=label(trainIdx);
%test verisinin ayrilmasi
Xtest=ozellik(:,testIdx); Ytest=label(testIdx);
%DVM Tasarımı
%cekridek fonksiyonu seçimi
t= templateSVM('Standardize',true, 'KernelFunction','gaussian');
%model eğitim
giris=transpose(Xtrain);
SVMModel = fitcecoc(giris,Ytrain,'Learners',t,'FitPosterior',true,...
'Classnames', {'Sag','Swell', 'Flicker'})
%model test islemi
predict_label = predict(SVMModel,transpose(Xtest));
predict_label = (categorical(cellstr(predict_label)));
for i=1: length(Ytest)
if Ytest(i,1)=='sag'
actual(1,i)=1;
end
if Ytest(i,1)=='Swell'
actual(1,i)=2;
end
if Ytest(i,1)=='Flicker'
actual(1,i)=3;
end
i
end
[c_matrix,Result,RefereceResult]= confusion.getMatrix(actual,predict);
%es olusum matrisinin gösterimi
figure;
cm= confusionchart(Ytest, predict_label,'RowSummary','row-normalized','ColumnSummary','column-normalized');
cm.Title = 'Test Verisi İcin Es Olusum Matrisi';

Answers (2)

Yongjian Feng
Yongjian Feng on 3 Dec 2021
What is confusion.getMatrix? The built-in confusion is a function. There is another confusionmat, but the return arguments don't match yours.

yanqi liu
yanqi liu on 27 Dec 2021
yes,sir,may be use
[c_matrix,Result,RefereceResult]= confusion(actual,predict_label);

Categories

Find more on Deep Learning Toolbox in Help Center and File Exchange

Products


Release

R2019a

Community Treasure Hunt

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

Start Hunting!