hbayes-0.5.2: Bayesian Networks

Safe HaskellNone
LanguageHaskell2010

Bayes.Sampling

Contents

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

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

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

Return the vertices in topological order

Sampling schemes

discreteAncestralSampler :: (Factor f, FunctorWithVertex g, DirectedGraph g) => BayesianNetwork g f -> Sampler g DVI Source

Ancestral sampler which does not support evidence

gibbsSampler Source

Arguments

:: (Factor f, FunctorWithVertex g, DirectedGraph g) 
=> BayesianNetwork g f

Bayesian network

-> [DVI]

Evidence

-> Sampler g DVI

Sampler

Gibbs sampling

gibbsMCMCSampler Source

Arguments

:: (Factor f, FunctorWithVertex g, DirectedGraph g) 
=> BayesianNetwork g f

Bayesian network

-> [DVI]

Evidence

-> Sampler g DVI

Sampler

Gibbs sampling

Sampling results

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)

histogram Source

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) 

continuousMCMCSampler Source

Arguments

:: ContinuousNetwork

Bayesian network

-> [CVI]

Evidence

-> Sampler DirectedSG CVI

Sampler

Gibbs sampling for continuous network