Enhancing Bermuda tracking with the Bayesian integration #561
Replies: 3 comments 2 replies
-
This is a great write-up, thanks! I can assure you though that I'm far more likely to be in the kitchen than the bedroom at 4am! 🤣 |
Beta Was this translation helpful? Give feedback.
-
good |
Beta Was this translation helpful? Give feedback.
-
Relating to this, I've been working on integrating other machine learning models with Home Assistant specifically to improve Bermuda, and give it the ability to detect my phone in rooms that do not currently have BLE sensors. Currently it supports Random Forest and KNN, but I'll be adding a few more algorithms soon. No mathematics or in-depth knowledge of machine learning algorithms required. It's pretty much entirely just point and click. I'd appreciate any feedback :-) |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
TL;DR
The idea
Not many people have their phones with them every minute of the day. They're forgotten, left on charge, set aside when you need both hands free. This limits the effectiveness of any room presence integration and Bermuda is no exception. It tracks devices, not people.
The Bayesian integration monitors the state of multiple sensors and calculates the probability of something being true. If you set up a Bayesian sensor for each room, Home Assistant can estimate that while there is a chance that Ashley will be in the kitchen (because his phone is there), other sensors show that the chances of his being in the living room are greater.
It sounds flaky, but if you monitor enough sensors, it's remarkably accurate.
The Bayesian integration can:
The Bayesian integration
The Bayesian integration tests a statement like "Ashley is in the living room" against a set of sensors and generates a binary sensor - true or false.
The binary entity is not particularly useful in this application, but it has an attribute probability which is assigned a number between 0 (false) and 1 (true). (I personally use a template to convert this to a percentage, which I find easier to read at a glance). So if you have a Bayesian sensor for each room, the one with the highest probability is the most likely room.
This not simply a matter of adding up the number of sensors - the value of each "observation" is weighted so that this...
...correctly produces this:
In this example there are four devices tracked by Bermuda:
In addition there are data from other sensors:
For each of these sensors, the Bayesian integration needs an "observation", true or false, with an estimate of its likelihood. So for the living room:
Fortunately you don't have to work all these probabilities out. There is an interactive spreadsheet to help.
Bayesian Tester
When estimating times for this spreadsheet it is very important to use real data. Don't guess. Use HA history to check.
Useful templates
Not my strong point - these can certainly be improved on.
With a Bayesian sensor binary_sensor.probably_in_living_room...
To extract a probability (expressed as a percentage for ease of reading):
To extract the highest probability from several rooms...
To extract the name of the most likely room...
Beta Was this translation helpful? Give feedback.
All reactions