About 74,800 results
Open links in new tab
  1. How can I calculate perplexity using nltk - Stack Overflow

    Mar 7, 2019 · Perplexity is a popularly used measure to quantify how "good" such a model is. If a sentence s contains n words then perplexity Modeling probability distribution p (building the …

  2. nlp - How to calculate perplexity for a language model using …

    May 24, 2020 · As shown in Wikipedia - Perplexity of a probability model, the formula to calculate the perplexity of a probability model is: The exponent is the cross-entropy. While logarithm …

  3. nlp - How to compute the perplexity in text classification? - Stack ...

    May 20, 2019 · The lower the perplexity according to an LM, the higher the probability. Therefore, if the LM trained on dialect A assigns lower perplexity (i.e. higher probability) to an input than …

  4. nlp - Challenges when calculating perplexity: using bidirectional ...

    Jun 4, 2023 · Challenges when calculating perplexity: is my approach reasonable? I am trying to find a pre-trained language model that will work best for my text. The text is pretty specific in …

  5. nlp - How do I use BertForMaskedLM or BertModel to calculate …

    Jul 22, 2020 · I want to use BertForMaskedLM or BertModel to calculate perplexity of a sentence, so I write code like this: import numpy as np import torch import torch.nn as nn from …

  6. python - calculate perplexity in pytorch - Stack Overflow

    Dec 6, 2019 · When using Cross-Entropy loss you just use the exponential function torch.exp() calculate perplexity from your loss. (pytorch cross-entropy also uses the exponential function …

  7. How to get perplexity per token rather than average perplexity?

    Nov 6, 2023 · Note: you might get a different average perplexity than your first code snippet. The reason for that is that the tokens are shifted one position to the right in the original …

  8. nlp - Backpropagation / minibatching in training large language …

    Aug 17, 2023 · Q: What loss is computed when training a language model? A: Most probably perplexity for simple decoder-only language models and KL divergence or cross-entropy loss …

  9. Topic models: cross validation with loglikelihood or perplexity

    Jan 4, 2017 · The accepted answer to this question is good as far as it goes, but it doesn't actually address how to estimate perplexity on a validation dataset and how to use cross-validation. …

  10. NLTK package to estimate the (unigram) perplexity

    Oct 22, 2015 · Note that when dealing with perplexity, we try to reduce it. A language model that has less perplexity with regards to a certain test set is more desirable than one with a bigger …