K-fold cross validation CNN

12 visualizaciones (últimos 30 días)
abdullah abdo
abdullah abdo el 26 de Abr. de 2019
Comentada: shelvi nur el 4 de Ag. de 2021
Hi, I am trying to use K-fold cross validation with CNN, here is a part of my code
% Load the data
% split the data into two parts (Training and Testing)
% define the target output for the training
% for the CNN, how many layers want to use, for example (two Layers)
% K-fold cross validation
ind = crossvalindcrossvalind('Kfold',Train_Target,10);
for i = 1:10
vali = (ind == i)';
train = ~vali;
% Split the data for Training and Validation
Vali_data = Training_Data(:,vali);
Train_data = Training_Data(:,train);
% CNN Traning option
options = trainingOptions('sgdm',...
'InitialLearnRate',0.02, ...
'ValidationData',{Vali_data, Vali_Target}, ...
'Plots','training-progress');
% Train Network
net = trainNetwork(Train_data, Train_target, layers, options)
end
% calculate the accurcy of the model using unseen data (Testing data)
YPredicted = classify(net,TestData);
Is this procedure right for using k-fold cross validation with cnn?
Thanks
  2 comentarios
Anjuraj V.P.
Anjuraj V.P. el 29 de Oct. de 2019
What does the variable ' Train_target ' implies?
shelvi nur
shelvi nur el 4 de Ag. de 2021
what this crossvalindcrossvalind ? because Unrecognized function or variable 'crossvalindcrossvalind'.

Iniciar sesión para comentar.

Respuestas (1)

linxin chen
linxin chen el 31 de Oct. de 2019

Community Treasure Hunt

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

Start Hunting!

Translated by