Implementation of stratified crossvalidation for classification problem Is this all I have to do to implement 2 fold stratified cross validation:


*

*Assign random number from uniform distribution [0...1] to each row.

*Assign row to fold 1 if random number <= 0.5 otherwise assign to fold 2


Does this ensure that the class priors are roughly the same in each fold?
 A: The purpose of stratified cross validation is to ensure that each fold has a class distribution similar to the data set as a whole. Your proposed approach doesn't do anything to maintain that distribution. If you have a very small class, you might get a fold that has no records with that class as the outcome. 
To construct folds that maintain the class distribution, first break up your data set into homogeneous subsets by class level. For example, if you have a binary classification problem with labels zero and one, you'll get two subsets, one with all records with label zero and one with all records with label one. Then for each subset, run your partition algorithm (assigning a random number from uniform distribution then assigning row to fold based on whether it's <= .5 or not), to break each subset up into two equal-sized folds. Now you can make the data sets for your cross validation by combining the class-specific folds so that each cross-validation set has one fold of each class level. 
