Probability theory: The Law Of Total Probability

Radzion
2 min readMar 13, 2018

This is part of the course “Probability Theory and Statistics for Programmers”.

Probability Theory For Programmers

Let it be required to determine the probability of the event A, which can occur with one of the events H1, H2,…, Hn forming a complete group of mutually exclusive events. This is “The Law Of Total Probability”:

Law of total probability

In order to show how this concept works, we will represent events like a tree. Let’s imagine that we want to calculate the probability of some event A1.

Let’s calculate the probability of the event A1 using the previous formula:

probability of A1

Now we can write a function which will take the tree of probabilities and name of the event and will return probability. We will represent root as the list of trees and will walk recursively through those trees calculating probability on the way.

Next part ->

Reach the next level of focus and productivity with increaser.org.

Increaser

--

--