Definitioncore
Positive pointwise mutual information
Also called PPMI.
PPMI(w, c) = max(PMI(w, c), 0), which drops unreliable negative values and makes a sparse word-context weighting that works well for similarity.
Positive pointwise mutual information is PMI with every negative value replaced by 0: . It is the usual weighting of a word-context matrix before the rows are compared as word vectors. The cut keeps the information that a word and a context occur together more often than chance, and drops the claim that they occur together less often, which needs far more data to estimate. It also removes the of the pairs never seen, so the matrix stays as sparse as the counts. That PPMI with the cosine works well for word similarity is a measurement: Bullinaria and Levy 2007 found it the best of the weightings they compared, and Levy, Goldberg and Dagan 2015 found it competitive with learned embeddings when its settings are tuned.
Definition
Let be a word-context matrix with total , row sums and column sums . The PPMI matrix has the entries
with the value 0 when . Any base of the logarithm can be used, and the page or paper states it. The base scales every entry by the same factor, so it does not change cosines.
Since the cut is at 0, these facts hold at once.
- , and whenever . So the PPMI matrix has no more nonzero entries than .
- All rows are nonnegative vectors, so the cosine of two rows is in , and it is 0 exactly when the two words share no context with positive PMI.
- A pair keeps its PMI value when it is positive, so the upper bound of PMI holds: .
Context distribution smoothing. Levy, Goldberg and Dagan 2015 replace by
and use . Since , rare contexts get a larger probability and frequent contexts a smaller one, which lowers the PMI of rare contexts and raises that of frequent ones. The exponent comes from the sampling distribution of negative samples in word2vec.
Shifted PPMI. for an integer keeps only the pairs with a ratio above . The shifted PMI matrix is, under some assumptions, the matrix that skip-gram with negative samples factorizes (see the factorization theorem).
Examples and non-examples
A small matrix. The counts, written for this page, with , are cat (pet 4, fur 3, road 0, the 5), dog (5, 2, 1, 6) and car (0, 0, 6, 8). The PMI values in bits are on the PMI page. PPMI keeps the positive ones:
| word | pet | fur | road | the |
|---|---|---|---|---|
| cat | 0.5670 | 1.0000 | 0 | 0 |
| dog | 0.6666 | 0.1926 | 0 | 0 |
| car | 0 | 0 | 1.2922 | 0.2666 |
The cosines of the rows, raw counts against PPMI:
| pair | raw counts | PPMI |
|---|---|---|
| cat, dog | 0.9748 | 0.7154 |
| cat, car | 0.5657 | 0 |
| dog, car | 0.6647 | 0 |
With raw counts, "car" looks fairly close to "cat" and "dog", because all three occur often with "the". PPMI gives "the" no weight in the rows of "cat" and "dog", and the animals and the car no longer share anything.
With smoothing. With , the context probabilities change from to about for pet, fur, road and the. The rows become cat , dog and car . The rare context "fur" loses weight, and "dog" and "fur" drop to 0, while the frequent context "the" gets a small positive weight in all three rows.
Why negative values are dropped. Take two words with probability each. If they are independent, they occur together with probability , so a corpus must have far more than pairs before a count of 0 shows that they avoid each other. In a corpus of usual size, almost all pairs of rare words have the count 0, and a negative or PMI for them is an artifact of the sample size. This is the heuristic reason for the cut.
Not: a fix for rare events. PPMI keeps the high positive PMI of a pair seen once with two rare words. The bias of PMI toward rare events remains, and smoothing or a minimum count is needed for it.
Not: the absolute value. would give pairs that avoid each other a large weight, together with the of the pairs never seen. PPMI gives them 0.
Related definitions
- PMI. Pointwise mutual information is the value before the cut. Its average under the joint distribution is the mutual information, which is at least 0. PPMI values are nonnegative one by one.
- Word-context matrix. PPMI is a weighting of the counts of a word-context matrix. The choice of window and context changes the counts, and so the PPMI values.
- Low-rank vectors. A truncated singular value decomposition of the PPMI matrix gives dense vectors, as latent semantic analysis does for a term-document matrix.
- Learned embeddings. The skip-gram model and GloVe learn dense vectors whose dot products approximate a shifted PMI and a log count, so they are close relatives of a factorized PPMI matrix.
- Sparse storage. The PPMI matrix has the same zero pattern as the counts or a smaller one, so it is stored as a sparse matrix.
References
- Bullinaria and Levy 2007, the comparison of weightings and distance measures for word-context vectors, in which positive PMI with the cosine did best
- Levy, Goldberg and Dagan 2015, PPMI, shifted PPMI max(PMI - log k, 0), and context distribution smoothing with the exponent 0.75
- Daniel Jurafsky and James H. Martin, Speech and Language Processing, third edition draft, the chapter on vector semantics and embeddings, the section on PPMI and the reason for dropping negative values
About this page
The build computes these levels from the evidence in the repository. Each row says what the next level needs. Read what the levels mean.
| Ladder | Level | What the next level needs |
|---|---|---|
| Human proof | H0 no proof |
|
| Lean | L0 no Lean part |
|
| Visual | V0 none |
|
| Writing | W4 complete |
|
Tag J6ZPMC Edit this page History Report an error Markdown