Quantile filter (#1715)

Co-authored-by: pvranik <petr.vranik@mgm-tp.com>
Co-authored-by: Oxan van Leeuwen <oxan@oxanvanleeuwen.nl>
This commit is contained in:
Petr Vraník 2021-12-14 19:43:48 +01:00 committed by GitHub
parent e7709d28ae
commit 6a50b8d63a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -129,6 +129,11 @@ Filters are processed in the order they are defined in your configuration.
window_size: 5
send_every: 5
send_first_at: 1
- quantile:
window_size: 5
send_every: 5
send_first_at: 1
quantile: .9
- sliding_window_moving_average:
window_size: 15
send_every: 15
@ -232,6 +237,41 @@ degree with a least squares solver.
filters:
- filter_out: 85.0
``quantile``
************
A `simple moving quantile <https://en.wikipedia.org/wiki/Quantile>`__
over the last few values. This can be used to filter outliers from the received sensor data. A large
window size will make the filter slow to react to input changes.
.. code-block:: yaml
# Example configuration entry
- platform: wifi_signal
# ...
filters:
- quantile:
window_size: 7
send_every: 4
send_first_at: 3
quantile: .9
Configuration variables:
- **window_size** (*Optional*, int): The number of values over which to calculate the quantile
when pushing out a value.
Defaults to ``5``.
- **send_every** (*Optional*, int): How often a sensor value should be pushed out. For
example, in above configuration the quantile is calculated after every 4th
received sensor value, over the last 7 received values.
Defaults to ``5``.
- **send_first_at** (*Optional*, int): By default, the very first raw value on boot is immediately
published. With this parameter you can specify when the very first value is to be sent.
Must be smaller than or equal to ``send_every``
Defaults to ``1``.
- **quantile** (*Optional*, float): value from 0 to 1 to determine which quantile to pick.
Defaults to ``.9``.
``median``
**********