Source: https://cs.nyu.edu/~mohri/pub/nsmooth.pdf