Calculator
Use counts when you know frequencies. Use probabilities when you already know marginals and the joint probability.
Example Data Table
These example pairs show how PMI changes when co-occurrence is stronger or weaker than the independence baseline.
| Event X | Event Y | Total N | Count X | Count Y | Joint Count | Approx. PMI (base 2) |
|---|---|---|---|---|---|---|
| artificial | intelligence | 10,000 | 500 | 450 | 320 | 3.8301 |
| machine | learning | 10,000 | 520 | 610 | 280 | 3.1418 |
| rain | umbrella | 10,000 | 700 | 650 | 290 | 2.6728 |
| coffee | galaxy | 10,000 | 900 | 120 | 2 | -2.4330 |
Formula Used
Pointwise Mutual Information compares the observed joint occurrence with the joint occurrence expected under independence.
Smoothing note: When alpha is greater than zero, the calculator applies Laplace smoothing to the 2×2 contingency table before computing adjusted probabilities. That is useful when the joint count is zero or when counts are sparse.
Interpretation note: A positive PMI means the pair appears together more often than independence predicts. A negative PMI means the pair appears together less often than expected.
How to Use This Calculator
- Enter names for Event X and Event Y so the result is easier to read.
- Choose Counts if you know raw frequencies, or Probabilities if you already know P(X), P(Y), and P(X,Y).
- Select the log base. Base 2 reports PMI in bits. Base e reports nats. Base 10 reports hartleys.
- Add Laplace smoothing alpha when your data is sparse or when the joint value is zero.
- Click Calculate PMI to place the result above the form, review the metrics, inspect the graph, and export the results to CSV or PDF.
FAQs
1. What does PMI measure?
PMI measures how strongly two events are associated at a single point. It compares the observed joint probability against the probability expected if the events were independent.
2. What does a positive PMI mean?
A positive PMI means the pair appears together more often than independence predicts. Larger positive values indicate stronger positive association between the events.
3. What does a negative PMI mean?
A negative PMI means the pair co-occurs less often than expected under independence. That suggests avoidance, substitution, or weak association in the dataset.
4. Why can PMI be undefined?
PMI needs a positive joint probability inside the logarithm. If the joint value is zero and no smoothing is applied, the logarithm is undefined, so the calculator reports that issue.
5. When should I use smoothing?
Use smoothing when counts are tiny, the joint value is zero, or you want a more stable estimate. A small alpha often prevents extreme values caused by sparse data.
6. What is the difference between PMI and NPMI?
PMI is unbounded, so very rare pairs can look extremely large. NPMI rescales PMI by joint-event self-information, making values easier to compare across datasets.
7. Can I use probabilities instead of counts?
Yes. Choose probability mode and enter P(X), P(Y), and P(X,Y). The calculator also uses the reference total to estimate expected and observed joint counts.
8. Where is PMI commonly used?
PMI is common in text mining, collocation analysis, information retrieval, recommendation systems, and feature engineering. It helps identify unusually informative co-occurrences.