Types of Machine Learning
The Machine Learning Landscape
Machine learning algorithms are usually grouped by the kind of data they learn from and the kind of feedback they receive.
The main types are:
- Supervised learning, which learns from labeled data
- Unsupervised learning, which finds patterns in unlabeled data
- Semi-supervised learning, which combines a little labeled data with a lot of unlabeled data
- Reinforcement learning, which learns from rewards and penalties
Supervised learning is further divided into regression and classification.
Unsupervised learning includes techniques such as clustering and dimensionality reduction.
This lesson gives a brief overview of each one.
Supervised Learning
In supervised learning, we train a model using labeled examples.
Imagine giving a model many pictures of cats and dogs, where each picture is labeled either "cat" or "dog".
The model learns to predict which is which. After training, if you give it a new image, it predicts whether that image shows a cat or a dog.
The goal is to learn a mapping from input to output, where the output is the label.
Common examples include:
- Predicting house prices
- Email spam detection
- Image classification
- Speech recognition
There are two main types of supervised learning: regression and classification.
Regression
Regression is a supervised learning technique that predicts continuous values, or real numbers.
Examples of continuous values include:
- House prices
- Temperature
- Stock prices
- Age
For example, a regression model could predict the price of a house based on its size.
Classification
Classification predicts labels, or discrete categories.
Examples include:
- Whether an email is spam or not spam
- Whether an image shows a dog or a cat
- Whether the sentiment of a text is positive, negative, or neutral
- Whether someone has a disease or not
For example, given an input email, a model predicts whether that email is spam or not spam.
The output here is not a continuous value. It is one of a fixed set of categories.
| Regression | Classification | |
|---|---|---|
| Output | Continuous value | Discrete category |
| Example question | What will this house sell for? | Is this email spam? |
| Example output | A price (e.g., ₹50 lakh) | Spam or Not Spam |
Unsupervised Learning
In unsupervised learning, the data has no labels. The model tries to find hidden patterns on its own.
For example, you could feed in customer data without telling the model anything about it, and the model would discover groups of similar customers automatically.
The goal is to find structure or patterns in the data.
Unsupervised learning can be used for:
- Grouping similar users, such as customer segmentation
- Finding anomalies, such as fraud detection
- Compressing data, such as dimensionality reduction
- Discovering hidden trends in the data
Two common types of unsupervised learning are clustering and dimensionality reduction.
Clustering
Clustering is the task of grouping similar data points into clusters without using labels.
Suppose we have raw, unlabeled images of different fruits. A clustering algorithm can separate them into groups of similar fruits, even though nobody told it what the fruits are.
How Clustering Works
- The algorithm measures the similarity or distance between data points.
- Points that are close to each other are grouped together.
- The output is the same data, organized into clusters.
The model doesn't know the correct number or type of groups beforehand unless we specify it manually. This means clustering usually involves some experimentation.
Common Algorithms
- K-means clustering
- Hierarchical clustering
- DBSCAN
- Gaussian mixture models
Applications
- Customer segmentation for marketing
- Grouping documents or news articles
- Grouping images based on similarity
Dimensionality Reduction
Dimensionality reduction reduces the number of features while keeping the important information.
It helps to:
- Simplify datasets
- Speed up computation
- Remove noise
For example, data in three dimensions can be reduced to two dimensions, or even one, while preserving as much of the important information as possible.
How Dimensionality Reduction Works
The technique finds a new, compact representation of the data. It keeps as much of the data's structure or variance as possible.
Applications
- Reducing high-dimensional gene expression data
- Visualizing high-dimensional data in 2D or 3D, since we can't visualize more than three dimensions
- Removing irrelevant or noisy features that the model doesn't need
Common Algorithms
- Principal component analysis (PCA)
- t-SNE
- UMAP
- Autoencoders
Semi-Supervised Learning
Semi-supervised learning trains a model using a small amount of labeled data together with a large amount of unlabeled data.
Why We Need It
Labeling data can be expensive and time-consuming, and it can require domain expertise. Medical images, legal documents, and financial documents all need experts and manual effort to label.
Unlabeled data, on the other hand, is usually available in huge quantities. Semi-supervised learning lets us make use of it.
How Semi-Supervised Learning Works
- Provide the model with a few labeled examples, such as a handful of labeled fruit images.
- Add many unlabeled examples.
- The model learns the general structure from the unlabeled data, then adjusts its understanding using the few labeled samples.
After training, if we give the model a new image, it can predict whether that image is an apple, an orange, or a banana.
Semi-supervised learning takes advantage of both worlds:
- The accuracy boost that comes from labeled examples
- The patterns and structure available in unlabeled data
Benefits
- It significantly reduces the cost of labeling or annotating data.
- It often performs better than using only the labeled data.
- It is useful when labeled data is scarce but unlabeled data is abundant.
Real-World Examples
- Email spam detection
- Text classification, where most text isn't labeled
- Image recognition with only a small percentage of tagged images
- Medical diagnosis systems with limited annotated data
Common Techniques
- Self-training, where the model labels its own data
- Pseudo-labeling
- Consistency regularization
- Graph-based methods
Reinforcement Learning
In reinforcement learning, an agent learns to make decisions by interacting with an environment.
Instead of learning from labeled or unlabeled data, the agent learns from feedback in the form of rewards or penalties.
Think about training a dog. The dog is the agent. It tries lots of actions, and for each action you give it a reward or maybe a penalty. The dog observes this feedback and changes its behavior over time. This is how it gets trained.
Reinforcement learning follows the same idea as a repeating loop:
- The agent observes the current state of the environment.
- The agent takes an action.
- The environment gives a reward, which can be negative (a penalty).
- The agent updates its strategy for the next action.
- The state changes, and the loop repeats.
The agent gets trained by repeating this loop.
Summary
| Type | Learns from | Goal | Example |
|---|---|---|---|
| Supervised | Labeled data | Map inputs to output labels | Spam detection |
| Unsupervised | Unlabeled data | Find structure or patterns | Customer segmentation |
| Semi-supervised | A little labeled data and a lot of unlabeled data | Predict labels at a lower labeling cost | Medical diagnosis with few annotations |
| Reinforcement | Rewards and penalties | Learn a strategy for making decisions | Training a dog |
The following lessons explore each of these techniques in depth.