- data BayesianNetwork a
- data BayesianGraph = BayesianGraph {}
- data StoVar = StoVar {
- stoVarName :: StoVarName
- stoVarPrior :: PriorInfo
- stoPostDistLL :: !(Map Expr Expr)
- type Node = Expr
- data BayesianSimulator a
- logGamma :: Term a -> Term a
- using :: Distribution -> BayesianNetwork Expr
- tconst :: Double -> Term a
- vector :: (Int, Int) -> (Int -> BayesianNetwork Expr) -> BayesianNetwork ([Expr] -> Expr)
- matrix :: (Int, Int) -> (Int, Int) -> ([Int] -> BayesianNetwork Expr) -> BayesianNetwork ([Expr] -> Expr)
- nodeArray :: [(Int, Int)] -> ([Int] -> BayesianNetwork Expr) -> BayesianNetwork ([Expr] -> Expr)
- type Vector = [Expr] -> Expr
- type Matrix = [Expr] -> Expr
- type NodeArray = [Expr] -> Expr
- tcase :: Term a -> [Term a] -> Term a
- (//) :: BayesianNetwork Expr -> String -> BayesianNetwork Expr
- buildBayesianGraph :: BayesianNetwork a -> (a, BayesianGraph)
- class Show t => PP t where
- class LaTeX t where
- simulate :: FilePath -> BayesianSimulator () -> IO ()
- genSimulator :: FilePath -> BayesianSimulator () -> IO ()
- setSampleCount :: Int -> BayesianSimulator ()
- setIterationsPerSample :: Int -> BayesianSimulator ()
- setWarmupCount :: Int -> BayesianSimulator ()
- setThreadNum :: Int -> BayesianSimulator ()
- useMersenneTwister :: Bool -> BayesianSimulator ()
- enableProfiling :: Bool -> BayesianSimulator ()
- setRandomSeed :: Int -> BayesianSimulator ()
- useSpecialSlicers :: Bool -> BayesianSimulator ()
- splitFiles :: Bool -> BayesianSimulator ()
- model :: BayesianNetwork a -> BayesianSimulator a
- observe :: Term NodeIdx -> Double -> BayesianSimulator ()
- monitor :: String -> Expr -> BayesianSimulator ()
- monitorVec :: String -> Matrix -> [Int] -> BayesianSimulator ()
- monitorVecs :: String -> NodeArray -> [[Int]] -> BayesianSimulator ()
- runLatex :: BayesianNetwork a -> IO ()
Types
data BayesianGraph Source
A Bayesian Network is a collection of stochastic nodes. Stochastic nodes may be (optionally) grouped into arrays.
A Stochastic variable.
StoVar | |
|
Constructing models
using :: Distribution -> BayesianNetwork ExprSource
:: (Int, Int) | Bounds for the vector indexes |
-> (Int -> BayesianNetwork Expr) | Initializer (should return a node) |
-> BayesianNetwork ([Expr] -> Expr) |
Create a 1D vector
:: (Int, Int) | |
-> (Int, Int) | Bounds for 1st and 2nd dimensions. |
-> ([Int] -> BayesianNetwork Expr) | Initializer |
-> BayesianNetwork ([Expr] -> Expr) |
Create a 2D matrix
:: [(Int, Int)] | Bounds for each dimension. |
-> ([Int] -> BayesianNetwork Expr) | Initializer |
-> BayesianNetwork ([Expr] -> Expr) |
Create an >= 3D array
(//) :: BayesianNetwork Expr -> String -> BayesianNetwork ExprSource
Distributions
Extracting graphs
buildBayesianGraph :: BayesianNetwork a -> (a, BayesianGraph)Source
Displayihng graphs
Simulation
genSimulator :: FilePath -> BayesianSimulator () -> IO ()Source
setRandomSeed :: Int -> BayesianSimulator ()Source
Set the random seed for a thread. This function may be calledd multiple times to set the seeds for multiple threads. The seeds are used in order: first call is for thread 0, next for thread 1, etc.
useSpecialSlicers :: Bool -> BayesianSimulator ()Source
When using a specialized slizer, we generate a custom slicer for each stochastic variable. The benefit of this is that, in principle, this may result in more efficient code, at the cost of longer compilation time, and larger binary. The alternative is to use a generic slicing function which is parameterized by the log-likelihood function for a variable.
splitFiles :: Bool -> BayesianSimulator ()Source
Generate a separate file for each stochastic variable. The benefit of this flag is that it makes it possible to compile multiple files in parallel. The drawback is that some optimizations may be lost because the files are compiled separately. Also, there is some overhead for processing multiple files.
model :: BayesianNetwork a -> BayesianSimulator aSource
observe :: Term NodeIdx -> Double -> BayesianSimulator ()Source
monitor :: String -> Expr -> BayesianSimulator ()Source
monitorVec :: String -> Matrix -> [Int] -> BayesianSimulator ()Source
Like monitor, but adds the indexes in the label of the variable.
monitorVecs :: String -> NodeArray -> [[Int]] -> BayesianSimulator ()Source
LaTeX
runLatex :: BayesianNetwork a -> IO ()Source