Bayesian inference

I am asking a question that might be very very stupid but after nearly

2 weeks of searching for an answer I am still not clear what to do.

here is the deal: I am a CS grad, with very topological understanding of the bayesian framework. In one of my robotics classes I was introduced to the recursive bayesian update about a paritcular hypothesis i.e. p(door open|z) where z is a sensor reading whose p(z| open) and p(z| not open) are known as probabilities (not as distributions, If you can explain that case, I would love to talk about it but lets keep it simple first). Multiple readings of this sensor will allow us to increase the probability of p(door open) if it really is open using the posterior of one update as the prior for the next.

My issue is how to make a decision? In case my only hypothesis is that H_0: door is open, how can I make a decision.

Reading several books/articles/ papers on bayesian stats, one thing that I am sorts of inclined to do is the following: define a negative hypothesis say H_1:door is not open, and update both P(door open) and P(door not open) for every measurement z received from the sensor. Then after say 10 readings when I have to make a decision whether the door is open (and I can go through it) or that the door is not open, I compare P(H_1) and P(H_0). Whomever has higher probability is the hypothesis i accept. Is that a correct or accepted way of doing this decision? Is it equivalent to simply setting a threshold for P(door open) > 0.5? If not what would be the correct way in this case.

Thank you.

Reply to
Affan
Loading thread data ...

I don't really understand bayesian applications like this well enough to answer your question. Could you be a bit more precise about what type of door you are trying to determine if it's open and why you need multiple readings to get an improved probability in the first place? Why can't the sensor produce a high enough probability reading to start with that you can just trust what it tells you?

And what was known about p(door open|z)? How is that known and what does that mean?

Why would P(door not open) be something other than 1-P(door open)? What ever you are doing to calculate the probability of the door being open, the other should be the inverse.

If you want to make a decision based on whether the door is open with the highest probability of being correct, why would you do anything other than use P > 0.5?

Is the harm done by making the wrong decision equal in both cases? Meaning it's just as bad to not try when it was open (and fail as a result). as it is to try when it's closed and fail? If the harm done is not equal, then the threshold you would use would be something different than .5. You want to make the decision with the highest expected value of goodness.

If you have no way to know, or to estimate, the "harm" or "reward" from making the right decision, then there's no point in worrying about the decision in the first place because any decision will be equally good or bad. Just pick one at random and ignore the sensor. :)

Reply to
Curt Welch

What if the harm is done more for a false negative as an unopened door cant be walked through... might result in havoc? In that case how should I put a different threshold? Is there any mathematcial way of finding an optimal result if e.g. we cant tolerate more than 0.1 prob of false negative.

"Could you be a bit more precise about what type of door you are trying to determine if it's open and why you need multiple readings to get an improved probability in the first place? Why can't the sensor produce a high enough probability reading to start with that you can just trust what it tells you? "

Actually the problem i am solving is not that of door and a sensor, its actually trying to learn if there are certain features that our sensor can detect. But I am actually looking at an event/feature that is a subset of that feature i.e. sensor can detect sound, but I want to detect only my own echo (its a very loose example!). Thus not only can the sensor give me readings that are wrong, the reading can be

100% correct, but it can still be due to another factor, however that other factor (e.g. sounds) change with time relative to our own sound, but our echoes are constant. Thus by taking multiple readings I tend to reduce the probability of the reading being due to just other sounds/noise but due to my own echo.

I have to go now.. but In case this is not clear.. I will write something more clearer tommorow.

thank you so much.

Reply to
Affan

If you can assign a relative value to the decisions and the outcomes, and if the goal is to make the decision which produces maximal value, the math is straight forward. You just calculate the expected value for the two decisions, and pick the decision with the highest expected value.

So lets say it's far worse to try to walk through a closed door, than to not walk through a door which is open. So we can look at the possible true states of the environment and your decision, and assign a value to each possible result:

Door Action Open Close Try to walk 10 1 Stand still 5 10

So the above table gives us a value of how good or bad the various actions and results are. We can use those to calculate the expected value of the outcome.

If Po is your current estimate of the probability of the door being open (0 to 1), then the probablity of the door being closed is Pc = 1 - Po.

If you try to walk, the expected value is 10*Po + 1*Pc.

If you stand still, the expected value is 5*Po + 10*Pc.

For any given Po your sensor processing code is predicting, just calculate the above two expected values, and pick the decision which produces the highest expected value. We can directly calculate what value of Po will be the point where we will choose to do one vs the other by determine what the value of Po will be when the two expected values are equal. So we just write this ans solve for Po...

10Po + Pc = 5Po + 10Pc 10Po + 1 - Po = 4Po + 10 - 10Po 10po - Po - 4Po + 10Po = -1 + 10 15Po = 9 Po = 9/15 = .6 = 60%

So, (if I did the math right) for the values of worth in the table above, the optimal behavior is to try and walk when the sensor code is predicting a 60% or higher probability that the door is open.

But of course, this only works if you can come up with a reasonable set of relative values for the various decisions and results.

Now, if by "false negative" you mean both walking when the door is closed and standing still when the door is open, and you just want to keep that below 10%, there is nothing you can do unless you sensor can calculate that the door is open to better than 90% or less than 10%. If you choose to walk when the sensory says the probability is 80% you will get a 20% error rate. So if you can't mess up more than 10% of the time, you simply have to keep taking samples until your probability is over 90% or under 10%.

But that assume the probability you have calculated is correct - that it accurately reelects the true probability of the door being open (or errors on the side of caution). If the probability calculation has some known error, you have factor that in as well.

Yes, you are just improving the signal to nose ratio of your result by taking multiple samples. It's a common technique. If you now what the starting S/N is, and your noise is close to a known type of distribution, you should be able to estimate fairly accurately how accurate the reading is after each sample. But my statistics is not strong enough to tell you what the actual math is.

Informally, I would try something such as looking at how much your estimated value was changing after each sample, and wait until the average amount of changing dropped below some threshold. Test the system and see if it produces your desired 90% accuracy rate. If not, use a lower threshold until you find the value that gives you the 90% accuracy rate you need.

This assume that you can keep sampling for as long as you want to improve the estimate and the goal is to sample just long enough to hit the 90% accuracy mark. (or 99.9% if you actually meant .1% and not 10%).

Reply to
Curt Welch

Thank a bunch, I really appreciate your detailed response.. I will definately do the math as I think I can make reasonable guestimates about my systembehavior and go from there.

Again,

Thank you.

Regards, Affan

Reply to
Affan

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.