K fold validation for feedforward net

3 visualizaciones (últimos 30 días)
Abdulaziz Almershed
Abdulaziz Almershed el 29 de Dic. de 2020
Comentada: Abdulaziz Almershed el 4 de En. de 2021
Greetings
I have created a forwardnet and becuase I only have a handful of cases i need to use K fold validation. However, I am a bit confused on how to do that. I have seen crossval and cvpartition functions but i still do not know how to use them. can you help me train the network using kfold validation?
kind regards

Respuestas (1)

Gaurav Garg
Gaurav Garg el 31 de Dic. de 2020
Hi Abdulaziz,
cvparition partitions data for cross-validation. It defines a random partition on data set and uses it to define training and test sets for validating a statistical model.
E.g. :
load ionosphere
tbl = array2table(X);
tbl.Y = Y;
rng('default') % For reproducibility
n = length(tbl.Y);
hpartition = cvpartition(n,'Holdout',0.3); % Nonstratified partition
hpartition holds the total number of observations, total number of test sets, the size of training set and the size of test size.
To display the indeces which are being used for training, you can use -
training(hpartition)
To display the indeces which are being used for testing, you can use -
test(hpartition)
While, using crossval, you can estimate the loss returned by 10-fold cross-validation error estimate.
err = crossval(criterion,X,y,'Predfun',predfun)
% returns a 10-fold cross-validation error estimate for the
% function predfun based on the specified criterion
To know more about them, you can use the links provided - 1 2
  1 comentario
Abdulaziz Almershed
Abdulaziz Almershed el 4 de En. de 2021
but is there a buit in function to train a network using k-fold validation as validating method?

Iniciar sesión para comentar.

Community Treasure Hunt

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

Start Hunting!

Translated by