Natural Language Processing · M2 · read
Bayes’ rule: prior, evidence and answer
Start here · language & probability
Prerequisites for M2 · no earlier NLP knowledge assumed
Bayes’ rule reverses a conditional probability. A word-sense classifier asks “which sense is most likely given these context words?” Training data more easily supplies “how likely are these words when this sense is used?” Bayes connects the two.
P(c\mid x)=\frac{P(x\mid c)P(c)}{P(x)}| Symbol | Meaning |
|---|---|
| c | A candidate class, tag or word sense. |
| x | The observed evidence, such as a context word. |
| P(c) | Prior: how common the class is before seeing the evidence. |
| P(x | c) | Likelihood: how compatible the evidence is with that class. |
| P(c | x) | Posterior: probability of the class after observing the evidence. |
| P(x) | Evidence normaliser, shared by all classes for the same observation. |
For ranking classes, calculate prior × likelihood. The common denominator does not affect which class is largest. For an actual posterior probability, divide by the sum of all class scores.
A complete Bayes calculation
A word has two senses: financial bank and river bank. Priors are 0.6 and 0.4. The probability of observing “loan” is 0.5 under the financial sense and 0.1 under the river sense. Find the most likely sense and its posterior.
P(F) = 0.6; P(R) = 0.4; P(loan | F) = 0.5; P(loan | R) = 0.1. These two senses are exhaustive.
To findScores and P(F | loan).
Formula and why it applies
s(c)=P(c)P(\text{loan}\mid c)P(F\mid\text{loan})=\frac{s(F)}{s(F)+s(R)}Multiply prior and likelihood to reverse the conditioning. Then normalise because a posterior was requested.
Solution
Step 1. Score the financial sense
s(F)=0.6\times0.5=0.30Step 2. Score the river sense
s(R)=0.4\times0.1=0.04Step 3. Add the scores
P(\text{loan})=0.30+0.04=0.34Step 4. Normalise the financial score
P(F\mid\text{loan})=\frac{0.30}{0.34}=\frac{15}{17}\approx0.882353Yaad rakho: Pehle se kitna common × evidence kitna suit karta = score.
Bayes Rule & Models
- id
- nlp-m2-02-bayes-generative-discriminative
- title
- Bayes Rule & Models
- title_confirmed
- true
- topic_title
- Bayes rule and generative versus discriminative models
- mode
- m2
- kind
- focused
- status
- available
- duration
- 10:51
- reviewed
- false
- notebook_url
- https://notebook.google.com/notebook/a270ef1e-c285-4d31-9db1-302090c5f8b1
- youtube_url
- corrected_visuals
- false
- upload_pending_correction
- false
- correction_note
- related_topic_ids
These are recorded generation statuses, not a live service check. Private YouTube and signed-in NotebookLM links require the owner's account. This export publishes existing catalog metadata, not private video files or an invented transcript.
NLP M2 — Probability and Bayes | Reviewed step-by-step numericals
- id
- overview-probability-bayes
- title
- NLP M2 — Probability and Bayes | Reviewed step-by-step numericals
- title_confirmed
- true
- topic_title
- NLP M2 — Probability and Bayes | Reviewed step-by-step numericals
- mode
- m2
- kind
- supplemental
- status
- available
- duration
- 8:53
- reviewed
- true
- notebook_url
- https://notebook.google.com/notebook/a270ef1e-c285-4d31-9db1-302090c5f8b1
- youtube_url
- corrected_visuals
- true
- upload_pending_correction
- true
- correction_note
- Complete HMM and Naive Bayes calculations; clarified joint scores versus model posteriors. Full transcript and detected slides checked; short voice corrections included. The corrected YouTube upload is still processing.
- related_topic_ids
- nlp-m2-01-foundations-counts-probability
- nlp-m2-02-bayes-generative-discriminative
These are recorded generation statuses, not a live service check. Private YouTube and signed-in NotebookLM links require the owner's account. This export publishes existing catalog metadata, not private video files or an invented transcript.