# Conditional Probability in Artificial Intelligence

In this tutorial, we will learn about the conditional probability, what conditional probability is, in what cases it occurs, the formula for calculating it? By Monika Sharma Last updated : April 15, 2023

## Overview

Before learning what conditional probability is? We must first learn about dependent and independent events.

## What are Independent and Dependent Events?

Independent events are those events which neither cause any effect nor are affected by the occurrence of some other event. Whereas, dependent events are affected by the happening of some other events which may occur simultaneously or have occurred before it.

### Example

Picking a card from a complete fresh deck of cards is an independent event because the occurrence of any card is not affected by anything. But, suppose after picking up a card, another card is picked up without replacing the previous one, then this event becomes a dependent event because the occurrence of any card is now affected by the previously drawn card.

## What is Conditional Probability in AI?

The conditional probability is associated with these dependent events. If the probability of any event is affected by the occurrence of other events (s), then it is known as conditional probability.

## How to Calculate Conditional Probability?

The conditional probability is calculated by P(A|B) and read as probability of event A when event B has already occurred. It can be calculated as follows:

### Formula

```P(A|B) = P(A ^ B) / P(B)
```

Similarly, P(B|A) represents the probability of event B when A has already occurred and this can also be calculated in a similar manner:

```P(B|A) = P(A ^ B) / P(A)
```

Talking about the intelligent systems (agents), most of the cases that the agent confronts are of conditional probability as the events taking place in the environment are mostly dependent on one another. So, in the probabilistic learning method, the concept of conditional probability is used the most by the system. For example, an agent which tells the weather forecast will determine the weather conditions based upon the other factors such as wind speed, current temperature, and humidity level, etc. So, the future weather conditions are dependent upon these factors and thus it is a dependent event. In this case, also, the agent uses the concept of conditional probability but with other complex concepts and calculations included with it.