Classification learner APP, why is there no leave one out option?

1 visualización (últimos 30 días)
Dear machine learning experts,
I am using the classification learner APP to easily run all algorithms at the same time.
First you have to choose if you want to do Holdout or k-fold but there is no option for leave one out (max number of k-fold = to 50 if I remember correctly).
So, what I have been doing is the following, please tell me if it makes sens:
I selected k-fold (with 5 k, whatever no importance), then I exported the code from the APP and replaced k by the number of line in my training data.
% Perform cross-validation
%rng('default');
partitionedModel = crossval(trainedClassifier.ClassificationEnsemble, 'KFold', machine.K_fold);
% Compute validation predictions
[validationPredictions, validationScores] = kfoldPredict(partitionedModel);
% Compute validation accuracy
validationAccuracy = 1 - kfoldLoss(partitionedModel, 'LossFun', 'ClassifError');
machine.K_fold being now equal not to 5 anymore but to the number of line present in my training data.
Does it do the job correctly ?
Many thanks in advance,
Pierre

Respuesta aceptada

Bernhard Suhm
Bernhard Suhm el 22 de Abr. de 2018

Leaving one out is not supported in the Learner app because it may have significant runtime, but it is supported in the programmatic version of crossval, just pass it 'leaveout',1, see doc on using crossval.

Más respuestas (0)

Community Treasure Hunt

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

Start Hunting!

Translated by