[Matlab] - Stratified Sampling of Multidimentional Data

GenX

New Member
#1
I want to divide a corpus into training & testing sets in a stratified fashion.

The observation data points are arranged in a Matrix A as

A=[16,3,0;12,6,4;19,2,1;.........;17,0,2;13,3,2]

Each column of the matrix represent a distinct feature.

In Matlab, the cvpartition(A,'holdout',p) function requires A to be a vector. How can I perform the same action with A as a Matrix i.e. resulting sets have roughly the same distribution of each feature as in the original corpus.