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.
Classification learner APP, why is there no leave one out option?
14 views (last 30 days)
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
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,