LFD Book Forum *ANSWER* Homework1 - Q3
 Register FAQ Calendar Mark Forums Read

#1
04-07-2013, 08:37 AM
 fredcommo Junior Member Join Date: Apr 2013 Posts: 2

I'm a little bit confused here, and quite upset about bugging on such simple probabilistic problem !!

Since we are supposed to pick the 2nd ball in the same bag we picked the first one, which was black, there are 2 possible outcomes:
Either I picked a black ball from the bag with 2 black balls, and in that case the 2nd will be black, or I picked the black ball from the bag which contained a black and a white ball, and in that case I'll pick a white ball.
So the probability of picking a black ball, given that I have to pick from the same bag, should be 1/2.
It would be 2/3 if I would have the choice of picking the 2nd ball from any of the 2 bags.

What did I miss here ?
#2
04-07-2013, 10:45 AM
 Rahul Sinha Junior Member Join Date: Apr 2013 Posts: 9

Nothing! Your line of reasoning is correct.
So, P(B|B) can be obtained as the P(choosing a bag)*P(getting a black ball)*P(getting the second black ball). If we choose the BB bag, this evaluates as 1/2*1*1. If we choose the BW bag, the values are 1/2*1/2*0 = 0.
#3
04-07-2013, 01:03 PM
 fredcommo Junior Member Join Date: Apr 2013 Posts: 2

Thanks Rahul.
Unfortunately, 1/2 was a wrong answer here...
#4
04-07-2013, 06:54 PM
 leduran Junior Member Join Date: Apr 2013 Posts: 3

Hi, think of this problem in the following way: if the first ball withdrawn was black , then for the second ball to be also black it must come from the bag containing the two black balls. So this problem is equivalent to finding the probability that the bag with the two black balls was choosen given that the first withdrawn ball was black.

Call Bag1 the event of choosing the bag with the 2 black balls, and B the event that the first ball is black, then:

P(bag1|B) = P(B|bag1)*P(bag1)/P(B) = P(B|bag1)*P(bag1)/P(B|bag1)*P(bag1)+P(B|bag2)*P(bag2)

= (1)(0.5)/(1)(0.5)+(0.5)(0.5)=2/3

Hope it helps
#5
04-07-2013, 10:43 PM
 Rahul Sinha Junior Member Join Date: Apr 2013 Posts: 9

Agreed. I missed that bit.
#6
04-08-2013, 04:13 PM
 Elroch Invited Guest Join Date: Mar 2013 Posts: 143

Quote:
 Originally Posted by fredcommo I'm a little bit confused here, and quite upset about bugging on such simple probabilistic problem !! Since we are supposed to pick the 2nd ball in the same bag we picked the first one, which was black, there are 2 possible outcomes: Either I picked a black ball from the bag with 2 black balls, and in that case the 2nd will be black, or I picked the black ball from the bag which contained a black and a white ball, and in that case I'll pick a white ball. So the probability of picking a black ball, given that I have to pick from the same bag, should be 1/2. It would be 2/3 if I would have the choice of picking the 2nd ball from any of the 2 bags. What did I miss here ?
The key point is that although you do have two possible situations where you have a black ball, one is twice as likely as the other. You are implicitly assuming the two are equally likely.
#7
04-09-2013, 01:46 AM
 purshe Junior Member Join Date: Apr 2013 Posts: 1

One can solve this problem intuitively without applying formulas

Note that we are calculating the probability after the first ball is drawn.
We know there are 4 possible scenarios are possible at the time of drawing the first ball
1: (Bag1, Black1),
2: (Bag1, Black2),
3: (Bag2, Black)
4: (Bag2, White)

Since we have already drawn the first ball & know it is black, we deduce that the 4th option has not occurred. So, we narrow down the possible scenario list to 3

Given this, we need to determine if the second ball will also be black. Out of the three shortlisted options, two of those options will give us the required scenario (option 1 & 2).

Hence probability = 2/3
#8
04-09-2013, 04:35 AM
 jcmorales1564 Member Join Date: Apr 2013 Posts: 12

Hello. This is my first post in the forum. I am trying very hard to maintain the pace in this course. I lost interest at first since I thought that I needed to have the book to participate in the forum but I received an email from the instructor that indicated the answer to the login question (thanks!). I finished the Data Analysis course in Coursera (Dr. Jeff Leek) a couple of weeks ago (that is where I became interested in Machine Learning) and the forum was one of the highlights. I am glad that I have finally been able to join this forum.

