Skip to content

A Clojure(Script) library for on-line accumulation of rank-based statistics using the t-digest

License

Notifications You must be signed in to change notification settings

henrygarner/t-digest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

t-digest

A Clojure(Script) library for on-line accumulation of rank-based statistics using the t-digest.

Documentation

You can view the documentation here.

Installation

Add the following dependency:

[t-digest "0.1.0"]

Usage

The histogram maintains an approximation of the values which have been inserted into it. At any point you can query the histogram for statistics about values accumulated so far, such as the median or the IQR:

(require '[t-digest.core :as t])

(def histogram
  (-> (t/create)
      (t/insert 5)
      (t/insert 2)
      (t/insert 1)
      (t/insert 4)
      (t/insert 3)))

(t/median histogram) ;;=> 3.0
(t/iqr histogram) ;; => 2.0

The trade-off between accuracy and size is controlled by a single compression parameter. This can be passed when the histogram is created:

(t/create {:compression 100})

The default value is 100. 1000 would be very large. See the t-digest paper for more information.

License

Copyright © 2016 Henry Garner

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

About

A Clojure(Script) library for on-line accumulation of rank-based statistics using the t-digest

Resources

License

Stars

Watchers

Forks

Packages

No packages published