dist

package
v0.0.0-...-12cceb7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 21, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Geometric

type Geometric struct {
	// contains filtered or unexported fields
}

Geometric implements the geometric distribution, a distribution which models the number of failures observed before the first success in independent Bernoulli trials. See: https://en.wikipedia.org/wiki/Geometric_distribution

func NewGeometric

func NewGeometric(p float64, src rand.Source) *Geometric

NewGeometric returns a Geometric, representing a geometric random variable with parameter `p` and non-negative integer support.

func (Geometric) Rand

func (g Geometric) Rand() float64

Rand returns a random sample drawn from the distribution. This function must return float64 in order to implement distuv.Rander.

type Multinomial

type Multinomial struct {
	// N is the number of trials.
	N uint32

	// CategoryProb is a slice encoding the event probabilities. For each integer i,
	// CategoryProb[i] represents the probability of drawing a sample in the
	// i-th category.
	CategoryProb []float64

	Src rand.Source
}

Multinomial implements the multinomial distribution, a generalization of the binomial distribution. A multinomial sample consists of a variable number of independent samples, each having a fixed probability of being drawn into one of a fixed number of distinct categories. See: https://en.wikipedia.org/wiki/Multinomial_distribution.

func (Multinomial) CovarianceMatrix

func (m Multinomial) CovarianceMatrix(dst *mat.SymDense)

TODO: Implement CovarianceMatrix. CovarianceMatrix returns the covariance matrix of the distribution.

func (Multinomial) LogProb

func (m Multinomial) LogProb(x []uint32) float64

LogProb computes the natural logarithm of the value of the probability mass function at `x`.

func (Multinomial) Mean

func (m Multinomial) Mean() []float64

Mean returns the mean vector of the distribution.

func (Multinomial) Prob

func (m Multinomial) Prob(x []uint32) float64

Prob computes the value of the probability mass function at `x`.

func (Multinomial) Rand

func (m Multinomial) Rand() map[uint32]uint32

Rand returns a random sample drawn from the distribution. The return format is a map. The (key, value) pair present in the map indicates `value` number of samples drawn from the `key` category.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL