hbayes-0.5.2: Bayesian Networks

Safe HaskellNone
LanguageHaskell2010

Bayes.Continuous

Contents

Synopsis

Types

For the graph description

type CNMonad a = GraphMonad DirectedSG () Distri a Source

The Bayesian monad

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

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

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

Network creation functions

uniform Source

Arguments

:: VariableName s 
=> s

Variable name

-> DN

Min bound

-> DN

Max bound

-> CNMonad DN 

Uniform dstribution

normal Source

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

gammaD Source

Arguments

:: VariableName s 
=> s 
-> DN

r

-> DN

lambda

-> CNMonad DN 

Gamma distribution

execCN :: CNMonad a -> ContinuousNetwork Source

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

runSampling Source

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

continuousMCMCSampler Source

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

histogram Source

Arguments

:: Int

Bins

-> [Double]

Samples

-> [(Double, Double, Double)]

Histogram (minBound,maxBound, value)

Compute the histogram of values

samplingHistograms Source

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)