[SPARK-2199] a bug in perplexity computation fixed

collection length computation was wrong