why my models testing accuracy gets worse

조회 수: 3 (최근 30일)
uma
uma 2022년 6월 23일
I have written my code below and dataset is also attached. After applyng the 10 fold cross-validation, the testing accuracy gets worse while there is no problem in training accuracy. Please help me to resovle this issue.
data1=xlsread('waveform.csv');
data=data1(:,1:end);
groups=data1(:,end);
Fold=10;
indices = crossvalind('Kfold',length(groups),Fold); % create indices of 10 fold cross-validation, Group is the vector containing the class label for each obsevation
for i =1:Fold % create train and test sets
display(['cross validation, folds' num2str(i)])
testy = (indices == i);
trainy = (~testy);
TrainInputData=data(trainy,:);
TrainOutputData=groups(trainy,:);
TestInputData=data(testy,:);
TestOutputData=groups(testy,:);
%
% set the parameters
%
% regularization parameter: [C1, C2, C3] for each layer respectively
% kernel parameters: [SIG1, SIG2, SIG3] for each layer respectively
C1 = 1; C2 = 1; C3 = 1;
SIG1 = 1; SIG2 = 1; SIG3 = 1;
[TrainingTime, TestingTime, TrainingAccuracy, TestingAccuracy] = ...
MLKELM([TrainInputData TrainOutputData], [TestInputData TestOutputData], 1, [C1, C2, C3], 'RBF_kernel', [SIG1, SIG2, SIG3], 3)
testing_Accuracy_f(i)=TestingAccuracy;% keep testing acc for each fold
end
mean=sum(testing_Accuracy_f)/length(testing_Accuracy_f);
StandDevx = sqrt(sum((testing_Accuracy_f-mean).^2)/(length(testing_Accuracy_f)-1));

답변 (0개)

카테고리

Help CenterFile Exchange에서 Extend Testing Frameworks에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by