Corrected an error in the perplexity code (was taking np.sum instead of np.prod)