This project detects phishing emails using machine learning by analyzing textual content.
It uses TF-IDF vectorization and a Naive Bayes classifier to classify emails as phishing or legitimate.
Phishing emails are a major cybersecurity threat, often used to steal credentials or sensitive information.
Detecting them automatically is critical for improving email security systems.
-
Source: Kaggle phishing email dataset
-
Multiple datasets combined (Enron, SpamAssassin, etc.)
-
Text column:
text_combined -
Labels:
0→ Legitimate1→ Phishing
- Train-test split (80/20, stratified)
- Text cleaned and vectorized using TF-IDF
-
TF-IDF with:
- Stopword removal
- Max features: 5000
- Multinomial Naive Bayes
- Trained on TF-IDF features
Accuracy: 96%
Precision (Phishing): 0.98
Recall (Phishing): 0.95
F1-score: 0.96
👉 Strong performance with balanced precision and recall.
Input:
"Urgent! Your bank account has been suspended. Click here to verify your password."
Output:
Prediction: Phishing
Confidence: 0.988
Input:
"Hi team, please find attached the meeting agenda for tomorrow."
Output:
Prediction: Legitimate
Confidence: 0.993
- Python
- scikit-learn
- Pandas / NumPy
- TF-IDF Vectorization
pip install pandas scikit-learn kagglehub
python main.py- Try advanced models (Random Forest, XGBoost, Transformers)
- Deploy as API for real-time email scanning
- Build browser/email client integration
- Add explainability (why classified as phishing)
- Demonstrates applied machine learning
- Real-world cybersecurity use case
- End-to-end pipeline: data → model → evaluation
Sanju – ML + Cybersecurity focused developer