TDIGEST.CDF
Syntax
TDIGEST.CDF key value [value ...]
- Available in:
- Redis Open Source / Bloom 2.4.0
- Time complexity:
- O(N) where N is the number of values specified.
- ACL categories:
-
@tdigest
,@read
,
Returns, for each input value, an estimation of the floating-point fraction of (observations smaller than the given value + half the observations equal to the given value). Multiple fractions can be retrieved in a single call.
Required arguments
key
is the key name for an existing t-digest sketch.
value
are the values for which the CDF (Cumulative Distribution Function) should be retrieved.
Examples
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"
Return information
One of the following:
- Array of bulk string replies as floating-points, populated with fraction_1, fraction_2, ..., fraction_N.
All values are
nan
if the given sketch is empty. - Simple error reply in these cases: the given key does not exist or is of an incorrect type, value parsing errors, or an incorrect number of arguments.