hbayes-0.5.2: Bayesian Networks

Safe Haskell None Haskell2010

Bayes.Sampling

Description

Sampling

Samplers for Bayesian network inferences

Synopsis

# Types

data Sampler g a Source

Sampler defining the behavior of a sampling algorithms (init value, sample generation, how to select nodes in the grapg)

Constructors

 forall b . Sampler !b !(GenIO -> IO (Sample g a)) !(GenIO -> SamplerGraph g a) !(SamplingScheme g b a)

type Sample g a = BayesianNetwork g a Source

A sample (graph of instantiations)

# Sampling

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

topologicalOrder :: DirectedGraph g => g a b -> [Vertex] Source

Return the vertices in topological order

# Sampling schemes

Ancestral sampler which does not support evidence

Arguments

 :: (Factor f, FunctorWithVertex g, DirectedGraph g) => BayesianNetwork g f Bayesian network -> [DVI] Evidence -> Sampler g DVI Sampler

Gibbs sampling

Arguments

 :: (Factor f, FunctorWithVertex g, DirectedGraph g) => BayesianNetwork g f Bayesian network -> [DVI] Evidence -> Sampler g DVI Sampler

Gibbs sampling

# Sampling results

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)

Arguments

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

Compute the histogram of values

# For continuous distributions

data Distri Source

Constructors

 D !CV !(DistributionF DirectedSG (Double, Double) CVI)

Arguments

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

Gibbs sampling for continuous network