I would like to know how I can split in an equal number the following
Target
0 1586
1 318
in order to have the same proportion of 0 and 1 classes in a dataset to train, if my dataset is called df and includes 10 columns, both numerical and categorical.
I would consider the following
y=df['Target']
X_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.1, stratify=y)
so to do a stratification, but I do not know if it is right and I would appreciate if you could confirm it or provide an alternative to do that.
Sample of data
Fin Eco Target
High percentage 12 1
Low percentage 5 0
Medium percentage 48 0
NA 3 1
TBC NA 1
Low percentage 25 0
Medium percentage 12 0
How can I check if it is actually splitting in equal classes proportion my dataset? I think the best way to train a model should be having an equal proportion of 0 and 1 values. Right now I have 5 times data with Target=0.