hbayes-0.5.2: Bayesian Networks

Bayes.Continuous

Synopsis

# Types

## For the graph description

data CV Source

A continuous variable

Instances

 Source Source Source Source Source

data DN Source

An expression which can be a constant, variable or formula. In case it is a variable, it can be used as a `BayesianVariable` or instantiated as an `Instantiable` type. Otherwise you'll get an error

Instances

 Source Source Source Source Source

class VariableName m where Source

This class is used to simplify the network description. Variable names can be optional. In that later case, () must be used instead of a name.

Methods

mkVariable :: m -> CNMonad CV Source

Instances

 Source Source

class BayesianVariable v where Source

A Bayesian Variable is a variable part of Bayesian network and so which knows its position : the vertex.

Methods

vertex :: v -> Vertex Source

## For the sampling

class InstantiationValue i v | i -> v where Source

Instances

 Source Source

data CVI Source

A continuous variable instantiation

# Network creation functions

Arguments

 :: VariableName s => s Variable name -> DN Min bound -> DN Max bound -> CNMonad DN

Uniform dstribution

Arguments

 :: VariableName s => s Variable name -> DN Average -> DN Standard deviation -> CNMonad DN

Normal distribution

beta :: VariableName s => s -> DN -> DN -> CNMonad DN Source

Beta distribution

beta' :: VariableName s => s -> DN -> DN -> CNMonad DN Source

Beta' distribution

exponential :: VariableName s => s -> DN -> CNMonad DN Source

Exponential distribution

Arguments

 :: VariableName s => s -> DN r -> DN lambda -> CNMonad DN

Gamma distribution

Create a network but only returns the monad value. Mainly used for testing.

runCN :: CNMonad a -> (a, ContinuousNetwork) Source

Create a network using the simple graph implementation The initialized nodes are replaced by the value. Returns the monad values and the built graph.

evalCN :: CNMonad a -> a Source

Create a bayesian network but only returns the monad value. Mainly used for testing.

# Sampling functions

Arguments

 :: (DirectedGraph g, FunctorWithVertex g) => Int Number of used samples -> Int Burnin samples before the used samples -> Sampler g a Sampler -> IO [Sample g a] List of generated samples

Sample a bayesian network using a given sampling scheme

Arguments

 :: ContinuousNetwork Bayesian network -> [CVI] Evidence -> Sampler DirectedSG CVI Sampler

Gibbs sampling for continuous network

(=:) :: Instantiable d v r => d -> v -> r Source

Create a variable instantiation using values from an enumeration

# Result statistics

Arguments

 :: Int Bins -> [Double] Samples -> [(Double, Double, Double)] Histogram (minBound,maxBound, value)

Compute the histogram of values

Arguments

 :: (InstantiationValue i v, BayesianVariable i, FunctorWithVertex g, Graph g) => Int Number of bins -> [Sample g i] Samples -> Sample g [(Double, Double, Double)] Histogram with start bins and bin content

Generate a graph of sampling histogram for each variable So, for a vertex v we have the posterior values p(v)