Implement Stratified sampling. Given training data, class labels and the fraction of validation data per class 'test_size'. Write a method to sample train data, test data, train labels and test labels such that each class has 'test_size' fraction of data/labels for validation and 1-test_size fraction of data/labels for training.

icon
Related questions
Question
Implement Stratified sampling.
Given training data, class labels and the fraction of validation data per class
'test_size'. Write a method to sample train data, test data, train labels and test
labels such that each class has ‘test_size' fraction of data/labels for validation
and 1-test_size fraction of data/labels for training.
Transcribed Image Text:Implement Stratified sampling. Given training data, class labels and the fraction of validation data per class 'test_size'. Write a method to sample train data, test data, train labels and test labels such that each class has ‘test_size' fraction of data/labels for validation and 1-test_size fraction of data/labels for training.
Expert Solution
steps

Step by step

Solved in 4 steps with 2 images

Blurred answer