TDIGEST.TRIMMED_MEAN
TDIGEST.TRIMMED_MEAN key low_cut_quantile high_cut_quantile
- Available in:
- Redis Open Source / Bloom 2.4.0
- Time complexity:
- O(N) where N is the number of centroids
- ACL categories:
-
@tdigest,@read, - Compatibility:
- Redis Software and Redis Cloud compatibility
Returns an estimation of the mean value from the sketch, excluding observation values outside the low and high cutoff quantiles.
Required arguments
key
is the key name for an existing t-digest sketch.
low_cut_quantile
a floating-point value in the range [0..1]. It must be lower than high_cut_quantile.
When equal to 0, no low cut.
When greater than 0, exclude observation values lower than this quantile.
high_cut_quantile
a floating-point value in the range [0..1]. It must be higher than low_cut_quantile.
When less than 1, exclude observation values greater than or equal to this quantile.
When equal to 1, no high cut.
Examples
redis> TDIGEST.CREATE t COMPRESSION 1000
OK
redis> TDIGEST.ADD t 1 2 3 4 5 6 7 8 9 10
OK
redis> TDIGEST.TRIMMED_MEAN t 0.1 0.6
"4"
redis> TDIGEST.TRIMMED_MEAN t 0.3 0.9
"6.5"
redis> TDIGEST.TRIMMED_MEAN t 0 1
"5.5"Redis Software and Redis Cloud compatibility
| Redis Enterprise |
Redis Cloud |
Notes |
|---|---|---|
| ✅ Supported |
✅ Flexible & Annual ✅ Free & Fixed |
Return information
One of the following:
- Bulk string reply as a floating-point estimation of the mean value.
nanif the sketch is empty.- Simple error reply in these cases: the given key does not exist or is of an incorrect type, quantiles out of range [0..1], or incorrect number of arguments.