Answered step by step
Verified Expert Solution
Question
1 Approved Answer
4.8 (Stratified sampling) Let D be a training set with only 10 examples, whose labels are 1, 1, 2,2,2, 2,2, 2, 2,2, respectively. This dataset
4.8 (Stratified sampling) Let D be a training set with only 10 examples, whose labels are 1, 1, 2,2,2, 2,2, 2, 2,2, respectively. This dataset is both small in size and imbalanced. We need cross-validation during evaluation, and 2-fold CV seems a good choice. (a) Write a program to randomly split this dataset into two subsets, with five examples in each subset. Repeat this random split 10 times. The histogram of class 1 examples in these two subsets can be (0,2) or (1,1)-one subset has zero (two) and the other has two (zero) class 1 examples, or every subset has exactly one class 1 example. In your 10 splits, how many times does (0,2) appear? (Note: This number can be different if you perform the experiments multiple times.) (b) What is the probability that (0,2) will appear in one random split of these 10 examples? (c) In your 2-fold CV evaluation, if the split's class 1 distribution in the two subsets is (0,2), how will it affect the evaluation? (d) One commonly used way to avoid this issue to use stratified sampling. In stratified sampling, we perform the train/test split for every class separately. Show that if stratified sampling is used, the distribution of class 1 examples will always be (1,1)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started