SummaryStats stuff. Private ns, implementation detail.
SummaryStats stuff. Private ns, implementation detail.
Private streams API
Private streams API
(stream-add _ n)
(stream-clear _)
(stream-deref _)
(stream-deref _ flush-buffer?)
(stream-flush _)
(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 ?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. Used by the Tufte profiling library, and the Carmine Redis library.
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.
: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 ?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. Used by the Tufte profiling library, and the Carmine Redis library. 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. :buffer-init - Initial buffer content, useful for persistent ssb. :sstats-init - Initial summary stats, useful for persistent ssb.
(summary-stats-buffered-fast buffer-size merge-cb)
Returns fastest possible SummaryStatsBuffered for Tufte, etc.
Returns fastest possible SummaryStatsBuffered for Tufte, etc.
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close