Classification
An AI task that assigns input to predefined categories. Spam detection, sentiment analysis, and image recognition are all classification tasks.
Classification is a fundamental machine learning task where the model assigns input data to one or more predefined categories. When your email app separates spam from legitimate messages, when a customer review is tagged as positive or negative, or when an image is identified as containing a specific object — that is classification.
How classification works
A classification model learns from labelled examples:
- You provide the model with training data — inputs paired with their correct categories
- The model identifies patterns that distinguish one category from another
- When given new, unseen input, the model predicts which category it belongs to
The model outputs a probability for each possible category. "93% likely spam, 7% likely not spam." You set a threshold for making the final decision.
Types of classification
- Binary classification: Two possible outcomes. Spam or not spam. Fraudulent or legitimate. Positive or negative. This is the most common type.
- Multi-class classification: Multiple possible outcomes. Routing a support ticket to the correct department (billing, technical, sales, shipping). Identifying a language (English, French, Spanish, German).
- Multi-label classification: Multiple categories can apply to one input. A news article might be tagged as both "technology" and "business." A product image might contain both "shoes" and "accessories."
Classification in everyday business
Classification powers many business processes you interact with daily:
- Email filtering: Inbox categorisation (primary, social, promotions, spam)
- Customer feedback analysis: Categorising reviews, survey responses, and support tickets by topic and sentiment
- Document routing: Automatically directing incoming documents to the right department
- Content moderation: Identifying inappropriate content on platforms
- Lead scoring: Classifying sales leads as hot, warm, or cold
- Risk assessment: Categorising loan applications, insurance claims, or compliance cases by risk level
- Medical imaging: Identifying potential conditions in X-rays or scans
Classification with LLMs
Before LLMs, building a classifier required:
- Collecting thousands of labelled examples
- Training a specialised model
- Evaluating and refining the model
- Deploying and maintaining it
This process took weeks or months. LLMs have dramatically simplified classification:
- Zero-shot: Ask Claude "Is this email spam?" — no examples needed
- Few-shot: Provide 3-5 examples of each category, then ask Claude to classify new items
- System prompt: Define your categories and classification rules in a system prompt
For many business classification tasks, LLM-based approaches deliver 90%+ accuracy without any model training. For tasks requiring very high accuracy or processing millions of items cost-effectively, custom-trained classifiers still have their place.
Evaluation metrics
When evaluating a classifier, accuracy alone is not enough. Key metrics include:
- Precision: Of items the model classified as positive, what percentage actually were? (Avoiding false positives)
- Recall: Of all actual positives, what percentage did the model catch? (Avoiding false negatives)
- F1 score: The balance between precision and recall
The right metric depends on the cost of errors. For spam detection, some false positives (legitimate emails marked as spam) are acceptable. For fraud detection, missing a real case of fraud (false negative) is far more costly.
Why This Matters
Classification is one of the most immediately applicable AI capabilities for any business. If your team spends time manually sorting, categorising, or routing items — emails, documents, support tickets, feedback, leads — classification can automate much of that work. Understanding classification helps you identify these opportunities and evaluate whether an LLM-based approach or a custom model is the right solution for each case.
Related Terms
Continue learning in Foundations
This topic is covered in our lesson: AI vs Machine Learning vs Deep Learning