hbayes-0.5: Bayesian Networks

Safe HaskellSafe-Infered

Bayes.Continuous

Contents

Synopsis

Types

For the graph description

type CNMonad a = GraphMonad DirectedSG () Distri aSource

The Bayesian monad

data CV Source

A continuous variable

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 whereSource

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 CVSource

class BayesianVariable v whereSource

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

Methods

vertex :: v -> VertexSource

For the sampling

data CVI Source

A continuous variable instantiation

Network creation functions

uniformSource

Arguments

:: VariableName s 
=> s

Variable name

-> DN

Min bound

-> DN

Max bound

-> CNMonad DN 

Uniform dstribution

normalSource

Arguments

:: VariableName s 
=> s

Variable name

-> DN

Average

-> DN

Standard deviation

-> CNMonad DN 

Normal distribution

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

Beta distribution

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

Beta' distribution

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

Exponential distribution

execCN :: CNMonad a -> ContinuousNetworkSource

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 -> aSource

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

Sampling functions

runSamplingSource

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

continuousMCMCSamplerSource

Arguments

:: ContinuousNetwork

Bayesian network

-> [CVI]

Evidence

-> Sampler DirectedSG CVI

Sampler

Gibbs sampling for continuous network

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

Create a variable instantiation using values from an enumeration

Result statistics

histogramSource

Arguments

:: Int

Bins

-> [Double]

Samples

-> [(Double, Double, Double)]

Histogram (minBound,maxBound, value)

Compute the histogram of values

samplingHistogramsSource

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)