Model description
This is a Decision tree model trained on a phishing URL detection dataset. The dataset contains features from URLs and their webpage content. The model is trained to classify whether a website is legitimate (label 1) or an act of phishing (label 0).
Intended uses & limitations
This model is made for educational purposes and is not ready to be used in production.
Training Procedure
With this dataset, I will be using a decision tree to predict whether certain websites are legitimate or an act of phishing. This is because Naive Bayes assumes feature independence, which is not true for this case. Decision trees split data based on actual patterns, which is useful for phishing detection.
Overall, the data does not meet the criteria for Naive Bayes because the features are not independent.
Using decision trees for this case is crucial because it offers clear interpretability of the classification logic. It will be able to differentiate legitimate vs illegitimate websites.
How to use the model
In your notebook, paste the following code:
from huggingface_hub import hf_hub_download
hf_hub_download(repo_id="CSC310-fall25/training_classification_phishing", filename="model.pkl",local_dir='.')
dt_loaded = sio.load('model.pkl')
This will load the model.
You can download the appropriate test data by pasting this code:
hf_hub_download(repo_id="CSC310-fall25/training_classification_phishing", filename="phishing_test.csv",local_dir='.')
phishing_test = pd.read_csv('phishing_test.csv')
Dataset Details
Dataset Characteristics: Tabular
Associated Tasks: Classification
Number of Features: 54
Number of Instances: 235795
Feature Type: Real, Categorical, Integer
Hyperparameters
Click to expand
| Hyperparameter | Value |
|---|---|
| ccp_alpha | 0.0 |
| class_weight | None |
| criterion | gini |
| max_depth | 2 |
| max_features | None |
| max_leaf_nodes | None |
| min_impurity_decrease | 0.0 |
| min_samples_leaf | 0.2 |
| min_samples_split | 0.2 |
| min_weight_fraction_leaf | 0.0 |
| monotonic_cst | None |
| random_state | 67 |
| splitter | random |
Model Plot
DecisionTreeClassifier(max_depth=2, min_samples_leaf=0.2, min_samples_split=0.2,random_state=67, splitter='random')In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.
DecisionTreeClassifier(max_depth=2, min_samples_leaf=0.2, min_samples_split=0.2,random_state=67, splitter='random')
Evaluation Results
precision recall f1-score support
0 1.00 0.74 0.85 20189
1 0.84 1.00 0.91 26970
accuracy 0.89 47159
macro avg 0.92 0.87 0.88 47159
weighted avg 0.91 0.89 0.88 47159
The overall accuracy of the model was 89%. For Class 0, the precision score was 100%, meaning it was able to predict every phishing website correctly. Its recall score was 74%, meaning it missed about 26% of actual phishing samples. For Class 1, its precision score was 84% and its recall score was 100%. This shows that the model leans toward predicting '1,' while favoring recall rather than precision.
The model could possibly be used for real scenarios, but not for high risk use. It would be helpful in situations where you only need a general screening of phishing vs legitimate websites. So although it is accurate, it is not accurate enough. However, I would still trust this model. It performs well and behaves predictably. If more precision/recall is needed, then it would certainly make sense to use a more complex model. It all depends on what the model is being used for.
Visualization
plt.figure(figsize=(15,20))
tree.plot_tree(dt, rounded =True, class_names = ['0','1'], proportion=True, filled =True, impurity=False,fontsize=10);
Model Card Authors
Anthony Martinez
Model Card Contact
You can contact the model card authors through following channels: [email protected]
Citation
Dataset: https://archive.ics.uci.edu/dataset/967/phiusiil+phishing+url+dataset
- Downloads last month
- 5
