Source: https://jmlr.csail.mit.edu/papers/volume7/castillo06a/castillo06a.pdf