def compute_perplexities(vals, test_data, smoothing): return [np.exp(-log_likelihood(test_data, wordprobs(test_data, val)) / test_data.sum()) for val in vals]
def compute_perplexities(vals, test_data, smoothing): return [ np.exp(-log_likelihood(test_data, wordprobs(test_data, val)) / test_data.sum()) for val in vals ]
def compute_loglikes(vals, train_data, smoothing): return [log_likelihood(train_data, wordprobs(train_data, val)) for val in vals]
def compute_loglikes(vals, train_data, smoothing): return [ log_likelihood(train_data, wordprobs(train_data, val)) for val in vals ]