Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Question about cvpartition

453 views
Skip to first unread message

Maria

unread,
Jun 7, 2012, 2:55:07 AM6/7/12
to
Hi,

The function cvpartition divides the observations into k disjoint subsamples (or folds), chosen randomly but with roughly equal size. Does each of the folds include equal number of observations of all groups? Are the observations different in each fold, or is it possible that some of the observations are same for example in first and second folds.

Best Regards,

Maria

Alan_Weiss

unread,
Jun 7, 2012, 8:38:53 AM6/7/12
to
Fro the cvpartition reference page:
"c = cvpartition(n,'kfold',k) constructs an object c of the cvpartition
class <cvpartitionclass.html> defining a random partition for k-fold
cross-validation on n observations. The partition divides the
observations into k disjoint subsamples (or /folds/), chosen randomly
but with roughly equal size. The default value of k is 10."

The number of observations of each group is random, you are not
guaranteed to have an equal or even nearly equal number of observations
of each group.

Alan Weiss
MATLAB mathematical toolbox documentation

Ilya Narsky

unread,
Jun 7, 2012, 9:46:48 AM6/7/12
to
"Maria " <maria....@luukku.com> wrote in message
news:jqpj8b$7kn$1...@newscl01ah.mathworks.com...
If you look at the doc or help for cvpartition, you will see that it accepts
two signatures:

c = cvpartition(n,'kfold',k)
c = cvpartition(group,'kfold',k)

The first syntax is to partition *without* stratification by group. The
second syntax is to partition *with* stratification by group. If you need an
equal number of observations per group, use the 2nd syntax.

The answer to your second question is in your post. You said "divides the
observations into k disjoint subsamples". 'Disjoint" means that each
observation is used for one fold only. -Ilya



Maria

unread,
Jun 8, 2012, 1:29:31 AM6/8/12
to
"Ilya Narsky" <ina...@mathworks.com> wrote in message <jqqbc8$f1m$1...@newscl01ah.mathworks.com>...
Thank you very much for your answer!

Regards,

Maria
0 new messages