Artificial Intelligence · NLP
Detect spam messages with a text classifier
Train a model on a public SMS dataset to separate spam from normal messages.
- DifficultyIntermediate
- Estimated time1–2 weeks
- Budget₹0
- ClassClass 11 to college
- TeamSolo or up to 2
- You needComputer only
Prerequisites: Python basics; some pandas helps
Original · by TechnifyedAI/ML ProjectPortfolio ProjectFree to doComputer onlyPortfolio focusedWell documented
Overview
A public dataset of about 5,500 labelled SMS messages is enough to train a classifier that catches most spam. You turn each message into word counts and train a naive Bayes model.
Why build this?
It is a real product feature, and it teaches why accuracy alone is misleading when one class is rare.
What you will learn
- How to turn text into numbers
- How naive Bayes classifies
- Why precision and recall matter more than accuracy here
- How to read which words drive a decision
Skills you will use
Materials and tools
- Computer with Python 3
- scikit-learn
- A public SMS spam dataset
Tools and software
Step-by-step roadmap
Start
You will finish with: a classifier with its metrics, the top spam words and examples of mistakes.
- 1
Prerequisites
Know this first: python basics; some pandas helps. Then collect the 3 items in the materials list.
- 2
Learn
- How to turn text into numbers
- How naive Bayes classifies
- Why precision and recall matter more than accuracy here
- How to read which words drive a decision
- 3
Plan
List the features for version one, sketch the screens or data flow and pick the tools. Keep the first version small.
- 4
Build
- Load the dataset and count spam and normal messages.
- Clean the text: lower case and remove punctuation.
- Convert messages to word-count vectors.
- Train naive Bayes on 80 percent and test on 20 percent.
- Report precision, recall and the confusion matrix.
- List the ten words that most indicate spam.
- 5
Test
Type five messages of your own, including a tricky one, and check the predictions.
- 6
Document
Write a README: what it does, how to run it, screenshots and what you learned. Report structure
- 7
Present
Show a live demo of one complete task, then the design and the hardest problem you solved. Presentation structure · Viva questions
- 8
Publish
Put the code on GitHub with the README and, if you can, deploy a live demo.
Expected outcome
A classifier with its metrics, the top spam words and examples of mistakes.
Other versions of this project
Beginner version
Count spam words by hand in 50 messages and write a rule-based filter.
Advanced version
Compare naive Bayes with logistic regression and TF-IDF features.
Research version
Test how well the model works on messages from a different year or country and discuss why it degrades.
Portfolio version
Wrap it in a small web page where anyone can paste a message.
Make this project better
- BasicCount spam words by hand in 50 messages and write a rule-based filter.
- This projectDetect spam messages with a text classifier
- AdvancedCompare naive Bayes with logistic regression and TF-IDF features.
- ResearchTest how well the model works on messages from a different year or country and discuss why it degrades.
- PortfolioWrap it in a small web page where anyone can paste a message.
Ways to do this project
Text marked "You write this" is a prompt for your own work; everything else is specific to this project.
- Research question
- You write thisOne question you can answer with data, narrow enough to finish in the time you have.
- Hypothesis
- You write thisWhat you expect to find, and why.
- Variables
- You write thisWhat you change or compare, what you measure, and what you hold constant.
- Methodology
- Test how well the model works on messages from a different year or country and discuss why it degrades.
- Data collection
- You write thisSay what you will record, how many times, and how you will keep the records safe.
- Analysis
- You write thisChoose the table, chart or test that answers the question; report averages with their spread.
- Limitations
- You write thisList what could have affected the result: small sample, instrument limits, things you could not control.
Literature review
Find five to eight sources (your textbook, review articles, reports) and note what each says about your question. Group them by idea, not one after another, and end with what is still not known.
References
List every source you used in one style throughout (author, year, title, where it was published, link and the date you opened it).
Use this as the outline of your README or case study.
- Problem
- A public dataset of about 5,500 labelled SMS messages is enough to train a classifier that catches most spam.
- Why it matters
- It is a real product feature, and it teaches why accuracy alone is misleading when one class is rare.
- What was built
- A classifier with its metrics, the top spam words and examples of mistakes.
- Technology
- pandas, Python, scikit-learn
- Architecture
- You write thisOne diagram: the parts and how data moves between them.
- Implementation
- You write thisThe 6 build steps in your own words, with one code or design decision you are proud of.
- Challenges
- You write thisThe hardest bug or decision, and how you got past it.
- Results
- Type five messages of your own, including a tricky one, and check the predictions.
- Demo and code
- You write thisA link to a live demo or a short video, and to the GitHub repository.
- Lessons learned
- You write thisWhat you would do differently next time.
- Future improvements
- Compare naive Bayes with logistic regression and TF-IDF features.
- Problem
- A public dataset of about 5,500 labelled SMS messages is enough to train a classifier that catches most spam.
- Target user
- You write thisOne specific person: who they are and when they would use this.
- Solution
- Train a model on a public SMS dataset to separate spam from normal messages.
- First version (MVP)
- Count spam words by hand in 50 messages and write a rule-based filter.
- Tech stack
- pandas, Python, scikit-learn
- Architecture
- You write thisA quick sketch of the parts and how they connect.
- Demo
- Type five messages of your own, including a tricky one, and check the predictions.
- Stretch goals
- Compare naive Bayes with logistic regression and TF-IDF features.
Team roles
Plan by length
24-hour
- Hours 0–2: agree the problem, the user and the one thing the demo must show
- Hours 2–16: build only the first version
- Hours 16–20: test the demo path end to end and fix what breaks
- Hours 20–24: slides, a 2-minute demo script and a backup recording
48-hour
- Evening 1: problem, user, sketch and task split
- Day 1: first version working end to end
- Day 2 morning: one stretch goal and testing
- Day 2 afternoon: polish, slides and demo practice
1-week
- Day 1: research the problem and talk to two possible users
- Days 2–4: first version
- Day 5: stretch goals
- Day 6: testing and write-up
- Day 7: demo video and presentation
Working as a team
Solo or up to 2. Suggested roles:
Report and presentation
Report structure
- Title and summary
- Problem and target user
- Features
- Tools and technology
- Design: architecture, data model or screens
- Implementation
- Testing
- Results and screenshots
- Challenges
- Future improvements
- References
Presentation structure
- The problem
- Who it is for
- Live demo
- How it is built (one diagram)
- The hardest part
- Testing and results
- What you learned
- What comes next
Viva questions
Try answering before you open each one.
Why is accuracy misleading here?
About 87 percent of messages are not spam, so always guessing "not spam" already scores 87 percent.
What is precision?
Of the messages flagged as spam, the share that really are spam.
What is recall?
Of all real spam, the share the model caught.
Which mistake is worse?
Marking a real message as spam, because the user may never see it.
Resources
Source and attribution
Original
Written by Technifyed. Free to use for your own school or college project; write the report in your own words. Added 1 Oct 2026.
Similar projects
More Artificial Intelligence projects
Artificial Intelligence · NLP
Summarise long articles with extractive methods
Pick the most important sentences of an article using word frequency and TextRank.
Artificial Intelligence + EdTech and Study Tools
Build a plagiarism checker for assignments
Compare a set of documents pairwise and highlight overlapping passages.
Artificial Intelligence · NLP
Analyse sentiment in product reviews
Train a model to label reviews positive or negative and study what it gets wrong.
Artificial Intelligence · NLP
Build a rule-based chatbot for school FAQs
Answer common questions about your school with keyword matching and a fallback reply.
Same tools
Physics + Programming
Simulate projectile motion with air drag in Python
Plot real trajectories with air resistance and compare them with the textbook parabola.
Artificial Intelligence · Deep Learning
Classify handwritten digits with a neural network
Train a small neural network on the MNIST digits and study where it goes wrong.
Literature and English + Data
Analyse word use in a novel with a computer
Count words and character mentions in a public-domain novel and see what the numbers reveal.
Games, Graphics and New Tech · Blockchain
Build a simple blockchain
Implement blocks, hashes, proof of work and validation to see how a chain resists tampering.
Two-subject alternatives
Agricultural Technology + Artificial Intelligence
Monitor crop health with phone photographs
Photograph leaves weekly under the same conditions and track greenness as a sign of health.
Languages and Linguistics + Artificial Intelligence
Compare human and computer translation
Translate ten sentences yourself and with a free online tool and classify the differences.
Same difficulty and budget
Robotics, IoT and Hardware + Mechanical Engineering
Design a mechanical part in CAD and simulate its stress
Model a bracket, apply a load in simulation and redesign it to be lighter and still strong.
Software Development · Mobile Apps
Build a habit tracker with streaks
Create an Android app to tick off daily habits and see streaks and a calendar heat map.
Data + Operations, HR and Supply Chain
Build a sales dashboard
Turn a public retail dataset into a one-page dashboard that answers a manager's questions.
Artificial Intelligence + Marketing
Cluster customers into groups
Group customers by spending behaviour with k-means and describe each group in plain words.