At any rate, in this problem I initially thought that p = 1/2 but this answer kept bugging me... I kept recalling the famous Monty Hall three-door scenario where p = 2/3. Then I recalled the concept of sample space, i.e., the set of all possible outcomes, and I was able to finally visualize the problem properly.

Define the bags and the balls as follows:

B = Black Ball
W = White Ball
BBbag = bag with 2 black balls
BWbag = bag with one black and one white ball

There are three actions that take place:
1. Select a bag
2. Select the first ball from the bag
3. Select the second ball from the bag

Separating each action by a hyphen, then the set of possible outcomes or Sample Space is:
1. BWbag - W - B
2. BWbag - B - W
3. BBbag - B - B
4. BBbag - B - B

The condition set by the problem is that the first ball that is chosen must be black so only the last three cases in the sample space apply. Of these three cases, only two meet the outcome (second ball is black).

So, defining probability as the ratio of the number of equally likely outcomes that produce a given event to the total number of possible outcomes that meet our condition, then the probability that the second ball is black is 2/3.
#9
04-09-2013, 01:15 PM
 silvrous Member Join Date: Apr 2012 Posts: 24

Quote:
 Originally Posted by jcmorales1564 Hello. This is my first post in the forum. I am trying very hard to maintain the pace in this course. I lost interest at first since I thought that I needed to have the book to participate in the forum but I received an email from the instructor that indicated the answer to the login question (thanks!). I finished the Data Analysis course in Coursera (Dr. Jeff Leek) a couple of weeks ago (that is where I became interested in Machine Learning) and the forum was one of the highlights. I am glad that I have finally been able to join this forum. At any rate, in this problem I initially thought that p = 1/2 but this answer kept bugging me... I kept recalling the famous Monty Hall three-door scenario where p = 2/3. Then I recalled the concept of sample space, i.e., the set of all possible outcomes, and I was able to finally visualize the problem properly. Define the bags and the balls as follows: B = Black Ball W = White Ball BBbag = bag with 2 black balls BWbag = bag with one black and one white ball There are three actions that take place: 1. Select a bag 2. Select the first ball from the bag 3. Select the second ball from the bag Separating each action by a hyphen, then the set of possible outcomes or Sample Space is: BWbag - W - B BWbag - B - W BBbag - B - B BBbag - B - B The condition set by the problem is that the first ball that is chosen must be black so only the last three cases in the sample space apply. Of these three cases, only two meet the outcome (second ball is black). So, defining probability as the ratio of the number of equally likely outcomes that produce a given event to the total number of possible outcomes that meet our condition, then the probability that the second ball is black is 2/3.
Wow, that does make sense and it's way easier than my Bayesian solution!
#10
04-01-2015, 01:13 AM
 Juahn Junior Member Join Date: Apr 2015 Posts: 1

Quote:
 Originally Posted by leduran Hi, think of this problem in the following way: if the first ball withdrawn was black , then for the second ball to be also black it must come from the bag containing the two black balls. So this problem is equivalent to finding the probability that the bag with the two black balls was choosen given that the first withdrawn ball was black. Call Bag1 the event of choosing the bag with the 2 black balls, and B the event that the first ball is black, then: P(bag1|B) = P(B|bag1)*P(bag1)/P(B) = P(B|bag1)*P(bag1)/P(B|bag1)*P(bag1)+P(B|bag2)*P(bag2) = (1)(0.5)/(1)(0.5)+(0.5)(0.5)=2/3 Hope it helps

leduran's reply doesn't have enough parentheses, which has to be corrected

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home General     General Discussion of Machine Learning     Free Additional Material         Dynamic e-Chapters         Dynamic e-Appendices Course Discussions     Online LFD course         General comments on the course         Homework 1         Homework 2         Homework 3         Homework 4         Homework 5         Homework 6         Homework 7         Homework 8         The Final         Create New Homework Problems Book Feedback - Learning From Data     General comments on the book     Chapter 1 - The Learning Problem     Chapter 2 - Training versus Testing     Chapter 3 - The Linear Model     Chapter 4 - Overfitting     Chapter 5 - Three Learning Principles     e-Chapter 6 - Similarity Based Methods     e-Chapter 7 - Neural Networks     e-Chapter 8 - Support Vector Machines     e-Chapter 9 - Learning Aides     Appendix and Notation     e-Appendices

All times are GMT -7. The time now is 02:14 AM.