How does the classification learner app implement k-fold cross validation?

조회 수: 11 (최근 30일)
Hi
Does anyone know how the k-fold cross validation is implemented in the classification learner app? Specifically, does it automatically stratify the folds?
Thanks
James

채택된 답변

the cyclist
the cyclist 2023년 3월 21일
I am most definitely not an expert in this app, but I built a simple model using the default settings, and then exported the function. It has this line
% Perform cross-validation
partitionedModel = crossval(trainedClassifier.ClassificationTree, 'KFold', 5);
which suggests to me that it does not stratify by default. (The crossval function accepts a 'Stratify' Name-Value pair, which is not present here.)
I could not see a way to specify this in the app itself, but maybe there is. You could contact support to find out, if you don't get an answer here.
  댓글 수: 2
James Alix
James Alix 2023년 3월 21일
Ok, thats a good idea.
Searching around today I found this:
By default, crossval ensures that the class proportions in each fold remain approximately the same as the class proportions in the response variable ... on this cvpartion page (https://uk.mathworks.com/help/stats/cvpartition.html#d124e288211) but I'll email support and see if I can confirm.
Thanks
James
the cyclist
the cyclist 2023년 3월 21일
Ah, I see that whether crossval stratifies by default or not is dependent on the nature of the first argument (just a number, or the group).

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Classification Learner App에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by