×Full view
Back to Portfolio

// Machine Learning · NLP · Python · Scikit-learn

Phishing Email Detection

ML model trained on 200K+ emails to detect phishing — NLP preprocessing pipeline, TF-IDF features, and optimized classification with Scikit-learn.

Type: ML / NLP
Stack: Python · Scikit-learn

Overview

A supervised machine learning classifier that identifies phishing emails from legitimate ones. Trained on a dataset of 200K+ labeled emails, the pipeline covers full NLP preprocessing (tokenization, stopword removal, stemming), TF-IDF vectorization, and multiple classifier evaluations — ultimately selecting a tuned model based on F1 score to minimize false negatives.

Tech Stack

PythonScikit-learnNLPTF-IDFNLTKPandasMatplotlib

Key Contributions

  • Built end-to-end NLP pipeline: HTML stripping, tokenization, stopword removal, Porter stemming, and TF-IDF vectorization.
  • Evaluated Naive Bayes, Logistic Regression, Random Forest, and SVM — selected best by F1 on held-out test set.
  • Feature engineering beyond bag-of-words: URL count, sender domain reputation, urgency keyword density.
  • Handled severe class imbalance (15% phishing) with SMOTE oversampling on training set.
  • Exported model as serialized joblib artifact for deployment in a Flask prediction API.

Screenshots

Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot Screenshot

Results

The engineered features (URL count, urgency words) boosted F1 by 6 percentage points over pure TF-IDF alone — proving domain knowledge still matters even with large datasets.