Sorry u mean that my DatasetTrain which is 4000 positive and 4000 negative if used this function it wil give me 70% balanced training and 30% balanced validation?
train_test_split( DatasetTrain,test_size=.3,train_size=.7, stratify??)
I am using:````
DatasetTrain=CMBDataClassifier(root_dirTrain,root_dirTest,split=‘train’,transforms=transform,debug=False,CounterIteration=Iteration,SubID=0,TPID=0)
train_len = int(0.7*len(DatasetTrain))
valid_len = len(DatasetTrain) - train_len

TrainData1, ValidationData1 = random_split(DatasetTrain,[train_len, valid_len])
trainloader=torch.utils.data.DataLoader(TrainData1, batch_size=32,shuffle=True,drop_last=True, num_workers=0)

validationloader=torch.utils.data.DataLoader(ValidationData1, batch_size=6, drop_last=True,num_workers=0)```

my problem is maybe TrainData1 and  ValidationData1 will be unbalanced in case of positive and negative class.