reference tdunning code from mahout 0.5