Mini stats toolkit for Clojure/Script. EXPERIMENTAL, everything < v1.0 still very likely to break without notice!
Design note: There's a huge amount of nuanced behaviour that one might like to control with a numerics/stats library, especially re: performance and efficiency.
Rather than try to cater to a wide range of use cases (which would significantly bloat both the API and implementation), Tukey's focus is on simplicity, ease-of-use, pedagogy, and Clj/s cross-platform compatibility.
Performance is a secondary objective. Customizability a tertiary one.
Tukey will generally err on the side of common presumptions, and will generally focus only on the most common needs.
For very fine control or performance optimization, specialized libraries often exist. Otherwise the relevant Tukey code can always serve as an example to be extracted and customized.
One noteable example of this philosophy: Tukey's API and internals tend to use only standard fixed-precision doubles. Exceptions to this will be clearly noted.
Mini stats toolkit for Clojure/Script. EXPERIMENTAL, everything < v1.0 still very likely to break without notice! Design note: There's a huge amount of nuanced behaviour that one might like to control with a numerics/stats library, especially re: performance and efficiency. Rather than try to cater to a wide range of use cases (which would significantly bloat both the API and implementation), Tukey's focus is on simplicity, ease-of-use, pedagogy, and Clj/s cross-platform compatibility. Performance is a secondary objective. Customizability a tertiary one. Tukey will generally err on the side of common presumptions, and will generally focus only on the most common needs. For very fine control or performance optimization, specialized libraries often exist. Otherwise the relevant Tukey code can always serve as an example to be extracted and customized. One noteable example of this philosophy: Tukey's API and internals tend to use only standard fixed-precision doubles. Exceptions to this will be clearly noted.
(summary-stats nums)
Given a coll of numbers, returns a new mergeable ?SummaryStats with: (deref ss) => {:keys [n min max p25 ... p99 mean var mad]}
See also summary-stats-merge
.
Given a coll of numbers, returns a new mergeable ?SummaryStats with: (deref ss) => {:keys [n min max p25 ... p99 mean var mad]} See also `summary-stats-merge`.
(summary-stats-buffered)
(summary-stats-buffered {:keys [buffer-size buffer-init sstats-init merge-cb]
:or {buffer-size 100000.0}
:as opts})
Returns a new stateful SummaryStatsBuffered with: (ssb <num>) => Adds given number to internal buffer. (deref ssb) => Flushes buffer if necessary, and returns a mergeable ?SummaryStats. Deref again to get a map of summary stats for all numbers ever added to ssb: {:keys [n min max p25 ... p99 mean var mad]}.
Useful for summarizing a (possibly infinite) stream of numbers.
Options: :buffer-size - The maximum number of numbers that may be buffered before next (ssb <num>) call will block to flush buffer and merge with any existing summary stats.
Larger buffers mean better performance and more
accurate stats, at the cost of more memory use
while buffering.
:buffer-init - Initial buffer content, useful for persistent ssb. :sstats-init - Initial summary stats, useful for persistent ssb.
Returns a new stateful SummaryStatsBuffered with: (ssb <num>) => Adds given number to internal buffer. (deref ssb) => Flushes buffer if necessary, and returns a mergeable ?SummaryStats. Deref again to get a map of summary stats for all numbers ever added to ssb: {:keys [n min max p25 ... p99 mean var mad]}. Useful for summarizing a (possibly infinite) stream of numbers. Options: :buffer-size - The maximum number of numbers that may be buffered before next (ssb <num>) call will block to flush buffer and merge with any existing summary stats. Larger buffers mean better performance and more accurate stats, at the cost of more memory use while buffering. :buffer-init - Initial buffer content, useful for persistent ssb. :sstats-init - Initial summary stats, useful for persistent ssb.
(summary-stats-buffered? x)
Returns true iff given a SummaryStatsBuffered argument.
Returns true iff given a SummaryStatsBuffered argument.
(summary-stats-merge ss1)
(summary-stats-merge ss1 ss2)
Given one or more SummaryStats, returns a new ?SummaryStats with: (summary-stats-merge (summary-stats nums1) (summary-stats nums2))
an approximatation of (summary-stats (merge nums1 nums2))
Useful when you want summary stats for a large coll of numbers for which it would be infeasible/expensive to keep all numbers for accurate merging.
Given one or more SummaryStats, returns a new ?SummaryStats with: (summary-stats-merge (summary-stats nums1) (summary-stats nums2)) an approximatation of (summary-stats (merge nums1 nums2)) Useful when you want summary stats for a large coll of numbers for which it would be infeasible/expensive to keep all numbers for accurate merging.
(summary-stats? x)
Returns true iff given a SummaryStats argument.
Returns true iff given a SummaryStats argument.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close