Created
April 19, 2017 15:50
-
-
Save nsaphra/0ed1e514c30654b849f9cee906e5719b to your computer and use it in GitHub Desktop.
discrete log uniform power distribution
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def zipf(size, exponent): | |
| x = np.arange(size, dtype='float') | |
| pmf = (x ** exponent).reciprocal() | |
| pmf /= pmf.sum() | |
| return stats.rv_discrete(values=range(size), pmf) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment