NumPy Tutorial · NumPy Random

Zipf Distribution

Learn all about Zipf Distribution in this comprehensive tutorial.

5 min read advanced
  • Zipf distributions are used to sample data based on zipf's law.
  • Sample 1000 points but plotting only ones with value < 10 for more meaningful chart.

Introduction

Zipf distributions are used to sample data based on zipf's law.

Note: Zipf's Law: In a collection, the nth common term is 1/n times of the most common term. E.g. the 5th most common word in English occurs nearly 1/5 times as often as the most common word.

It has two parameters:

a - distribution parameter.

size - The shape of the returned array.

python

Visualization of Zipf Distribution

Sample 1000 points but plotting only ones with value < 10 for more meaningful chart.

python

Module quiz

2 questions
1

Which of the following is true about Zipf Distribution?

2

What is the most common pitfall when working with Zipf Distribution?

Answer all questions to submit.