LFD Book Forum  

Go Back   LFD Book Forum > Course Discussions > Online LFD course > Homework 1

Reply
 
Thread Tools Display Modes
  #1  
Old 04-07-2013, 08:37 AM
fredcommo fredcommo is offline
Junior Member
 
Join Date: Apr 2013
Posts: 2
Default *ANSWER* Homework1 - Q3

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 ?
Reply With Quote
  #2  
Old 04-07-2013, 10:45 AM
Rahul Sinha Rahul Sinha is offline
Junior Member
 
Join Date: Apr 2013
Posts: 9
Default Re: *ANSWER* Homework1 - Q3

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.
Reply With Quote
  #3  
Old 04-07-2013, 01:03 PM
fredcommo fredcommo is offline
Junior Member
 
Join Date: Apr 2013
Posts: 2
Default Re: *ANSWER* Homework1 - Q3

Thanks Rahul.
Unfortunately, 1/2 was a wrong answer here...
Reply With Quote
  #4  
Old 04-07-2013, 06:54 PM
leduran leduran is offline
Junior Member
 
Join Date: Apr 2013
Posts: 3
Smile Re: *ANSWER* Homework1 - Q3

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
Reply With Quote
  #5  
Old 04-07-2013, 10:43 PM
Rahul Sinha Rahul Sinha is offline
Junior Member
 
Join Date: Apr 2013
Posts: 9
Default Re: *ANSWER* Homework1 - Q3

Agreed. I missed that bit.
Reply With Quote
  #6  
Old 04-08-2013, 04:13 PM
Elroch Elroch is offline
Invited Guest
 
Join Date: Mar 2013
Posts: 143
Default Re: *ANSWER* Homework1 - Q3

Quote:
Originally Posted by fredcommo View Post
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.
Reply With Quote
  #7  
Old 04-09-2013, 01:46 AM
purshe purshe is offline
Junior Member
 
Join Date: Apr 2013
Posts: 1
Default Re: *ANSWER* Homework1 - Q3

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
Reply With Quote
  #8  
Old 04-09-2013, 04:35 AM
jcmorales1564 jcmorales1564 is offline
Member
 
Join Date: Apr 2013
Posts: 12
Default Re: *ANSWER* Homework1 - Q3

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.
Reply With Quote
  #9  
Old 04-09-2013, 01:15 PM
silvrous silvrous is offline
Member
 
Join Date: Apr 2012
Posts: 24
Default Re: *ANSWER* Homework1 - Q3

Quote:
Originally Posted by jcmorales1564 View Post
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.
Wow, that does make sense and it's way easier than my Bayesian solution!
Reply With Quote
  #10  
Old 04-01-2015, 01:13 AM
Juahn Juahn is offline
Junior Member
 
Join Date: Apr 2015
Posts: 1
Default Re: *ANSWER* Homework1 - Q3

Quote:
Originally Posted by leduran View Post
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
Reply With Quote
Reply

Thread Tools
Display Modes

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 Jump


All times are GMT -7. The time now is 09:21 AM.


Powered by vBulletin® Version 3.8.3
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
The contents of this forum are to be used ONLY by readers of the Learning From Data book by Yaser S. Abu-Mostafa, Malik Magdon-Ismail, and Hsuan-Tien Lin, and participants in the Learning From Data MOOC by Yaser S. Abu-Mostafa. No part of these contents is to be communicated or made accessible to ANY other person or entity.