Back to the 2023 paper

Module 3: Classification Algorithms

20232m

Which of the following is the best algorithm for text classification?
(i) KNN -
(ii) Decision tree
(iii) Random forest
(iv) Naive Bayes

Worked SolutionAI Assisted

Answer: (iv) Naive Bayes — generally considered best baseline for text classification, though context dependent.

Explanation:

  • Naive Bayes (Multinomial/Bernoulli): Highly effective for high-dimensional sparse text (Bag-of-Words / TF-IDF). Fast, works well with small data, handles thousands of features, empirically strong for spam, sentiment, topic classification. Assumption of conditional independence of words given class surprisingly works well in practice.
  • KNN: Lazy, computationally expensive at inference, suffers from curse of dimensionality in text.
  • Decision Tree: Prone to overfit on sparse text, not ideal.
  • Random Forest: Better than single tree but slower and often still outperformed by NB/SVM for raw text without embeddings.

In modern deep learning era, Transformers/BERT outperform all, but among given classical options, Naive Bayes (and Linear SVM — not listed) is textbook best for text. Some keys may accept Random Forest as competitive, but traditional exam answer is (iv) Naive Bayes.

Similar questions

Budget AppAndroid App

Pocketly on Android

Log daily food, travel, and hostel expenses instantly. Set monthly spending limits and see where your money goes without complex spreadsheets.