NLP 面试题与答案
问题 11. What is the purpose of a language model in NLP?
A language model is designed to predict the likelihood of a sequence of words. It helps in understanding and generating human-like text.
Example:
In a language model, given the context 'The cat is on the...', it predicts the next word, such as 'roof'.
问题 12. Explain the concept of a Bag-of-Words (BoW) model.
A BoW model represents a document as an unordered set of words, disregarding grammar and word order but keeping track of word frequency.
Example:
In a BoW representation, the sentence 'I love programming, and I love to read' might be represented as {'I': 2, 'love': 2, 'programming': 1, 'to': 1, 'read': 1}.
问题 13. What is the difference between a generative and discriminative model in NLP?
Generative models learn the joint probability of input features and labels, while discriminative models learn the conditional probability of labels given the input features.
Example:
Naive Bayes is an example of a generative model, while logistic regression is a discriminative model.
问题 14. How does a Long Short-Term Memory (LSTM) network address the vanishing gradient problem in NLP?
LSTMs use a gating mechanism to selectively remember and forget information over long sequences, addressing the vanishing gradient problem faced by traditional recurrent neural networks (RNNs).
Example:
LSTMs are effective in capturing long-range dependencies in sequential data.
问题 15. What are stop words, and why are they often removed in NLP preprocessing?
Stop words are common words (e.g., 'the', 'and', 'is') that are often removed during preprocessing to reduce dimensionality and focus on more meaningful words.
Example:
In sentiment analysis, stop words may not contribute much to sentiment and can be excluded to improve model efficiency.
用户评价最有帮助的内容: