skip to content
← Go back

Probability

Probability

The rise of artificial intelligence is a hot topic, but what does the end game look like? How do computer systems come to life? The answer lies within artificial emotion.

import MailingList from ”@/components/blog/NewsletterForm”;

Foreword

Probability is the likelihood of an event occurring. It allows us to determine how reliable our statistical results actually are. Without any past events to reference we are randomly guessing. For each event recorded we start to build out a model and update it as information becomes present. This is why the richer the data feedback we have the better we are off to improving our ability to determine what to do. Image you no longer had eyes. The amount of vital information to be processed would be limited to your other senses but you would be greatly inhibited in decision making.

Simple Probability

Lets talk about the probability of getting event:

  • P(event) = outcomes that meet criteria / all possible outcomes

The all possible outcomes is the sample space. The hardest thing about probability is defining the reference class. If you think about the chances a human of 25 years wakes up tomorrow, what is it relative to all living things on Earth? What about relative to all humans? What if you account for their family tree lifetimes? Do you see how it continues to evolve the more data you incorporate? It could be near 0% to 100% to anywhere inbetween, depending on the reference class. The great thing about AI is that it is significantly better than humans at determining this due to it’s abiltiy to think in higher dimensionalities than us.

E.g. for flipping a coin P(heads) = 1 (heads) / 2 (heads and tails) = 0.5. What about for a deck of cards? There are 4 7s in the deck of 52 cards, therefore P(7) = 4 / 52 which can be simplified into P(7) = 1 / 13 = 0.076. What if we want to do again? Well we performed a single experiment and are now left with P(7) = 3 / 51 = 1 / 17 = 0.058 since we took a card out the last iteration. This is our second experiment. This is called experimental probability. The more experiments we run, the closer our experimental probability will get to theoretical probability / the true probability.

Rules

Addition Rule

  • P(A or B) = P(A) + P(B) - P(A and B) aka P(A ∪ B) = P(A) + P(B) - P(A ∩ B) (∪ == union and ∩ == intersection) where:

P(A ∪ B): probability of A or B occurring by adding probability of A and probability of B minus the ones that overlap. For example in a coinflip: [HH, HT, TH, TT] we want to land on heads within 2 consecutive flips we would have P(H1 or H2) = 2/4 + 2/4 - 1/4 = 0.75 since HH and HT are for landing H on the first flip (2/4), HH and TH for the second flip (2/4), but HH overlaps on both so we subtract that (1/4).

For mutually exclusive/disjoint events

  • P(A ∩ B) = 0 therefore P(A ∪ B) = P(A) + P(B).

For example, on a 6 sided-dice the probabily of landing a two or a three is P(2 ∪ 3) = P(2) + P(3) since you cannot land both at one time. Another way of

Multiplication Rule

  • P(A and B) = P(A) * P(B)

If A = tails on #1 flip, P(A) = 1/2 and B = tails on #2 flip, P(B) = 1/2 then the probability of [tails, tails] consecutively is P(TT) = 1/2 * 1/2 = 1/4 = 0.25.

What about if I hit the target 80% of the time with my bow and arrow but I want to find the probability of consecutively hitting it twice. It would be 0.8 * 0.8 = 0.64 since my rate was 80% hit rate.

Independent And Dependent Events

Indepdent Events

If I had a coin flip the events will always be 50% since the flip isn’t depedent on the previous flip. You could argue that how it’s flipped is a variable (since it is) so you’ll need to account for that. Maybe if flipped with a finger the amount of power on the flip, finger position on the coin, wind, angle of the flip, etc. There are so many factors to take into consideration to be 100% certain on your probabilty. But to dumb it down lets say it hasn’t got any of these and is just the simple act of flipping.

Dependent Events

  • P(A and B) = P(A) * P(B | A) where | means the probability that event B happens given event A has already happened. As

Thinking of depedent events we can use the example of the deck of cards. If we withdraw a card from the 52 stack then now the sample space changes to 51, updating the probability since 1 card has been elimiated. And so removing the same card, lets say a 7, if we did it before would be 3/51 instead of 4/52. If we didn’t withdraw it previously it would be 4/52 since we didn’t get out desired card from the last draw.

To draw in our formula for drawing a king two times in a row we can use:

  • king #1: to draw our first king P(A) = 4/52
  • king #2: to draw our second another king given our first draw P(B | A) = 3/51
  • therefore drawing a king twice in a row is: P(king, king) = 4/52 * 3/51 or simply 1/13 * 1/17 = 1/221

Bayes’ Theorem

Bayes’ Theore allows us to calculate the probability that an event happens given our knowledge that some other related event has already taken place.

  • Formula: P(A|B) = P(B|A)*P(A) / P(B), or calculating the probability of A given B has already happened.

For example, lets say we have 2 dice. One is normal and the other is unfair where 6 has a 50% chance to land. If we choose 1 die randomly, roll it and get 6 what is the probability that happened?

In this case:

  • A = choosing biased die
  • B = Rolling 6

And so:

  • P(A|B) = P(biased | 6)
  • P(B|A) = P(6 | biased), = 1/2 since there is a 50% of the unfair die landing on 6.
  • P(A) = P(biased), = 1/2 since there are 2 die to choose from
  • P(B) = P(6)

But what is the P(6)?

First we need to account for the probability of picking the unfair die and landing on 6, = (1/2) * (1/2) and then we need to add the probability of choosing the normal die and landing on 6, = (1/2) * (1/6). Then we use the addition rule to get 1/4 + 1/12 which we can get the common denominator by multiplying each part of the 1/4 by *3 giving us 3/12 and adding it to the 1/12 giving us 3/12 + 1/12 = 4/12 = 1/3.

Now that we have that we can calculate P(biased | 6) by plugging in our above values, 1/2 * 1/2 / 1/3 yielding us = 1/4 / 1/3. We can flip the 1/3 to get the reciprical to make it = 1/4 * 3/1 ending us with = 3/4.

Permutations And Combinations

  • Permutations, nPk = n! / (n-k)! where we have n choices and want to arrange k of them.

If we have 4 flavours of ice cream we want to have a 3 stack on a cone our formula would look like 4P3 = 4! / (4-3)! where ! means factorial aka * by everything below it, e.g. 4! = 4*3*2*1.

Sequence order matters in permutations whereas order does not in combinations. Every unqiue sequence would fall under a single combination since they’re made up of the same things. They will always be less than permutations.

  • The formula for combinations is nCk = n! / k!(n-k)!

Markov Chains

For predicting

Conditional Probability

Share this Article

Recent Articles