Bayesian Sensor Confusion

Given this sensor configuration:

platform: bayesian
name: 'is_sleeping'
prior: 0.33
probability_threshold: 0.95
observations:
 - entity_id: 'device_tracker.phone'
   platform: 'state'
   to_state: 'home'
   prob_given_true: .3
   prob_given_false: .01

If the current state of device_tracker.phone is home, why does the value of prob_given_false change the calculated probability rather than get ignored?

If I understand what this is saying, it’s that

  • At any given time, there’s a 33% chance that I am sleeping
  • If my phone is at home, there is a 30% chance that I am sleeping
  • If my phone is not at home, there is a 1% chance that I am sleeping

In other words, for predicting whether I am sleeping, given that I am at home, what does it matter whether I would be sleeping if I weren’t at home? As prob_given_false goes to 0, the bayesian goes to 1, and vice versa.

More to the point: what is prob_given_false exactly? The docs say it is

The probability of the observation occurring, given the event is false

My understanding is that:

  • The observation is: I am sleeping
  • The event is: device_tracker.phone is in the home state

If my phone is not at home, the probability that I am sleeping is basically 0. That doesn’t mean that when I am home, I am 100% guaranteed to be asleep… but I believe that’s the behavior I am seeing, so I must be misunderstanding something about this.

I haven’t experimented with the Bayesian integration so I can’t offer any guidance other than this good description of how to use it:

How Bayes Sensors work, from a Statistics Professor (with working Google Sheets!) - Configuration - Home Assistant Community (home-assistant.io)

Thanks, that was helpful. Turns out I mixed up the “event” and the “observation” when reading the docs.

1 Like