Detailed explanation in The Kaggle Book p. 371 of 826.