NLP Text Classification 1 — Questions and Answers
Question 1: Which machine learning algorithm is considered a generative classifier commonly used for text classification due to its simplicity and strong baseline performance?
- Support Vector Machine
- Naive Bayes (Correct answer)
- Random Forest
- k-Nearest Neighbors
Correct answer: Naive Bayes
Naive Bayes is a generative classifier that models the joint probability of features and labels, and despite its 'naive' independence assumption, it performs surprisingly well on text data.
Question 2: In text classification, what is the primary purpose of TF-IDF (Term Frequency-Inverse Document Frequency)?
- To reduce the dimensionality of text data
- To weight words by importance relative to a corpus (Correct answer)
- To tokenize sentences into individual words
- To remove stop words from documents
Correct answer: To weight words by importance relative to a corpus
TF-IDF weights a word higher when it appears frequently in a document but rarely across the corpus, highlighting distinctive terms for classification.
Question 3: Which evaluation metric is most appropriate for a highly imbalanced text classification dataset where the positive class is rare?
- Accuracy
- F1-Score (Correct answer)
- Mean Squared Error
- Perplexity
Correct answer: F1-Score
F1-Score balances precision and recall, making it more informative than accuracy when the class distribution is skewed and the minority class matters most.
Question 4: What is multi-label text classification?
- Classifying text into more than two mutually exclusive categories
- Assigning multiple non-exclusive labels to a single text instance (Correct answer)
- Using multiple classifiers and voting on the final output
- Breaking text into labeled spans for sequence tagging
Correct answer: Assigning multiple non-exclusive labels to a single text instance
Multi-label classification allows each document to belong to several categories simultaneously, such as a news article tagged as both 'politics' and 'economy'.
Question 5: In the Bag-of-Words (BoW) model for text classification, which information is explicitly discarded?
- Word frequency
- Word order and syntax (Correct answer)
- Document length
- Vocabulary size
Correct answer: Word order and syntax
The BoW model treats a document as an unordered set of word counts, discarding grammatical structure, word order, and context.
Question 6: Which deep learning architecture introduced the concept of self-attention that dramatically improved text classification benchmarks?
- Recurrent Neural Network (RNN)
- Convolutional Neural Network (CNN)
- Transformer (Correct answer)
- Long Short-Term Memory (LSTM)
Correct answer: Transformer
The Transformer architecture uses self-attention mechanisms to capture long-range dependencies in text, enabling models like BERT to achieve state-of-the-art classification results.
Question 7: What does 'zero-shot text classification' mean in the context of modern NLP?
- Training a model with no labeled data using only rule-based methods
- Classifying text into categories that were not seen during model training (Correct answer)
- Using zero regularization to prevent overfitting in classifiers
- Classifying text with 100% accuracy without any errors
Correct answer: Classifying text into categories that were not seen during model training
Zero-shot classification leverages large pre-trained language models to assign labels to new, unseen categories by understanding the semantic meaning of the label names.
Which machine learning algorithm is considered a generative classifier commonly used for text classification due to its simplicity and strong baseline performance?