hammerlab/math-utils

Name: math-utils

Owner: Hammer Lab

Description: Math and statistics utilities

Created: 2017-08-04 18:45:19.0

Updated: 2017-11-30 18:27:47.0

Pushed: 2018-01-15 00:25:33.0

Homepage: null

Size: 60

Language: Scala

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

math-utils

Build Status Coverage Status Maven Central

Math, stats, and miscellaneous type utilities

math

Miscellaneous numeric utilities

rt hammerlab.math._
min

Overloads of math.min that take an Int and a Long and return an `Int

HypergeometricDistribution

Modeled after commons-math3 implementation, but taking Long parameters

div

Up-rounding integer-division:

20, 10)  // 2
21L, 10)  // 3
Steps
etricSteps(100, 15)
ortedSet(0, 1, 2, 3, 4, 5, 6, 8, 11, 17, 24, 34, 49, 70, 100)

dNumbers(100)
ortedSet(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100)
stats
Descriptive Statistics

org.hammerlab.stats.Stats has APIs for ingesting numeric elements and outputting nicely formatted statistics about them; modeled after Apache commons-math DescriptiveStatistics.

As a bonus, it can ingest numbers in histogram-style / run-length-encoded format, supporting Long values as well for computations involving element counts from RDDs:

a> import org.hammerlab.stats.Stats
a> :paste
s.fromHist(
List[(Int, Long)](
    1 ?  10000000000L,
    2 ?   1000000000,
    1 ?          100,
    2 ?   1000000000
)


: org.hammerlab.stats.Stats[Int,Long] =
    12000000100,    mean:   1.2,    stddev: 0.4,    mad:    0
s:  1×10000000000, 2×1000000000, 1×100, 2×1000000000
ed: 1×10000000100, 2×2000000000
    1
    1
    1
    1
    1
    1
    1
    1
    2
    2
    2
:   2
0:  2
HyperGeometric Distribution

org.hammerlab.stats.HypergeometricDistribution is an implementation of a hypergeometric distribution, modeled after org.apache.commons.math3.distribution.HypergeometricDistribution, but supporting 8-byte Long parameters.

types

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.