Book Image

Haskell Data Analysis Cookbook

By : Nishant Shukla
Book Image

Haskell Data Analysis Cookbook

By: Nishant Shukla

Overview of this book

Table of Contents (19 chapters)
Haskell Data Analysis Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Evaluating a Bayesian network


A Bayesian network is a graph of probabilistic dependencies. Nodes in the graph are events, and edges represent conditional dependence. We can build a network from prior knowledge to find out new probabilistic properties of the events.

We will use Haskell's probabilistic functional programming library to evaluate such a network and find interesting probabilities.

Getting ready

Install the probability library using cabal as follows:

$ cabal install probability

We will be representing the following network. Internalize the following figure to get an intuitive grasp of the variable names:

Event C depends on events A and B. Meanwhile, events D and E depend on event C. Through the power of the Probabilistic Functional Programming library, in this recipe, we will find the probability of event E given only information about event D.

How to do it…

  1. Import the following packages:

    import qualified Numeric.Probability.Distribution as Dist
    import Numeric.Probability.Distribution...