| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → Statistics Toolbox |
| Contents | Index |
| Learn more about Statistics Toolbox |
Repartition data for cross-validation
cnew = repartition(c)
cnew = repartition(c) constructs an object cnew of the cvpartition class defining a random partition of the same type as c, where c is also an object of the cvpartition class.
Repartitioning is useful for Monte-Carlo repetitions of cross-validation analyses. repartition is called by crossval when the 'mcreps' parameter is specified.
Partition and repartition 100 observations for 3-fold cross-validation:
c = cvpartition(100,'kfold',3)
c =
K-fold cross validation partition
N: 100
NumTestSets: 3
TrainSize: 67 66 67
TestSize: 33 34 33
cnew = repartition(c)
cnew =
K-fold cross validation partition
N: 100
NumTestSets: 3
TrainSize: 67 66 67
TestSize: 33 34 33Check for equality of the test data in the first fold:
isequal(test(c,1),test(cnew,1))
ans =
0![]() | reorderlevels (categorical) | replacedata (dataset) | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |