computed the perplexity of a held-out test set to evaluate the model