Downloads · 30 days
0
shmaisanymostafa/Phishing-Detection
Phishing-Detection is a machine learning model from shmaisanymostafa. Use it for the machine learning task on the model card, and read the license before you ship it in a product. It is set up for sklearn. The card lists the license as mit.
This model is a phishing detection classifier built using TF-IDF for feature extraction and Logistic Regression for classification. It processes text data to identify phishing attempts with high accuracy.
Downloads · 30 days
0
Access
Public
Updated Jan 24, 2025
Repo size
221 KB
Likes
1
Public
Click a slice to open those files.
.joblib221 KB · 98%
From the Hugging Face model README
This model is a phishing detection classifier built using TF-IDF for feature extraction and Logistic Regression for classification. It processes text data to identify phishing attempts with high accuracy.
Before using the model, ensure you have the necessary dependencies installed:
pip install scikit-learn
pip install -U "tensorflow-text==2.13.*"
pip install "tf-models-official==2.13.*"
pip uninstall -y pyarrow datasets
pip install pyarrow datasets
Below is an example of how to train and evaluate the model:
from datasets import load_dataset
from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split
from sklearn.metrics import accuracy_score
# Load the dataset
dataset_reduced = load_dataset("ealvaradob/phishing-dataset", "combined_reduced", trust_remote_code=True)
# Convert to pandas DataFrame
df = dataset_reduced['train'].to_pandas()
# Extract text and labels
text = df['text'].values
labels = df['label'].values
# Split the data into train and test sets
train_text, test_text, train_labels, test_labels = train_test_split(
text, labels, test_size=0.2, random_state=42
)
# Create and fit the TF-IDF vectorizer
vectorizer = TfidfVectorizer(max_features=5000)
vectorizer.fit(train_text)
# Transform the text data into numerical features
train_features = vectorizer.transform(train_text)
test_features = vectorizer.transform(test_text)
# Create and train the logistic regression model
model = LogisticRegression()
model.fit(train_features, train_labels)
# Make predictions on the test set
predictions = model.predict(test_features)
# Evaluate the model's accuracy
accuracy = accuracy_score(test_labels, predictions)
print(f'Accuracy: {accuracy}')
{{accuracy}} on the test set.The dataset used for training and evaluation is the ealvaradob/phishing-dataset. It contains a variety of phishing and non-phishing samples labeled as 1 (phishing) and 0 (non-phishing).
This project is licensed under the MIT License. Feel free to use, modify, and distribute this model as per the terms of the license.