A well tested and comprehensive Golang statistics library package with no dependencies.

Overview

Stats - Golang Statistics Package

A well tested and comprehensive Golang statistics library / package / module with no dependencies.

If you have any suggestions, problems or bug reports please create an issue and I'll do my best to accommodate you. In addition simply starring the repo would show your support for the project and be very much appreciated!

Installation

go get github.com/montanaflynn/stats

Example Usage

All the functions can be seen in examples/main.go but here's a little taste:

// start with some source data to use
data := []float64{1.0, 2.1, 3.2, 4.823, 4.1, 5.8}

// you could also use different types like this
// data := stats.LoadRawData([]int{1, 2, 3, 4, 5})
// data := stats.LoadRawData([]interface{}{1.1, "2", 3})
// etc...

median, _ := stats.Median(data)
fmt.Println(median) // 3.65

roundedMedian, _ := stats.Round(median, 0)
fmt.Println(roundedMedian) // 4

Documentation

The entire API documentation is available on GoDoc.org or pkg.go.dev.

You can also view docs offline with the following commands:

# Command line
godoc .              # show all exported apis
godoc . Median       # show a single function
godoc -ex . Round    # show function with example
godoc . Float64Data  # show the type and methods

# Local website
godoc -http=:4444    # start the godoc server on port 4444
open http://localhost:4444/pkg/github.com/montanaflynn/stats/

The exported API is as follows:

var (
    ErrEmptyInput = statsError{"Input must not be empty."}
    ErrNaN        = statsError{"Not a number."}
    ErrNegative   = statsError{"Must not contain negative values."}
    ErrZero       = statsError{"Must not contain zero values."}
    ErrBounds     = statsError{"Input is outside of range."}
    ErrSize       = statsError{"Must be the same length."}
    ErrInfValue   = statsError{"Value is infinite."}
    ErrYCoord     = statsError{"Y Value must be greater than zero."}
)

func Round(input float64, places int) (rounded float64, err error) {}

type Float64Data []float64

func LoadRawData(raw interface{}) (f Float64Data) {}

func AutoCorrelation(data Float64Data, lags int) (float64, error) {}
func ChebyshevDistance(dataPointX, dataPointY Float64Data) (distance float64, err error) {}
func Correlation(data1, data2 Float64Data) (float64, error) {}
func Covariance(data1, data2 Float64Data) (float64, error) {}
func CovariancePopulation(data1, data2 Float64Data) (float64, error) {}
func CumulativeSum(input Float64Data) ([]float64, error) {}
func Entropy(input Float64Data) (float64, error) {}
func EuclideanDistance(dataPointX, dataPointY Float64Data) (distance float64, err error) {}
func GeometricMean(input Float64Data) (float64, error) {}
func HarmonicMean(input Float64Data) (float64, error) {}
func InterQuartileRange(input Float64Data) (float64, error) {}
func ManhattanDistance(dataPointX, dataPointY Float64Data) (distance float64, err error) {}
func Max(input Float64Data) (max float64, err error) {}
func Mean(input Float64Data) (float64, error) {}
func Median(input Float64Data) (median float64, err error) {}
func MedianAbsoluteDeviation(input Float64Data) (mad float64, err error) {}
func MedianAbsoluteDeviationPopulation(input Float64Data) (mad float64, err error) {}
func Midhinge(input Float64Data) (float64, error) {}
func Min(input Float64Data) (min float64, err error) {}
func MinkowskiDistance(dataPointX, dataPointY Float64Data, lambda float64) (distance float64, err error) {}
func Mode(input Float64Data) (mode []float64, err error) {}
func NormBoxMullerRvs(loc float64, scale float64, size int) []float64 {}
func NormCdf(x float64, loc float64, scale float64) float64 {}
func NormEntropy(loc float64, scale float64) float64 {}
func NormFit(data []float64) [2]float64{}
func NormInterval(alpha float64, loc float64,  scale float64 ) [2]float64 {}
func NormIsf(p float64, loc float64, scale float64) (x float64) {}
func NormLogCdf(x float64, loc float64, scale float64) float64 {}
func NormLogPdf(x float64, loc float64, scale float64) float64 {}
func NormLogSf(x float64, loc float64, scale float64) float64 {}
func NormMean(loc float64, scale float64) float64 {}
func NormMedian(loc float64, scale float64) float64 {}
func NormMoment(n int, loc float64, scale float64) float64 {}
func NormPdf(x float64, loc float64, scale float64) float64 {}
func NormPpf(p float64, loc float64, scale float64) (x float64) {}
func NormPpfRvs(loc float64, scale float64, size int) []float64 {}
func NormSf(x float64, loc float64, scale float64) float64 {}
func NormStats(loc float64, scale float64, moments string) []float64 {}
func NormStd(loc float64, scale float64) float64 {}
func NormVar(loc float64, scale float64) float64 {}
func Pearson(data1, data2 Float64Data) (float64, error) {}
func Percentile(input Float64Data, percent float64) (percentile float64, err error) {}
func PercentileNearestRank(input Float64Data, percent float64) (percentile float64, err error) {}
func PopulationVariance(input Float64Data) (pvar float64, err error) {}
func Sample(input Float64Data, takenum int, replacement bool) ([]float64, error) {}
func SampleVariance(input Float64Data) (svar float64, err error) {}
func Sigmoid(input Float64Data) ([]float64, error) {}
func SoftMax(input Float64Data) ([]float64, error) {}
func StableSample(input Float64Data, takenum int) ([]float64, error) {}
func StandardDeviation(input Float64Data) (sdev float64, err error) {}
func StandardDeviationPopulation(input Float64Data) (sdev float64, err error) {}
func StandardDeviationSample(input Float64Data) (sdev float64, err error) {}
func StdDevP(input Float64Data) (sdev float64, err error) {}
func StdDevS(input Float64Data) (sdev float64, err error) {}
func Sum(input Float64Data) (sum float64, err error) {}
func Trimean(input Float64Data) (float64, error) {}
func VarP(input Float64Data) (sdev float64, err error) {}
func VarS(input Float64Data) (sdev float64, err error) {}
func Variance(input Float64Data) (sdev float64, err error) {}

