Skip to content
Prev 273129 / 398506 Next

difference between createPartition and createfold functions

Hi,
On Sun, Oct 2, 2011 at 2:47 PM, <bby2103 at columbia.edu> wrote:
Well -- you could always look at the source code to find out (enter
the name of the function into your R console and hit return), but you
can also do some experimentation to find out. Using the data from the
Examples section of caret::createFolds:

R> library(caret)
R> data(oil)
R> part <- createDataPartition(oilType, 2)
R> fold <- createFolds(oilType, 2)

R> length(Reduce(intersect, part))
[1] 27

R> length(Reduce(intersect, fold))
[1] 0

Looks like `createDataPartition` split your data into smaller pieces,
but allows for the same example to appear in different splits.

`createFolds` doesn't allow different examples to appear in different
splits of the folds.

HTH,
-steve