@cvpartition/cvpartition
              Create a partition object for cross validation.
X may be a positive integer, interpreted as the number of values n to partition, or a vector of length n containing class designations for the elements, in which case the partitioning types KFold and HoldOut attempt to ensure each partition represents the classes proportionately.
partition_type must be one of the following:
Divide set into k equal-size subsets (this is the default, with k=10).
Divide set into two subsets, "training" and "validation". If k is a fraction, that is the fraction of values put in the validation subset; if it is a positive integer, that is the number of values in the validation subset (by default k=0.1).
Leave-one-out partition (each element is placed in its own subset).
Training and validation subsets that both contain all the original elements.
Subset indices are as given in X.
The following fields are defined for the ‘cvpartition’ class:
Class designations for the elements.
Subset indices for the elements.
Number of different classes.
n, number of elements in data set.
Number of testing subsets.
Number of elements in (each) testing subset.
Number of elements in (each) training subset.
Partition type.
See also: crossval, @cvpartition/display
Source Code: @cvpartition/cvpartition
| 
 ## Partition with Fisher iris dataset (n = 150)
 ## Stratified by species
 load fisheriris
 y = species;
 ## 10-fold cross-validation partition
 c = cvpartition (species, 'KFold', 10)
 ## leave-10-out partition
 c1 = cvpartition (species, 'HoldOut', 10)
 idx1 = test (c, 2);
 idx2 = training (c, 2);
 ## another leave-10-out partition
 c2 = repartition (c1)
K-fold cross validation partition
          N: 150
NumTestSets: 10
  TrainSize: 135  135  135  135  135  135  135  135  135  135
   TestSize: 15  15  15  15  15  15  15  15  15  15
HoldOut cross validation partition
          N: 150
NumTestSets: 1
  TrainSize: 140
   TestSize: 10
HoldOut cross validation partition
          N: 150
NumTestSets: 1
  TrainSize: 140
   TestSize: 10
                     |