Ask your own question, for FREE!
Computer Science 8 Online
OpenStudy (anonymous):

Bit of a math question. Hope it's ok if I ask it here. Picture in next post.. I've been given: F := "Your house is burning", P(F) = 0.001, B := "Neighbour says your house is burning", P(Neighbour is lying) = 0.1 Find P(F|B) Using bayes: P(F|B) = 1/a * P(B|F) * P(F) My question.. How do you find P(B|F) My reasoning was: P(B|F) Given your house is burning, The chances of your neighbour saying it's burning would be 0.9 Cause in this case there is a 0.1 chance of him lying.. (saying it's not burning)

OpenStudy (anonymous):

Pic

OpenStudy (anonymous):

I found it too simple so I calculated P(B) by saying: If your neighbour says its burning then there are 2 scenarios Saying it's burning and telling the truth = 0.001 * 0.9 Or saying it's burning and lying = 0.999 * 0.1 Add these together.. P(B) = 0.1008 If I do it this way, I get totally confused because I still don't know P(B|F) or P(F|B) wether normalized or not normalized

OpenStudy (anonymous):

A fellow udacity student I see. ... Isn't this the hw? Lol man just use what you've learnt in class! :-D Keep reviewing those last lectures about probability theory/bayes rule until you get it!

OpenStudy (anonymous):

I did, I just find it too easy to assume that P(B|F) = 0.9 and P(B|~F) = 0.1

OpenStudy (anonymous):

lol you're right... let me double check what I've answered :-P

OpenStudy (anonymous):

too bad the answers don't show what I submitted before :( .... I will try to solve it again

OpenStudy (anonymous):

Thanks man, much appreciated

OpenStudy (anonymous):

I found the same value for P(B)

OpenStudy (anonymous):

just follow the cancer question :-D

OpenStudy (anonymous):

about the localization program: I coded two solutions for it... and although they both do the same thing, the outputs are a little bit different :( one is exactly thrun's output, and the other has the last few digits different. why?

OpenStudy (anonymous):

Did you first move, then sense? As for the cancer question.. It has P(POS|C) already defined.. here you have to derive your own P(B|F) from P(neighbour is lying) = 0.1 and P(B) = neighbour says yes... I'm wondering whether I can assume P(B|F) = 0.9 or I have to use conditonal probability first

OpenStudy (anonymous):

right; I move first, then sensed. about the probability question: now I'm even more confused... seems I've assumed that p(B) = P(B|F) (and P(~B) = P(~B|F)) :-P

OpenStudy (anonymous):

That's what I was going through last night :P Kept getting more and more confused. I'm going to have one more whack at it. The outputs should match what he's given.. Are you sure your sense function is correct to begin with? He gives a sample output in the video with just sensing. Try the same thing. Also make sure the senor_right is the correct value

OpenStudy (anonymous):

by the way, P(B) is not a given as a chance only as a definition

OpenStudy (anonymous):

I tried all the sample inputs given in the question video (the simple 3x3 ones), and both my solutions yielded the same outputs for all those .... they only differ with the inputs given in the question.

OpenStudy (anonymous):

right; we are given "B = neighbor says 'yes, it is burning'"

OpenStudy (anonymous):

So there are 2 scenarios when he would say that... either the house is burning and he's telling to truth or the house isnt burning and he's lying ie: P(B) = P(F) * P(~L) + P(~F) * P(L) where P(L) := Neighbour lying

OpenStudy (anonymous):

right

OpenStudy (anonymous):

and that is equal to 0.1008 :-D

OpenStudy (anonymous):

So then P(B|F) using conditional probability would be: P(B|F) = P(B && F) / P(F) correct?

OpenStudy (anonymous):

which makes no sense to me.. because that would be: 0,1008 * 0.001 / 0.001 which gives 0,1008 again :/

OpenStudy (anonymous):

maybe it's because of conditional independence

OpenStudy (anonymous):

I guess it's because the statement B doesn't really depend on whether there's an actual file, but really on whether your neighbor is telling the truth or lying :-P

OpenStudy (anonymous):

actual fire*

OpenStudy (anonymous):

but now I've just confused myself even further :-(

OpenStudy (anonymous):

maybe JamesJ can clear the confusion.

OpenStudy (anonymous):

I think I've got it: P(B ^ F) : If F happens, the neighbour CANNOT be lying.. there for P(B ^ F) = P(~L) * P(F) or 0.0009

OpenStudy (anonymous):

that's equal to P(F|B) ?

OpenStudy (anonymous):

no that is equal to P(B && F) : Probability of neighbour saying yes and house burning at the same time

OpenStudy (anonymous):

aah right it is the non-normalized thing

OpenStudy (anonymous):

You can plug that into the conditional probability formula and get: P(B|F) = (B && F) / P (F) = 0.0009 / 0.001.. qhich is 0.9 I think I just went hugely went around my way to get the same number...

OpenStudy (anonymous):

lol

OpenStudy (anonymous):

what about P(B && ~F)

OpenStudy (anonymous):

I'm going to do it for P(B|~F) just to be sure

OpenStudy (anonymous):

P(B&&~F) : if it's not burning and he's saying it is, he's lying so = 0.1 * 0.999 = 0.0999 .. divide that by 0.999 again.. gives 0.1 I guess it's safe to assume P(B|F) = 0.9 and P(B|~F) = 0.1.. I was just confusing myself.. As for the program, can you describe to me what it is your program does?

OpenStudy (anonymous):

All that the solution to the localization program does is move the numbers in the matrix around according to what is in the movements vector, and then update the numbers depending on what's in the observations vector

OpenStudy (anonymous):

Ok the movement function, are you accounting for the fact that it might not move at all?

OpenStudy (anonymous):

right; you have to account for the fact that it stays in the same place (or it tries to move but has a certain probability defined by (1-p_move) that it stays in place)

OpenStudy (anonymous):

Are you looping through your P list correctly? I tried doing the entire thing in 1 line, couldn't figure it out. so I used 4 if's to determine which cel to add up to. It seems a bit redundant, but for some reason if I didn't do this it would not show the right numbers..

OpenStudy (anonymous):

My first solution (the one that gives answers exactly like thrun's) wasn't a bunch of one-liner functions... but my second one (the one with values slightly off) was all one/two liners.

OpenStudy (anonymous):

most likely somethings off in the loops, or it would show the right values. I really can't say without seeing the code, or update my algorithm to be slicker

OpenStudy (anonymous):

P(F) = 0.001 P(~F) = 1 - 0.001 = 0.999 P(B|F) = 0.9 (neighbor says yes when house is on fire) P(B|~F) = 0.1 (neighbor say yes when house is not on fire) p(F|B) = P(B|F) x P(F) [p = non-normalized] = 0.9 x 0.001 = 0.0009 p(~F|B) = P(B|~F) x P(~F) = 0.1 x 0.999 = .0999 does it make sense?

OpenStudy (anonymous):

yes, that's what I got too..

OpenStudy (anonymous):

I also got same results but im not sure if it's correct :/

OpenStudy (anonymous):

but second question is also very hard lol

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!