TDIGEST.CDF
Syntax
TDIGEST.CDF key value [value ...]
- Available in:
- Redis Stack / Bloom 2.4.0
- Time complexity:
- O(N) where N is the number of values specified.
对于每个输入值,返回一个估计的分数(浮点数),该分数表示(小于给定值的观测值数量 + 等于给定值的观测值数量的一半)。
可以在一次调用中检索多个分数。
必需的参数
key
is key name for an existing t-digest sketch.
value
is value for which the CDF (Cumulative Distribution Function) should be retrieved.
返回值
Array reply - 该命令返回一个浮点数数组,数组中包含 fraction_1, fraction_2, ..., fraction_N。
如果草图为空,所有值都是'nan'。
示例
redis> TDIGEST.CREATE t COMPRESSION 1000
OK
redis> TDIGEST.ADD t 1 2 2 3 3 3 4 4 4 4 5 5 5 5 5
OK
redis> TDIGEST.CDF t 0 1 2 3 4 5 6
1) "0"
2) "0.033333333333333333"
3) "0.13333333333333333"
4) "0.29999999999999999"
5) "0.53333333333333333"
6) "0.83333333333333337"
7) "1"