This project focuses on building a Machine Learning model capable of accurately detecting phishing websites using URL and webpage-based features. By leveraging supervised learning algorithms and comprehensive exploratory data analysis (EDA), the project aims to improve cybersecurity by automatically distinguishing phishing websites from legitimate ones.
The complete workflow includes data preprocessing, visualization, feature engineering, model training, evaluation, cross-validation, and feature importance analysis to identify the most effective phishing detection model.
Anti-phishing refers to techniques used to prevent phishing attacks.
Phishing is a type of cybercrime where attackers impersonate trusted organizations through emails, SMS, or websites to trick users into revealing sensitive information such as:
- Login credentials
- Banking information
- Credit card details
- Personal identity information
Once collected, attackers may steal identities, compromise accounts, or install malware.
The dataset contains:
- 10,000 total webpages
- 5,000 Phishing Websites
- 5,000 Legitimate Websites
Feature extraction was performed using Selenium WebDriver, providing a more robust and reliable approach than traditional regex-based extraction methods.
- Collection Period:
- JanuaryβMay 2015
- MayβJune 2017
The dataset contains:
- 48 engineered features
- Binary classification target
- Suitable for:
- Machine Learning
- Cybersecurity Research
- Classification Benchmarking
- Feature Importance Analysis
Develop a Machine Learning model that accurately identifies phishing websites using URL-based and webpage features to improve cybersecurity and protect users from malicious attacks.
- NumPy
- Pandas
- Matplotlib
- Seaborn
- Scikit-Learn
- Import phishing dataset
- Inspect dataset dimensions
- Verify successful loading
Performed:
- Missing Value Analysis
- Duplicate Check
- Data Types
- Dataset Information
- Statistical Summary
Identified the dependent variable:
- Phishing
- Legitimate
Verified class labels before training.
Performed:
- Feature Encoding
- Standardization
- Data Validation
- Feature Selection Preparation
Analyzed:
- Class Distribution
- Dataset Balance
- Feature Relationships
- Outliers
- Feature Trends
Visualizations included:
- Countplots
- Histograms
- Boxplots
- Heatmaps
- Correlation Matrix
Studied relationships among numerical features using:
- Pearson Correlation
- Correlation Heatmap
This helped identify:
- Highly correlated variables
- Redundant features
- Strong predictive indicators
Compared major phishing indicators such as:
- URL Length
- HTTPS Presence
- Domain Features
- Redirects
- Suspicious URL Patterns
Reduced noise by retaining the most informative predictors to improve:
- Model accuracy
- Generalization
- Training efficiency
Prepared the dataset using:
- Training Set
- Testing Set
Ensuring unbiased evaluation.
Implemented multiple classification models:
- Logistic Regression
- Decision Tree Classifier
- Random Forest Classifier
Each model was trained using a consistent preprocessing pipeline.
Evaluated using:
- Accuracy
- Precision
- Recall
- F1-Score
- ROC-AUC Score
- Confusion Matrix
- Classification Report
Best Performing Model: π Random Forest Classifier
Compared model consistency using Cross Validation.
Random Forest demonstrated the highest and most stable validation performance.
Tree-based feature importance identified the strongest phishing indicators, including:
- URL Length
- HTTPS Status
- Domain Characteristics
- URL Structure
- Security Features
Saved the best-performing model for future deployment and real-time phishing website detection.
| Model | Performance |
|---|---|
| Logistic Regression | Good Baseline Performance |
| Decision Tree | Strong Performance |
| β Random Forest | Best Overall Performance |
Random Forest achieved the highest F1-Score and ROC-AUC, making it the most reliable model for phishing website detection.
- The dataset is well-balanced with equal phishing and legitimate samples.
- URL characteristics are among the strongest indicators of phishing.
- HTTPS usage significantly influences website legitimacy.
- Tree-based ensemble methods outperform simpler linear models.
- Feature engineering substantially improves classification performance.
- Cross-validation confirms Random Forest's robustness and stability.
- Feature importance analysis enhances model interpretability.
Phishing-Dataset-for-Machine-Learning/
β
βββ Dataset/
β βββ phishing_dataset.csv
β
βββ Notebook/
β βββ Phishing_Detection.ipynb
β
βββ Images/
β βββ Class_Distribution.png
β βββ Correlation_Heatmap.png
β βββ Feature_Importance.png
β βββ Confusion_Matrix.png
β
βββ Model/
β βββ phishing_model.pkl
β
βββ requirements.txt
βββ README.md
- XGBoost & LightGBM implementation
- Hyperparameter Optimization
- Explainable AI using SHAP
- Real-time URL Prediction API
- Flask/FastAPI Deployment
- Streamlit Dashboard
- Browser Extension for Live Phishing Detection
- Python
- NumPy
- Pandas
- Matplotlib
- Seaborn
- Scikit-learn
- Joblib
This project demonstrates an end-to-end Machine Learning pipeline for phishing website detection, from raw data analysis to deployment-ready model creation. Among all evaluated algorithms, Random Forest Classifier consistently delivered the strongest performance across F1-score, ROC-AUC, and cross-validation, making it the optimal choice for phishing classification. The project showcases practical applications of data preprocessing, EDA, feature engineering, model evaluation, and cybersecurity analytics, forming a strong portfolio project for Data Science and Machine Learning roles.
Arpan Ghosal
Junior Data Scientist
If you found this project helpful, consider β starring the repository to support the project.