type Coordinate struct {
    X, Y float64
}

type Series []Coordinate

func ExponentialRegression(s Series) (regressions Series, err error) {}
func LinearRegression(s Series) (regressions Series, err error) {}
func LogarithmicRegression(s Series) (regressions Series, err error) {}

type Outliers struct {
    Mild    Float64Data
    Extreme Float64Data
}

type Quartiles struct {
    Q1 float64
    Q2 float64
    Q3 float64
}

func Quartile(input Float64Data) (Quartiles, error) {}
func QuartileOutliers(input Float64Data) (Outliers, error) {}

Contributing

Pull request are always welcome no matter how big or small. I've included a Makefile that has a lot of helper targets for common actions such as linting, testing, code coverage reporting and more.

  1. Fork the repo and clone your fork
  2. Create new branch (git checkout -b some-thing)
  3. Make the desired changes
  4. Ensure tests pass (go test -cover or make test)
  5. Run lint and fix problems (go vet . or make lint)
  6. Commit changes (git commit -am 'Did something')
  7. Push branch (git push origin some-thing)
  8. Submit pull request

To make things as seamless as possible please also consider the following steps:

  • Update examples/main.go with a simple example of the new feature
  • Update README.md documentation section with any new exported API
  • Keep 100% code coverage (you can check with make coverage)
  • Squash commits into single units of work with git rebase -i new-feature

Releasing

To release a new version we should update the CHANGELOG.md and DOCUMENTATION.md.

First install the tools used to generate the markdown files:

go get github.com/davecheney/godoc2md
go get github.com/golangci/golangci-lint/cmd/golangci-lint

Then you can run these make directives:

# Generate DOCUMENTATION.md
make docs

Then we can create a CHANGELOG.md a new git tag and a github release:

make release TAG=v0.x.x

MIT License

