Inspiration
I was inspired by the fact that I get many spam messages and emails on a daily basis and sometimes it's hard to tell whether the message/email is truly spam, or just a mistake.
What it does
In the Smart Spam Message Detector, you can copy and paste a message that you think is spam and it can determine whether the message is spam or legitimate.
How we built it
I used a Kaggle SMS dataset that separated spam from "ham" (legitimate messages) . I cleaned the text (lowercasing, removing noise, punctuation, and stop words). I converted numbers to their numeric features using Term Frequency - Inverse Document Frequency, and added n-grams to capture specific word phrases like "free entry". I trained the model with Naive Bayes as a baseline before using an improved version using Logistic Regression. I split the datasets into train and tests (80/20) and evaluated based on accuracy, precision, recall, and F1-score. I saved the model using Joblib, which I found by searching up, and exposed predictions via FastAPI backend. I built an interactive UI using StreamLit.
Challenges we ran into
I had trouble cleaning noisy preprocessing text, balancing precision and recall, NLTK setup issues, SSL certificate errors, and connecting ML model and Streamlit front-end without breaking any data points. I debugged the code with the help of ChatGPT and also used it to look up the correct terminal prompts in VS code.
Accomplishments that we're proud of
I'm definitely proud of making this end to end ML pipeline as it isn't really something I've done before. I also improved my model and tried to make it better than the baseline.
What we learned
I realized that evaluation metrics like precision and recall matter more than just accuracy in real-world problems. I learned how to take a raw dataset into a fully developed AI system.
What's next for Smart Spam Message Detector
It's currently constrained to English but I might be able to make it work for other languages. I also would like to improve it's accuracy, and enhance preprocessing by handling emojis, slang, and context in the messages.
Built With
- fastapi
- joblib
- kaggle
- logisticregression
- nltk
- pandas
- python
- scikit-learn
- streamlit
- uvicorn
Log in or sign up for Devpost to join the conversation.