Hello again! Typically I would start by describing a complicated problem that can be solved using machine or deep learning methods, but today I want to do something different, I want to show you some interesting probabilistic phenomena!
Have you heard of Zipf’s law? I hadn’t until recently. Zipf’s law is an empirical law that states that many different datasets found in nature can be described using Zipf’s distribution. Most notably, word frequencies in books, documents and even languages can be described in this way. Simplified, Zipf’s law states that if we take a document, book or any collection of words and then the how many times each word occurs, their frequencies will be very similar to Zipf’s distribution. Let’s say that the number of occurrences of the most frequently occurring word is:
Zipf’s law states that the number of occurrences of the second most frequently occurring word will be equal to:
So basically this word will occur half of the number of times the most frequent word did. The number of occurrences of the third most frequently occurring word would be:
And so on … So the number of occurrences of the Nth most frequent word would be:
Most recent studies of this phenomena show that in the case of words, typically there is the same value of ????, and the frequency on Nth word is described as:
To check the theory I downloaded a set of the 50,000 most frequent Polish words in subtitles (https://github.com/hermitdave/FrequencyWords/blob/master/content/2016/pl/pl_50k.txt) from OpenSubtitles.org. Here’s a visualization of real and theoretical frequencies.
To see it more clearly we can use logarithmic scales.
Try it out yourself: a list of example datasets can be found here: https://en.wiktionary.org/wiki/Wiktionary:Frequency_lists
You can use this example code to create a similar visualization:
This experiment is amazing, because language is very complicated: words in text are not random in any sense, and they depend on the previous ones. That’s why it’s so surprising to see such patterns here. We should always remember that the world can astonish us in many different ways! See you next time ????