- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Bayes’ Rule in Data Structure

A way to update our beliefs depended on the arrival of new, relevant pieces of evidence are provided by Bayes rule. For example, if we were trying to provide the probability that a given person has cancer, we would initially just conclude it is whatever percent of the population has cancer. However, given extra evidence such as the fact that the person is a smoker, we can update our probability, since the probability of having cancer is greater given that the person is a smoker. This allows us to utilize prior knowledge to improve our probability estimations.

The rule is explained below -

$$P\lgroup C|D \rgroup=\frac{P \lgroup D|C \rgroup P \lgroup C \rgroup}{P\lgroup D \rgroup}$$

In this formula, C is the event we want the probability of, and D is the new evidence that is related to C in some way.

**P(C|D)** is denoted as the posterior; this is what we are trying to estimate. In the above example, it is concluded that the “probability of having cancer given that the person is a smoker”.

**P(D|C)** is denoted as the likelihood; this is the probability of observing the new evidence, provided our initial hypothesis. In the above example, it is concluded that the “probability of being a smoker given that the person has cancer”.

**P(C)** is denoted as prior; this is the probability of our hypothesis without any extra prior information. In the above example, it is concluded that the “probability of having cancer”.

**P(D)** is denoted as the marginal likelihood; this is the total probability of observing the evidence. In the above example, it is concluded that the “probability of being a smoker”. In several applications of Bayes Rule, this is ignored, as it mainly serves as normalization.

- Related Questions & Answers
- Rectangle Data in Data Structure
- Halfedge data structure
- Deaps in Data Structure
- Quadtrees in Data Structure
- Arrays Data Structure in Javascript
- Stack Data Structure in Javascript
- Queue Data Structure in Javascript
- Set Data Structure in Javascript
- Dictionary Data Structure in Javascript
- Tree Data Structure in Javascript
- Graph Data Structure in Javascript
- Finger Searching in Data Structure
- Skip Lists in Data Structure
- Splay trees in Data Structure
- Solid Trees in Data Structure