Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/influxdata/tdigest
An implementation of Ted Dunning's t-digest in Go.
https://github.com/influxdata/tdigest
cdf estimate go percentile quantile tdigest
Last synced: 6 days ago
JSON representation
An implementation of Ted Dunning's t-digest in Go.
- Host: GitHub
- URL: https://github.com/influxdata/tdigest
- Owner: influxdata
- License: apache-2.0
- Created: 2018-02-05T19:26:13.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-04-22T20:19:41.000Z (over 1 year ago)
- Last Synced: 2024-12-29T16:07:38.841Z (13 days ago)
- Topics: cdf, estimate, go, percentile, quantile, tdigest
- Language: Go
- Homepage:
- Size: 43.9 KB
- Stars: 140
- Watchers: 45
- Forks: 24
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-golang-repositories - tdigest - digest in Go. (Repositories)
README
# tdigest
This is an implementation of Ted Dunning's [t-digest](https://github.com/tdunning/t-digest/) in Go.
The implementation is based off [Derrick Burns' C++ implementation](https://github.com/derrickburns/tdigest).
## Example
```go
package mainimport (
"log""github.com/influxdata/tdigest"
)func main() {
td := tdigest.NewWithCompression(1000)
for _, x := range []float64{1, 2, 3, 4, 5, 5, 4, 3, 2, 1} {
td.Add(x, 1)
}// Compute Quantiles
log.Println("50th", td.Quantile(0.5))
log.Println("75th", td.Quantile(0.75))
log.Println("90th", td.Quantile(0.9))
log.Println("99th", td.Quantile(0.99))// Compute CDFs
log.Println("CDF(1) = ", td.CDF(1))
log.Println("CDF(2) = ", td.CDF(2))
log.Println("CDF(3) = ", td.CDF(3))
log.Println("CDF(4) = ", td.CDF(4))
log.Println("CDF(5) = ", td.CDF(5))
}
```