Document Classification

Author

Daanish Rasheed

Approach

I will train a classifier predicting whether the email is spam or ham based on the labeled dataset of spam and ham emails available at its GitHub URL address: https://raw.githubusercontent.com/thehananbhat/spam-vs-ham/refs/heads/main/spam_ham_dataset.csv. After exploring the data distribution and dropping duplicate examples, I will use 20% of the emails as a testing set.

In the training set alone, I will remove punctuation, digits, stopwords, extremely rare words and form the document-term matrix. The test set will be encoded according to the training vocabulary. Naive Bayes will be the first classifier; the logistic regression can be used for comparisons as an alternative.

The performance will be measured in terms of the confusion matrix and precision, recall, and F1 metrics on the test set with false positives treated as more costly errors. I will analyze the top predictors and a couple of misclassification cases. Also, I will try to predict some unseen emails, including my spam emails.