API for probabilities.finite-distributions (1.1.x branch)

by Konrad Hinsen

Usage:
(ns your-namespace
  (:require clojure.contrib.probabilities.finite-distributions))

Overview

Finite probability distributions
This library defines a monad for combining finite probability
distributions.

Public Variables and Functions



certainly

function
Usage: (certainly v)
Returns a distribution in which the single value v has probability 1.
Source


choose

function
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.
Source


cond-dist-m

var

  
Variant of the dist monad that can handle undefined values.
Source


cond-prob

function
Usage: (cond-prob pred dist)
Returns the conditional probability for the values in dist that satisfy
the predicate pred.
Source


dist-m

var

  
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.
Source


join-with

function
Usage: (join-with f dist1 dist2)
Returns the distribution of (f x y) with x from dist1 and y from dist2.
Source


make-distribution

function
Usage: (make-distribution coll f)
Returns the distribution in which each element x of the collection
has a probability proportional to (f x)
Source


normalize

function
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.
Source


prob

function
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.
Source


uniform

function
Usage: (uniform coll)
Return a distribution in which each of the elements of coll
has the same probability.
Source


zipf

function
Usage: (zipf s n)
Returns the Zipf distribution in which the numbers k=1..n have
probabilities proportional to 1/k^s.
Source
Logo & site design by Tom Hickey.
Clojure auto-documentation system by Tom Faulhaber.