Overview: What We Are Building
In this module we build a complete, real AI application from scratch in Python. You will load data, train a machine learning model, evaluate it, and use it to make predictions on new inputs.
The Project: Spam Email Classifier
We will build a spam email classifier. Given the text of an email, the classifier predicts whether it is spam or not spam.
This is a classic, practical machine learning project. The same techniques are used in real email systems.
What you will do:
1. Load and explore email data
2. Convert text to numerical features
3. Train a Naive Bayes classifier
4. Evaluate the model
5. Make predictions on new emails
6. Understand how to improve the model
This uses real Python libraries: pandas, scikit-learn, and the standard library.
Deep Learning ⊂ Machine Learning ⊂ Artificial Intelligence
Tools We Will Use
- Python: the programming language for AI and data science
- pandas: load and process tabular data
- scikit-learn: the most popular Python ML library. Contains dozens of algorithms ready to use
- CountVectorizer (scikit-learn): converts text into word count features
- MultinomialNB (scikit-learn): Naive Bayes classifier, great for text classification
- train_test_split (scikit-learn): splits data into training and testing sets
- classification_report (scikit-learn): shows accuracy, precision, recall, and F1 for each class
Installation
# Install required libraries (run once in your terminal)
# pip install pandas scikit-learn
# Verify your installation
try:
import pandas
import sklearn
print(f"pandas version: {pandas.__version__}")
print(f"scikit-learn version: {sklearn.__version__}")
print("All libraries installed correctly!")
except ImportError as e:
print(f"Missing library: {e}")
print("Run: pip install pandas scikit-learn")Tip
Tip
If you do not have Python installed, use Google Colab (colab.research.google.com). It is free, runs in your browser, and has all the required libraries pre-installed. You can run every code example in this module directly in Colab without installing anything.
Key Takeaways
- In this module we build a complete, real AI application from scratch in Python.
- Python: the programming language for AI and data science
- pandas: load and process tabular data
- scikit-learn: the most popular Python ML library. Contains dozens of algorithms ready to use