AI Report
AI Report
Application
In this report, one of the applications of AI is explained. Email spam filter
is an AI application which can be used in big work fields such as
universities and big companies, such feature saves time and effort to
remove unneeded emails.
Simulation
Our work is done using a colab application using python code. the code is
as follows:
# Step 1: Import necessary libraries
import pandas as pd
# Replace the path below with your actual file path in Colab
data = pd.read_csv(csv_path)
X = data['text']
y = data['label_num']
X_tfidf = vectorizer.fit_transform(X)
model = MultinomialNB( )
model.fit(X_train, y_train)
y_pred = model.predict(X_test)
accuracy = accuracy_score(y_test, y_pred)
print("\nClassification Report:\n")
print(report)
disp.plot(cmap='Blues')
plt.title("Confusion Matrix")
plt.show()
plt.figure()
plt.legend(loc="lower right")
plt.grid()
plt.show()
plt.xlabel("Recall")
plt.ylabel("Precision")
plt.title("Precision-Recall Curve")
plt.legend(loc="lower left")
plt.grid()
plt.show()
def classify_email(email_text):
# Example usage
classification = classify_email(example_email)
classification
Results
1. Accuracy
2. Confusion Matrix
3. ROC Curve
4. Precision and Recall curve