Skip to content

Instantly share code, notes, and snippets.

@nsaphra
Created April 19, 2017 15:50
Show Gist options
  • Select an option

  • Save nsaphra/0ed1e514c30654b849f9cee906e5719b to your computer and use it in GitHub Desktop.

Select an option

Save nsaphra/0ed1e514c30654b849f9cee906e5719b to your computer and use it in GitHub Desktop.
discrete log uniform power distribution
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