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 Center および File ExchangeExtend Testing Frameworks についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by