hbayes-0.5.2: Bayesian Networks

Safe HaskellNone
LanguageHaskell2010

Bayes.InfluenceDiagram

Contents

Description

Tools to build influence diagrams

Synopsis

Type

type InfluenceDiagram = DirectedSG EdgeKind IDValue Source

Influence diagram

type DecisionFactor = PrivateCPT Vector DVI Source

class Instantiable d v r | d -> r where Source

Methods

(=:) :: d -> v -> r Source

Create a variable instantiation using values from an enumeration

data UV Source

Utility variable

Instances

data TDV s Source

A typed discrete variable

type IDMonad g a = NetworkMonad g EdgeKind IDValue a Source

Building

t :: t Source

Synonym for undefined because it is clearer to use t to set the Enum bounds of a variable

(~~) Source

Arguments

:: (Initializable v, DirectedGraph g, Distribution d) 
=> IDMonad g v

Discrete variable in the graph

-> d

List of values

-> IDMonad g () 

chance :: (Bounded a, Enum a, NamedGraph g) => String -> a -> IDMonad g (TDV a) Source

Create a chance node

decisionNode :: (Bounded a, Enum a, NamedGraph g) => String -> a -> IDMonad g DEV Source

Create a decision node

utilityNode :: NamedGraph g => String -> IDMonad g UV Source

Create an utility node

proba :: (ChanceVariable c, DirectedGraph g) => c -> IDMonad g c Source

Define that a chance node is a probability (not conditional) Values are ordered like FFF FFT FTF FTT TFF TFT TTF TTT and same for other enumeration keeping enumeration order

decision :: (DirectedGraph g, BayesianDiscreteVariable dv) => DEV -> [dv] -> IDMonad g DEV Source

Define a decision dependence

utility :: (DirectedGraph g, BayesianDiscreteVariable dv) => UV -> [dv] -> IDMonad g UV Source

Define a utility dependence

cpt :: (DirectedGraph g, BayesianDiscreteVariable vb, ChanceVariable c) => c -> [vb] -> IDMonad g c Source

Define that a chance node is a conditional probability and define the parent variables

d :: DEV -> PorD Source

Used to mix decision and chance variables and a same list

p :: ChanceVariable c => c -> PorD Source

Used to mix decision and chance variables and a same list

noDependencies :: [DV] Source

Used to define a root decision which is not dependent on any past node

Solving

decisionsOrder :: InfluenceDiagram -> [ChancesOrDecision] Source

List of decision vertices in reverse temporal order (corresponding to elimination order)

solveInfluenceDiagram :: InfluenceDiagram -> [DecisionFactor] Source

Solve an influence diagram. A DecisionFactor is generated for each decision variable. A decision factor is containing a variable instantiation instead of a double. This instantiation is giving the decision to take for each value of the parents.

runID :: IDMonad DirectedSG a -> (a, InfluenceDiagram) Source

Run an influence monad

policyNetwork :: [DecisionFactor] -> InfluenceDiagram -> SBN CPT Source

Create a policy network from an influence diagram and its solution. A policy network is a Bayesian network where the decision nodes have been replaced with probability nodes where the probability is 1 when the configuration is corresponding to the decision and 0 otherwise.

decisionToInstantiation :: DecisionFactor -> [DVISet] Source

Convert a decision policy to a set of possible instantiations It is the only way to access to the content of a decision factor.

Testing

type DVISet = [DVI] Source