API for probabilities.finite-distributions
Full namespace name: clojure.contrib.probabilities.finite-distributions
Finite probability distributions
This library defines a monad for combining finite probability
Public Variables and Functions
Usage: (certainly v)
Returns a distribution in which the single value v has probability 1.
Usage: (choose & choices)
Construct a distribution from an explicit list of probabilities
and values. They are given in the form of a vector of probability-value
pairs. In the last pair, the probability can be given by the keyword
:else, which stands for 1 minus the total of the other probabilities.
Variant of the dist monad that can handle undefined values.
Usage: (cond-prob pred dist)
Returns the conditional probability for the values in dist that satisfy
the predicate pred.
Monad describing computations on fuzzy quantities, represented by a finite
probability distribution for the possible values. A distribution is
represented by a map from values to probabilities.
Usage: (join-with f dist1 dist2)
Returns the distribution of (f x y) with x from dist1 and y from dist2.
Usage: (make-distribution coll f)
Returns the distribution in which each element x of the collection
has a probability proportional to (f x)
Usage: (normalize weights)
Convert a weight map (e.g. a map of counter values) to a distribution
by multiplying with a normalization factor. If the map has a key
:total, its value is assumed to be the sum over all the other values and
it is used for normalization. Otherwise, the sum is calculated
explicitly. The :total key is removed from the resulting distribution.
Usage: (prob pred dist)
Return the probability that the predicate pred is satisfied in the
distribution dist, i.e. the sum of the probabilities of the values
that satisfy pred.
Usage: (uniform coll)
Return a distribution in which each of the elements of coll
has the same probability.
Usage: (zipf s n)
Returns the Zipf distribution in which the numbers k=1..n have
probabilities proportional to 1/k^s.