-
-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bayesian Config Flow #35705
base: next
Are you sure you want to change the base?
Bayesian Config Flow #35705
Conversation
✅ Deploy Preview for home-assistant-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Warning Rate limit exceeded@HarvsG has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 23 minutes and 30 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📝 Walkthrough📝 Walkthrough📝 WalkthroughWalkthroughThe documentation for the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant BayesianSensor
User->>BayesianSensor: Configure sensor with parameters
BayesianSensor-->>User: Acknowledge configuration
User->>BayesianSensor: Provide observed sensor states
BayesianSensor->>BayesianSensor: Calculate state using Bayes' rule
BayesianSensor-->>User: Return current state based on probability threshold
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (5)
source/_integrations/bayesian.markdown (5)
26-26
: Consider enhancing the UI vs YAML format explanationTo prevent potential user confusion, consider expanding this line to be more explicit about the format differences:
-Both UI and YAML setup is supported, importantly YAML uses probabilities of `0` to `1` whereas UI uses percentages. +Both UI and YAML setup is supported. Important note on probability formats: +- YAML configuration: Use decimal values between `0` and `1` (e.g., `0.5` for 50%) +- UI configuration: Use percentage values between `0` and `100` (e.g., `50` for 50%)
61-62
: Minor improvement in prior descriptionTo improve clarity and conciseness:
- The baseline probability of the event (0 to 1). At any point in time - (ignoring all external influences) how likely is this event to be occurring? + The baseline probability of the event (0 to 1). At any time + (ignoring all external influences) how likely is this event to be occurring?🧰 Tools
🪛 LanguageTool
[style] ~61-~61: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...(MOMENT_IN_TIME)
69-69
: Add comma for better readabilityAdd a comma after the conditional clause:
- Note: If the threshold is higher than the `prior` then the default state will be `off` + Note: If the threshold is higher than the `prior`, then the default state will be `off`🧰 Tools
🪛 LanguageTool
[typographical] ~69-~69: Consider adding a comma.
Context: ...the threshold is higher than theprior
then the default state will beoff
requi...(IF_THEN_COMMA)
130-130
: Fix hyphenation and consider adding validation guidance
- Fix the hyphenation:
-If your Bayesian sensor ends up triggering `on` too easily, re-check that the probabilities set and estimated make sense, then consider increasing `probability_threshold:` and vice-versa. +If your Bayesian sensor ends up triggering `on` too easily, re-check that the probabilities set and estimated make sense, then consider increasing `probability_threshold:` and vice versa.
- Consider adding a note about validating probabilities:
+7. Validate your probabilities: For each observation, ensure that `prob_given_true` is significantly different from `prob_given_false` to make the observation meaningful. If they're too close, the observation might not contribute meaningfully to the final probability.
🧰 Tools
🪛 LanguageTool
[grammar] ~130-~130: The expression “vice versa” is spelled without hyphens.
Context: ...increasingprobability_threshold:
and vice-versa. ## Full examples These are a number ...(VICE_VERSA)
224-224
: Clarify range boundary behaviorThe explanation about range boundaries could be clearer:
-When more than one range is specified for the same entity, if a value falls on `below`, it will be included with the range that lists it in `below`. `below` then means "below or equal to". This is not true when only a single range is specified, where both `above` and `below` do not include "equal to". +Range boundary behavior differs based on configuration: +- Multiple ranges for same entity: + - `below: X` means "less than or equal to X" + - A value exactly equal to X belongs to the range that specifies it in `below` +- Single range: + - Both `above` and `below` are exclusive (not including the boundary values)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
source/_integrations/bayesian.markdown
(4 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/bayesian.markdown
[style] ~61-~61: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...
(MOMENT_IN_TIME)
[typographical] ~69-~69: Consider adding a comma.
Context: ...the threshold is higher than the prior
then the default state will be off
requi...
(IF_THEN_COMMA)
[grammar] ~130-~130: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold:
and vice-versa. ## Full examples These are a number ...
(VICE_VERSA)
🔇 Additional comments (1)
source/_integrations/bayesian.markdown (1)
Line range hint 1-224
: Documentation is comprehensive and well-structured
The documentation effectively explains the Bayesian integration, provides clear configuration guidance, and includes practical examples. The theory section is particularly well-written, making complex concepts accessible to users.
🧰 Tools
🪛 LanguageTool
[grammar] ~130-~130: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold:
and vice-versa. ## Full examples These are a number ...
(VICE_VERSA)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Outside diff range and nitpick comments (3)
source/_integrations/bayesian.markdown (3)
32-36
: Fix minor grammatical issues in the theory sectionWhile the content is excellent, there are a few grammatical issues to address:
Apply these corrections:
-However the probability that motion is detected +However, the probability that motion is detected -popular with the cats. However the probability +popular with the cats. However, the probability -(e.g 95%, p = 0.95) +(e.g., 95%, p = 0.95) -(e.g motion detected) +(e.g., motion detected) -(e.g human-occupancy of the room) +(e.g., human-occupancy of the room)🧰 Tools
🪛 LanguageTool
[uncategorized] ~34-~34: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...) if the room is popular with the cats. However the probability that motion is detected...(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)
[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...(E_G)
[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...(E_G)
[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). ## Confi...(E_G)
63-71
: Improve clarity of probability descriptions and fix grammarThe descriptions are good but could be more precise:
Apply these improvements:
-At any point in time +(ignoring all external influences) how likely is this event to be occurring? -if the threshold is higher than the `prior` then +if the threshold is higher than the `prior`, thenAlso, consider adding a note about the relationship between
prior
andprobability_threshold
:
"Settingprobability_threshold
close toprior
will make the sensor more sensitive to changes in observations."🧰 Tools
🪛 LanguageTool
[style] ~63-~63: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...(MOMENT_IN_TIME)
[typographical] ~71-~71: Consider adding a comma.
Context: ...the threshold is higher than theprior
then the default state will beoff
requi...(IF_THEN_COMMA)
123-133
: LGTM! Excellent practical guidance for probability estimationThe guidance is clear and practical, especially the tip about using Home Assistant history to estimate probabilities.
One minor fix needed:
-vice-versa +vice versa🧰 Tools
🪛 LanguageTool
[grammar] ~132-~132: The expression “vice versa” is spelled without hyphens.
Context: ...increasingprobability_threshold:
and vice-versa. ## Full examples These are a number ...(VICE_VERSA)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 Files selected for processing (1)
source/_integrations/bayesian.markdown
(4 hunks)
🧰 Additional context used
🪛 LanguageTool
source/_integrations/bayesian.markdown
[uncategorized] ~34-~34: A comma may be missing after the conjunctive/linking adverb ‘However’.
Context: ...) if the room is popular with the cats. However the probability that motion is detected...
(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)
[uncategorized] ~34-~34: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...that it is occupied by a human is high (e.g 95%, p = 0.95) if our motion sensor is ...
(E_G)
[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ... probability of the sensor observation (e.g motion detected) given the thing you ...
(E_G)
[uncategorized] ~36-~36: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...* the thing you are trying to estimate (e.g human-occupancy of the room). ## Confi...
(E_G)
[style] ~63-~63: This phrase is redundant. Consider writing “point” or “time”.
Context: ...obability of the event (0 to 1). At any point in time (ignoring all external influences)...
(MOMENT_IN_TIME)
[typographical] ~71-~71: Consider adding a comma.
Context: ...the threshold is higher than the prior
then the default state will be off
requi...
(IF_THEN_COMMA)
[grammar] ~132-~132: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold:
and vice-versa. ## Full examples These are a number ...
(VICE_VERSA)
🔇 Additional comments (3)
source/_integrations/bayesian.markdown (3)
22-26
: LGTM! Clear and practical introduction
The introduction effectively explains what a Bayesian sensor is and provides practical use cases that users can relate to.
226-226
: LGTM! Clear explanation of range behavior
The explanation of how ranges work with multiple states is precise and helpful for users.
Line range hint 22-226
: Overall excellent documentation improvements
The documentation is now more comprehensive, clearer, and more practical. Key strengths:
- Clear explanation of the theory with relatable examples
- Practical guidance for estimating probabilities
- Well-documented examples with realistic scenarios
- Thorough explanation of multiple state handling
The changes align perfectly with the PR objective of improving the documentation for Bayesian features.
🧰 Tools
🪛 LanguageTool
[grammar] ~132-~132: The expression “vice versa” is spelled without hyphens.
Context: ...increasing probability_threshold:
and vice-versa. ## Full examples These are a number ...
(VICE_VERSA)
Proposed change
Type of change
current
branch).current
branch).next
branch).next
branch).Additional information
Checklist
I made a change to the existing documentation and used thecurrent
branch.next
branch.Summary by CodeRabbit