I want to subsample a numpy array (shape = (0,n)), such that distribution of elements in train and test remains approximately same or there should be atleast one element in train and test of each class. eg:
a = [1,2,3,1,3,3,2,1,2,1]
train = [1,1,2,2,3,3]
test = [1,1,2,3]
I want to subsample my parameters and outputs based on the outputs. For now, I am using np.random.choice to take random indexes. Is there any way i can check for distribution in python
np.random.choiceshould do the work.