Copyright (c) 2014-2021 Montana Flynn (https://montanaflynn.com)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORpublicS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Issues
  • Using an interface to support []float64 and []int

    Using an interface to support []float64 and []int

    I have a feeling it might be possible to use an interface to support both []float64 and []int data. However I've not designed Public interfaces or worked around the lack of generics myself so I'll either have to do some research and hacking or have the excellent community of Gophers help in this area or tell me my attempts will be futile. Either way, any feedback is appreciated!

    help wanted 
    opened by montanaflynn 9
  • undefined: stats.MedianAbsoluteDeviationPopulation

    undefined: stats.MedianAbsoluteDeviationPopulation

    Hi,

    I am not able to use the MedianAbsoluteDeviationPopulation function,

    If I use "go doc", I do not see all functions: $ go doc stats

    package stats // import "github.com/zizmos/ego/vendor/github.com/montanaflynn/stats"

    func Correlation(data1, data2 Float64Data) (float64, error) func Covariance(data1, data2 Float64Data) (float64, error) func GeometricMean(input Float64Data) (float64, error) func HarmonicMean(input Float64Data) (float64, error) func InterQuartileRange(input Float64Data) (float64, error) func Max(input Float64Data) (max float64, err error) func Mean(input Float64Data) (float64, error) func Median(input Float64Data) (median float64, err error) func Midhinge(input Float64Data) (float64, error) func Min(input Float64Data) (min float64, err error) func Mode(input Float64Data) (mode []float64, err error) func Percentile(input Float64Data, percent float64) (percentile float64, err error) func PercentileNearestRank(input Float64Data, percent float64) (percentile float64, err error) func PopulationVariance(input Float64Data) (pvar float64, err error) func Round(input float64, places int) (rounded float64, err error) func Sample(input Float64Data, takenum int, replacement bool) ([]float64, error) func SampleVariance(input Float64Data) (svar float64, err error) func StandardDeviation(input Float64Data) (sdev float64, err error) func StandardDeviationPopulation(input Float64Data) (sdev float64, err error) func StandardDeviationSample(input Float64Data) (sdev float64, err error) func StdDevP(input Float64Data) (sdev float64, err error) func StdDevS(input Float64Data) (sdev float64, err error) func Sum(input Float64Data) (sum float64, err error) func Trimean(input Float64Data) (float64, error) func VarP(input Float64Data) (sdev float64, err error) func VarS(input Float64Data) (sdev float64, err error) func Variance(input Float64Data) (sdev float64, err error) type Coordinate struct{ ... } func ExpReg(s []Coordinate) (regressions []Coordinate, err error) func LinReg(s []Coordinate) (regressions []Coordinate, err error) func LogReg(s []Coordinate) (regressions []Coordinate, err error) type Float64Data []float64 type Outliers struct{ ... } func QuartileOutliers(input Float64Data) (Outliers, error) type Quartiles struct{ ... } func Quartile(input Float64Data) (Quartiles, error) type Series []Coordinate func ExponentialRegression(s Series) (regressions Series, err error) func LinearRegression(s Series) (regressions Series, err error) func LogarithmicRegression(s Series) (regressions Series, err error)

    However, MedianAbsoluteDeviationPopulation function is a public function in the implementation. $go version go version go1.10.2 darwin/amd64

    $dep status .... .... github.com/montanaflynn/stats ^0.2.0 0.2.0 eeaced0 0.2.0 1
    ... ...

    opened by yildirim 7
  • Edge cases with Percentiles

    Edge cases with Percentiles

    I believe there are some errors with the Percentiles() edge cases.

    Passing 0 as the percent will cause an error as will a small set of data and a small percentage (such that the c[i-1] is out of bounds because i = 0.

    I'm not sure the best approach to fix this, as picking which index is quite critical for the correct result, but I think this might work?

    index := (percent / 100) * float64(len(c) - 1)
    

    And then use c[i] and c[i+1] later on. Using c[i+1] would be dangerous with input.Len() == 1 and maybe in the case of 99.9 percent and few values?

    opened by RKelln 7
  • Code changes for Manhattan, Euclidean and Minkowski distance calculation

    Code changes for Manhattan, Euclidean and Minkowski distance calculation

    These changes would introduce functions to calculate Manhattan, Euclidean and Minkowski distance. Plus, I have done a bit of code reformatting in the old code. Please take a look. -Shivendra

    opened by MishraShivendra 5
  • NaN when running exponential regression

    NaN when running exponential regression

    [{0 2.5} {1 5} {4 25} {6 5} {8 5} {11 15} {12 2.5} {14 25} {15 0} {16 1.6666666666666667} {17 40} {20 5} {21 15} {22 20} {23 16.666666666666668} {24 13.333333333333334} {25 50} {26 18} {27 75} {28 21} {29 0} {30 5} {31 37.5} {32 5} {34 40} {36 5} {37 39}]
    

    When running exponential regression with the series above. The result is:

    [{0 NaN} {1 NaN} {4 NaN} {6 NaN} {8 NaN} {11 NaN} {12 NaN} {14 NaN} {15 NaN} {16 NaN} {17 NaN} {20 NaN} {21 NaN} {22 NaN} {23 NaN} {24 NaN} {25 NaN} {26 NaN} {27 NaN} {28 NaN} {29 NaN} {30 NaN} {31 NaN} {32 NaN} {34 NaN} {36 NaN} {37 NaN}]
    

    Is this desired? If so could you maybe elaborate on why this is happens.

    opened by barthr 5
  • Adding ability to load quickly convert mixed-type data to Float64Data

    Adding ability to load quickly convert mixed-type data to Float64Data

    Simple example based off one provided on repository page.

    // start with the some source data to use
    raw := []interface{}{1.0, "2", 3.0, 4, "4.0", 5}
    
    // clean up raw data by converting to floats
    var data = stats.LoadRawData(raw)
    
    median, _ := stats.Median(data)
    fmt.Println(median) // 3.5
    
    roundedMedian, _ := stats.Round(median, 0)
    fmt.Println(roundedMedian) // 4
    
    opened by brydavis 5
  • panic: sync: negative WaitGroup counter in dbscan.go

    panic: sync: negative WaitGroup counter in dbscan.go

    We use your library for our open-source photo app, in particular the DBSCAN implementation. Thanks for providing it!

    While it works great for me, a developer reported issues with panics in dbscan.go, line 251. Seems w.Done() may be called too often, probably depending on input data. Couldn't reproduce it with my local samples.

    Our related code and GitHub issue:

    • https://github.com/photoprism/photoprism/blob/develop/internal/photoprism/faces.go#L225
    • https://github.com/photoprism/photoprism/issues/1478

    Trace:

    panic: sync: negative WaitGroup counter
    
    goroutine 3326 [running]:
    sync.(*WaitGroup).Add(0xc004761070, 0xffffffffffffffff)
             /usr/local/go/src/sync/waitgroup.go:74 +0x147
     sync.(*WaitGroup).Done(...)
             /usr/local/go/src/sync/waitgroup.go:99
     github.com/mpraski/clusters.(*dbscanClusterer).nearestWorker(0xc000cce3c0)
            /go/pkg/mod/github.com/mpraski/[email protected]/dbscan.go:251 +0x230
     created by github.com/mpraski/clusters.(*dbscanClusterer).startNearestWorkers
             /go/pkg/mod/github.com/mpraski/[email protected]/dbscan.go:228
    
    opened by lastzero 4
  • support string in LoadRawData()

    support string in LoadRawData()

    Thank you for this great package. I added support for a string and io.Reader in LoadRawData() so it support whitespace separated strings.

    i.e

    stats.LoadRawData("1.1 2 3.0 4 5")
    
    // or
    stats.LoadRawData(os.Stdin)
    
    

    Is this something you would consider implemented in you package? If so, I can create a pull request.

    kk

    opened by kjellkvinge 4
  • [Suggestion] Calculate Quartile from the instance of Float64Data

    [Suggestion] Calculate Quartile from the instance of Float64Data

    Nice package, I am using it right now. And I found an inconsistency while calculating the quartiles. Any reason why we must pass the data/input to calculate Quartile? Why not use the instance. If there is no specific reason, I suggest adding the Quartiles method on the Float64Data's struct without any input, but use the current instance, like we use Mean(), Max(), etc.

    Suggestion:

    func (f Float64Data) Quartiles() (Quartiles, error) {
    	return Quartile(f)
    }
    

    If this is possible, I will make the MR.

    opened by pararang 4
  • A few tests fail in different architectures due to precision errors

    A few tests fail in different architectures due to precision errors

    When running the test suite on s390x and ppc64le architectures, I get the following output:

    go test -compiler gc -ldflags '' github.com/montanaflynn/stats
    --- FAIL: TestCorrelation (0.00s)
    	correlation_test.go:33: Correlation 0.9912407071619304 != 0.9912407071619302
    	correlation_test.go:47: Correlation 0.9912407071619304 != 0.9912407071619302
    --- FAIL: TestOtherDataMethods (0.00s)
    	data_test.go:22: github.com/montanaflynn/stats.(Float64Data).Correlation-fm() => 0.2087547359760545 != 0.20875473597605448
    	data_test.go:22: github.com/montanaflynn/stats.(Float64Data).Pearson-fm() => 0.2087547359760545 != 0.20875473597605448
    	data_test.go:22: github.com/montanaflynn/stats.(Float64Data).Covariance-fm() => 7.381421553571428 != 7.3814215535714265
    	data_test.go:22: github.com/montanaflynn/stats.(Float64Data).CovariancePopulation-fm() => 6.458743859374999 != 6.458743859374998
    --- FAIL: TestLinearRegression (0.00s)
    	regression_test.go:19: [{1 2.380000000000002} {2 3.080000000000001} {3 3.7800000000000002} {4 4.4799999999999995} {5 5.179999999999999}] != 2.3800000000000026
    	regression_test.go:23: [{1 2.380000000000002} {2 3.080000000000001} {3 3.7800000000000002} {4 4.4799999999999995} {5 5.179999999999999}] != 3.0800000000000014
    	regression_test.go:31: [{1 2.380000000000002} {2 3.080000000000001} {3 3.7800000000000002} {4 4.4799999999999995} {5 5.179999999999999}] != 4.479999999999999
    	regression_test.go:35: [{1 2.380000000000002} {2 3.080000000000001} {3 3.7800000000000002} {4 4.4799999999999995} {5 5.179999999999999}] != 5.179999999999998
    --- FAIL: TestLogarithmicRegression (0.00s)
    	regression_test.go:94: [{1 2.152082236381168} {2 3.330555922249221} {3 4.019918836568675} {4 4.509029608117274} {5 4.8884133966836645}] != 2.1520822363811702
    	regression_test.go:98: [{1 2.152082236381168} {2 3.330555922249221} {3 4.019918836568675} {4 4.509029608117274} {5 4.8884133966836645}] != 3.3305559222492214
    	regression_test.go:102: [{1 2.152082236381168} {2 3.330555922249221} {3 4.019918836568675} {4 4.509029608117274} {5 4.8884133966836645}] != 4.019918836568674
    	regression_test.go:106: [{1 2.152082236381168} {2 3.330555922249221} {3 4.019918836568675} {4 4.509029608117274} {5 4.8884133966836645}] != 4.509029608117273
    	regression_test.go:110: [{1 2.152082236381168} {2 3.330555922249221} {3 4.019918836568675} {4 4.509029608117274} {5 4.8884133966836645}] != 4.888413396683663
    FAIL
    FAIL	github.com/montanaflynn/stats	0.003s
    

    I also opened a similar bug report for x/image with a bug that seems to be related to this one https://github.com/golang/go/issues/21460

    In addition, the tests also fail for i686 architectures, with a different output:

    go test -compiler gc -ldflags '' github.com/montanaflynn/stats
    --- FAIL: TestLogarithmicRegression (0.00s)
    	regression_test.go:94: [{1 2.1520822363811654} {2 3.3305559222492205} {3 4.019918836568676} {4 4.509029608117276} {5 4.888413396683665}] != 2.1520822363811702
    	regression_test.go:98: [{1 2.1520822363811654} {2 3.3305559222492205} {3 4.019918836568676} {4 4.509029608117276} {5 4.888413396683665}] != 3.3305559222492214
    	regression_test.go:102: [{1 2.1520822363811654} {2 3.3305559222492205} {3 4.019918836568676} {4 4.509029608117276} {5 4.888413396683665}] != 4.019918836568674
    	regression_test.go:106: [{1 2.1520822363811654} {2 3.3305559222492205} {3 4.019918836568676} {4 4.509029608117276} {5 4.888413396683665}] != 4.509029608117273
    	regression_test.go:110: [{1 2.1520822363811654} {2 3.3305559222492205} {3 4.019918836568676} {4 4.509029608117276} {5 4.888413396683665}] != 4.888413396683663
    FAIL
    FAIL	github.com/montanaflynn/stats	0.005s
    

    Note that this does not seem to be related to the issue mentioned above for x/image.

    opened by athos-ribeiro 4
  • Percentile is not calculated correctly

    Percentile is not calculated correctly

    The percentile funciton does neither the The Nearest Rank method nor The Weighted Percentile method nor the NIST method all defined here: http://en.wikipedia.org/wiki/Percentile

    Which is the prefered method? I was thinking about fixing this myself, which would you prefer?

    opened by placeybordeaux 4
  • Fix percentile computation

    Fix percentile computation

    Hi!

    Unless I'm missing something, the percentile computation was incorrect. For example, 50th percentile was not matching the median in the distribution [1, 2, ..., 10] which is 5.5.

    This pull request modifies the implementation of Percentile and adds more tests.

    opened by marcelosousa 0
  • Avoid GeometricMean overflow by using exp and log

    Avoid GeometricMean overflow by using exp and log

    This PR complicates a formula a bit to avoid overflows.

    Geometric mean of 100 numbers around 1 billion gets us overflow as multiplying them yields infinity. Numeric roots from that still return infinity.

    We can take logarithm of all numbers to avoid most prominent overflows that manifest themselves for just few numbers.

    Add tests: Test with 0 in input failed in previous implementation. Test with more larger values shows the overflow issue.

    opened by petoju 0
  • How to calculate the weighted percentile?

    How to calculate the weighted percentile?

    See: https://en.wikipedia.org/wiki/Percentile#The_weighted_percentile_method

    My current code is as follows. But I don't know how to support weighted percentile?

    func TestPercentile(t *testing.T) {
    	values := []float64{4, 5, 3, 1, 2}
    	percentiles := []float64{}
    	for i := 1; i <= 100; i++ {
    		percentile, err := stats.PercentileNearestRank(values, float64(i))
    		if err != nil {
    			panic(err)
    		}
    		percentiles = append(percentiles, percentile)
    		fmt.Printf("%d%%: %f, ", i, percentile)
    	}
    	println()
    	println()
    
    	for f := 0.0; f <= 5; f += 0.1 {
    		index := sort.SearchFloat64s(percentiles, f + 0.00000001)
    		fmt.Printf("%f: %d%%, ", f, index)
    	}
    	println()
    	println()
    }
    
    opened by hsluoyz 2
  • Adding single-pass descriptive stats for large data sets

    Adding single-pass descriptive stats for large data sets

    Hi, wondered if I could contribute by adding single-pass descriptive stats for people working with large datasets? This will simply return mean, sdev, var, min, max, correlation. All the things you have, but for situations where Float64Data would be too big.

    opened by ghost 1
Releases(v0.6.6)
  • v0.6.6(Apr 26, 2021)

    Add

    • Add support for string and io.Reader in LoadRawData (pr #68)
    • Add latest versions of Go to test against

    Update

    • Update changelog with v0.6.6 changes

    Use

    • Use math.Sqrt in StandardDeviation (PR #64)
    Source code(tar.gz)
    Source code(zip)
  • v0.6.5(Feb 21, 2021)

  • v0.6.4(Jan 13, 2021)

    Fix

    • Fix failing tests due to precision errors on arm64 (#58)

    Update

    • Update changelog with v0.6.4 changes
    • Update examples directory to include a README.md used for synopsis
    • Update go.mod to include go version where modules are enabled by default
    • Update changelog with v0.6.3 changes
    Source code(tar.gz)
    Source code(zip)
  • v0.6.3(Feb 18, 2020)

    Add

    • Add creating and committing changelog to Makefile release directive
    • Add release-notes.txt and .chglog directory to .gitignore

    Update

    • Update exported tests to use import for better example documentation
    • Update documentation using godoc2md
    • Update changelog with v0.6.2 release
    Source code(tar.gz)
    Source code(zip)
  • v0.6.2(Feb 18, 2020)

  • v0.6.1(Feb 18, 2020)

    Add

    • Add StableSample function signature to readme

    Fix

    • Fix linting warnings for normal distribution functions formatting and tests

    Update

    • Update documentation links and rename DOC.md to DOCUMENTATION.md
    • Update README with link to pkg.go.dev reference and release section
    • Update Makefile with new changelog, docs, and release directives
    • Update DOC.md links to GitHub source code
    • Update doc.go comment and add DOC.md package reference file
    • Update changelog using git-chglog
    Source code(tar.gz)
    Source code(zip)
  • v0.6.0(Feb 17, 2020)

    • Add Entropy function (aff88e33df74c3c6ef693c2fbefa10ea5c6f8adc)
    func Entropy(input Float64Data) (float64, error) {}
    
    • Add StableSample function (ce31985b3920588edaffc28439e43c4fa505ecc6)
    func StableSample(input Float64Data, takenum int) ([]float64, error) {}
    
    • Add Normal Distribution Functions (60d707fd1db41538718d32aa9f0ea667a62716c2)
    func NormBoxMullerRvs(loc float64, scale float64, size int) []float64 {}
    func NormCdf(x float64, loc float64, scale float64) float64 {}
    func NormEntropy(loc float64, scale float64) float64 {}
    func NormFit(data []float64) [2]float64{}
    func NormInterval(alpha float64, loc float64,  scale float64 ) [2]float64 {}
    func NormIsf(p float64, loc float64, scale float64) (x float64) {}
    func NormLogCdf(x float64, loc float64, scale float64) float64 {}
    func NormLogPdf(x float64, loc float64, scale float64) float64 {}
    func NormLogSf(x float64, loc float64, scale float64) float64 {}
    func NormMean(loc float64, scale float64) float64 {}
    func NormMedian(loc float64, scale float64) float64 {}
    func NormMoment(n int, loc float64, scale float64) float64 {}
    func NormPdf(x float64, loc float64, scale float64) float64 {}
    func NormPpf(p float64, loc float64, scale float64) (x float64) {}
    func NormPpfRvs(loc float64, scale float64, size int) []float64 {}
    func NormSf(x float64, loc float64, scale float64) float64 {}
    func NormStats(loc float64, scale float64, moments string) []float64 {}
    func NormStd(loc float64, scale float64) float64 {}
    func NormVar(loc float64, scale float64) float64 {}
    
    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(Jan 16, 2019)

    • Add Sigmoid and SoftMax functions (63fbb2597b7a13043b453a4b819945badb8f8926)
    func Sigmoid(input Float64Data) ([]float64, error) {}
    func SoftMax(input Float64Data) ([]float64, error) {}
    
    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Jan 15, 2019)

    • Improve performance https://github.com/montanaflynn/stats/commit/07668e8400fed7e285b3a844b88bda8d565b52a3
    • Add Distance functions
    func ChebyshevDistance(dataPointX, dataPointY []float64) (distance float64, err error) {}
    func EuclideanDistance(dataPointX, dataPointY []float64) (distance float64, err error) {}
    func ManhattanDistance(dataPointX, dataPointY []float64) (distance float64, err error) {}
    func MinkowskiDistance(dataPointX, dataPointY []float64, lambda float64) (distance float64, err error) {}
    
    • Add AutoCorrelation function
    func AutoCorrelation(data Float64Data, lags int) (float64, error) {}
    
    • Add CumulativeSum function
    func CumulativeSum(input Float64Data) ([]float64, error) {}
    
    Source code(tar.gz)
    Source code(zip)
Owner
Montana Flynn
Distributed systems engineer
Montana Flynn
cartconvert is a package providing a set of cartography functions for the Go programming language

cartconvert - a cartography package This is the home of the cartconvert project. You can find it online at http://cartconvert.allowed.org/ Cartconvert

Johann Höchtl 31 Apr 4, 2022
Go package for convex optimization

cvx Package cvx is a Go package for solving convex optimization problems. It is a straightforward translation of parts of the CVXOPT python package fo

Harri Rautila 20 Apr 5, 2022
An arbitrary-precision decimal floating-point arithmetic package for Go

decimal Package decimal implements arbitrary-precision decimal floating-point arithmetic for Go. Rationale How computers represent numbers internally

Denis Bernard 27 Jun 19, 2022
Go library that makes it easy to work with physical types, e.g. distances, velocities and angles.

Units Use at your own risk Note that this library is NOT production ready. If you want to use it anyway, contributions and bug reports are welcome! Br

Sindre Røkenes Myren 20 Feb 24, 2022
Go language bindings for the COIN-OR Linear Programming library

clp Description The clp package provides a Go interface to the COIN-OR Linear Programming (CLP) library, part of the COIN-OR (COmputational INfrastruc

Los Alamos National Laboratory 34 Jun 6, 2022
Go Library [DEPRECATED]

Tideland Go Library Description The Tideland Go Library contains a larger set of useful Google Go packages for different purposes. ATTENTION: The cell

Tideland 194 May 27, 2022
high performance fixed decimal place math library for Go

Summary A fixed place numeric library designed for performance. All numbers have a fixed 7 decimal places, and the maximum permitted value is +- 99999

robert engels 286 Jun 27, 2022
Naive Bayesian Classification for Golang.

Naive Bayesian Classification Perform naive Bayesian classification into an arbitrary number of classes on sets of strings. bayesian also supports ter

Jake Brukhman 735 Jun 30, 2022
Implements a simple floating point arithmetic expression evaluator in Go (golang).

evaler https://github.com/soniah/evaler Package evaler implements a simple floating point arithmetic expression evaluator. Evaler uses Dijkstra's Shun

Sonia Hamilton 49 Jun 4, 2022
Parses the Graphviz DOT language in golang

Parses the Graphviz DOT language and creates an interface, in golang, with which to easily create new and manipulate existing graphs which can be writ

Walter Schulze 484 Jun 25, 2022
Golang RServe client. Use R from Go

Roger Roger is a Go RServe client, allowing the capabilities of R to be used from Go applications. The communication between Go and R is via TCP. It i

Senseye 262 Jun 27, 2022
This is a go implementation of Segmented Sieve and non Segmented sieve to produce prime numbers concurrently.

Prime This is a Go library to produce prime numbers using all available cpu cores. Installation $ go get github.com/kavehmz/prime Usage package main

Kaveh Mousavi Zamani 23 Jan 16, 2022
Sparse matrix formats for linear algebra supporting scientific and machine learning applications

Sparse matrix formats Implementations of selected sparse matrix formats for linear algebra supporting scientific and machine learning applications. Co

James Bowman 131 Jun 27, 2022
A well tested and comprehensive Golang statistics library package with no dependencies.

Stats - Golang Statistics Package A well tested and comprehensive Golang statistics library / package / module with no dependencies. If you have any s

Montana Flynn 2.5k Jun 27, 2022
A well tested and comprehensive Golang statistics library package with no dependencies.

Stats - Golang Statistics Package A well tested and comprehensive Golang statistics library / package / module with no dependencies. If you have any s

Montana Flynn 2.5k Jun 26, 2022
A fast, well-tested and widely used WebSocket implementation for Go.

Gorilla WebSocket Gorilla WebSocket is a Go implementation of the WebSocket protocol. Documentation API Reference Chat example Command example Client

Gorilla Web Toolkit 17.5k Jul 6, 2022
A Golang REST API to handle users and posts for a simple instagram backend. Uses MongoDB as the database. Tested using golang-testing and Postman.

A Golang REST API to handle users and posts for a simple instagram backend. Uses MongoDB as the database. Tested using golang-testing and Postman.

Nitin Narayanan 1 Oct 10, 2021
Lightweight, fast and dependency-free Cron expression parser (due checker) for Golang (tested on v1.13 and above)

adhocore/gronx gronx is Golang cron expression parser ported from adhocore/cron-expr. Zero dependency. Very fast because it bails early in case a segm

Jitendra Adhikari 205 Jul 4, 2022
A Go (golang) package that enhances the standard database/sql package by providing powerful data retrieval methods as well as DB-agnostic query building capabilities.

ozzo-dbx Summary Description Requirements Installation Supported Databases Getting Started Connecting to Database Executing Queries Binding Parameters

Ozzo Framework 551 Jun 3, 2022
CBOR RFC 7049 (Go/Golang) - safe & fast with standard API + toarray & keyasint, CBOR tags, float64/32/16, fuzz tested.

CBOR library in Go fxamacker/cbor is a CBOR encoder & decoder in Go. It has a standard API, CBOR tags, options for duplicate map keys, float64→32→16,

Faye Amacker 458 Jun 29, 2022
Keeps track of Steam Deck Verifications. On first run, it reports all games with their respective Steam Deck Verification status. On subsequent runs, the tool will report newly tested and updated games.

Keeps track of Steam Deck Verifications. On first run, it reports all games with their respective Steam Deck Verification status. On subsequent runs, the tool will report newly tested and updated games.

henning mueller 1 Feb 2, 2022
Golang-WASM provides a simple idiomatic, and comprehensive API and bindings for working with WebAssembly for Go and JavaScript developers

A bridge and bindings for JS DOM API with Go WebAssembly. Written by Team Ortix - Hamza Ali and Chan Wen Xu. GOOS=js GOARCH=wasm go get -u github.com/

TeamOrtix 71 Jun 23, 2022
A comprehensive, efficient, and reusable util function library of go.

Lancet Lancet is a comprehensive, efficient, and reusable util function library of go. Inspired by the java apache common package and lodash.js. Engli

Beyond 1.2k Jul 6, 2022
An example go service that is being tested by nonnative.

Nonnative Example An example go service that is being tested by nonnative. Structure The project follows the structure in golang-standards/project-lay

Alejandro Falkowski 3 Oct 31, 2021
A comprehensive error handling library for Go

Highlights The errorx library provides error implementation and error-related utilities. Library features include (but are not limited to): Stack trac

Joom 875 Jul 1, 2022
A Simple and Comprehensive Vulnerability Scanner for Container Images, Git Repositories and Filesystems. Suitable for CI

A Simple and Comprehensive Vulnerability Scanner for Containers and other Artifacts, Suitable for CI. Table of Contents Abstract Features Installation

Aqua Security 12.6k Jun 26, 2022
A Simple and Comprehensive Vulnerability Scanner for Container Images, Git Repositories and Filesystems. Suitable for CI

A Simple and Comprehensive Vulnerability Scanner for Containers and other Artifacts, Suitable for CI. Abstract Trivy (tri pronounced like trigger, vy

Aqua Security 12.8k Jul 4, 2022