# sklearn stratifying dataset with more than one label

I have come across sklearn.model_selection.train_test_split as a method to split up the train and testing dataset.

Furthermore they have a stratify which you can set to the labels to ensure your train and test data set have approximately the same proportion of labels of each type.

My question is what if you have more than one type of label for your data, so that your labels are not a size len(dataset) x 1 but a size of len(dataset) x m where m is the number of your label types. What tool can you use to stratify (and split) your dataset in the multilabel case.

• Maybe you could merge the columns that contain the labels, do the stratification, and unmerge them afterwards? – Pallie Apr 23 '19 at 12:11