Supervised Algorithms
Unsupervised learning can also serve as a preprocessing step, where a new representation of the data is passed to a supervised algorithm.
Two Roles for Unsupervised Methods
Unsupervised learning is easy to describe in the abstract: the algorithm works with data that has no labels. The more useful question for a working data scientist is what these methods are actually for. In practice, unsupervised algorithms show up in two main roles. The first is as a tool for looking at data itself, helping a person build an understanding of what a dataset contains. The second is as a helper inside a larger pipeline, where the output of an unsupervised step feeds into a supervised algorithm.
This article follows one hypothetical scenario through both roles. Along the way you will trace how data changes as it moves through a pipeline, see why the order of steps matters, and finish with the mistakes that catch people out most often.
Following Raw Data Through a Pipeline
Start with the usual supervised setup: data goes into a supervised algorithm, which learns from it and produces a prediction. Now insert an unsupervised step in front. Rather than feeding the raw data straight into the supervised algorithm, the pipeline first passes the data through an unsupervised step that learns a new representation of it. The supervised algorithm then works with this transformed version of the data.
The flow of information is what matters here. The data enters in its original form, the unsupervised step reshapes it, and the reshaped data is what the supervised algorithm learns from. The supervised algorithm never sees the original form in this pipeline; it only sees the new representation.
Exploratory Use: Understanding the Data
Unsupervised algorithms are often used in an exploratory setting, where a data scientist wants to understand the data better rather than run them inside a larger automatic system.
A large share of unsupervised work happens in this exploratory setting. The goal is not to hand a decision to an automated system. Instead, the unsupervised algorithm acts as a lens: its results inform the person's judgment about the dataset. This is why these methods are typically used on their own rather than as one component of a larger automatic system.
Imagine a team holding a large set of unlabeled customer records, with no note about which customers did what. An analyst runs an unsupervised algorithm to see whether the records fall into natural groups. The analyst does not feed those groups into a purchasing system. Instead, the groups help the analyst ask better questions about the data and decide what to examine next.
Working Through One Scenario
To see the pipeline role in action, follow a single hypothetical scenario. A team has many raw records and wants a supervised algorithm to make predictions from them. They suspect the raw form of the data may be hard for the supervised algorithm to learn from, so they try adding an unsupervised step first.
Adding an unsupervised step to a supervised pipeline
A team wants a supervised algorithm to predict an outcome from raw records. They add an unsupervised step that learns a new representation of the data. How does the data flow through the pipeline, and what does the team need to check afterward?
- 1Start with the raw data
The records enter the pipeline in their original form. Nothing has been changed yet.
- 2Apply the unsupervised step
The unsupervised algorithm learns a new representation of the records and reshapes the data into that representation.
- 3Train the supervised algorithm on the new representation
The supervised algorithm learns from the transformed version of the data, not from the original form.
- 4Measure accuracy and resource use separately
The team checks whether accuracy improved and, as separate questions, whether memory and time use went down. Neither result is guaranteed, so each must be measured on its own.
The supervised algorithm learns from a new representation of the data. Any improvement in accuracy or savings in memory and time is something the team must observe, not something the pipeline promises.
Tracing a Data Point Before and After
Now zoom in on one data point. Before the unsupervised step, the point is described in the original form of the data. After the step, the same point is described in the new representation, which is the version the supervised algorithm actually receives. The point is the same record; only its description has changed.
The supervised algorithm then works with the new description. Everything it learns comes from this transformed version of each point, which is why the choice of representation can affect how well the supervised algorithm performs.
Why Add an Unsupervised Step
The reason to add an unsupervised step to a supervised pipeline is that a new representation of the data can change how well the supervised algorithm performs. The source identifies two kinds of benefit. One is accuracy, and the other is resource use. Resource use covers both memory consumption and time consumption.
A new representation can sometimes improve the accuracy of supervised algorithms, and it can lead to reduced memory and time consumption. The word sometimes matters. These are possibilities the representation can create, not results you can count on in every case.
What do you think happens?
If you add a new representation in front of a supervised algorithm, will accuracy always go up?
Reveal answer
No, it can sometimes improve accuracy but is not guaranteed to
The source says a new representation can sometimes improve accuracy. Accuracy gains are a possibility, not a promise, and the same is true of memory and time savings.
Mistakes Beginners Make With Unsupervised Methods
Common mistake Treating an exploratory result as an automatic decision
What it looks likeAn analyst sees natural-looking groups in unlabeled records and assumes the groups should directly drive a business action.
Why it failsUnsupervised algorithms are often used in an exploratory setting, where the goal is to understand the data. The results inform judgment rather than replacing it.
Do this insteadUse the groups as a lens for asking better questions, and let a person decide what to do with them.
Common mistake Assuming a new representation always helps
What it looks likeA team adds an unsupervised step and concludes the supervised model is better without checking anything.
Why it failsA new representation can sometimes improve accuracy, but it is not guaranteed to. Benefits are possibilities, not certainties.
Do this insteadCompare the pipeline with and without the unsupervised step and measure the result.
Common mistake Expecting accuracy and resource savings to arrive together
What it looks likeA team sees lower memory use and assumes accuracy must also have improved.
Why it failsAccuracy and resource savings are separate outcomes. They are not guaranteed to appear together, and they are not guaranteed to appear at all.
Do this insteadMeasure accuracy, memory use, and time use separately, and report each one on its own.
Common mistake Feeding raw data to the supervised algorithm when the pipeline was designed to transform it first
Why it failsIn the pipeline role, the supervised algorithm is meant to learn from the reshaped data, not the original form.
Do this insteadCheck that the transformed output, not the raw input, is what reaches the supervised algorithm.
Checking a Colleague's Claim
A colleague says: We added an unsupervised step in front of our supervised model. Accuracy went up and memory use went down, so the unsupervised step is clearly a win. Explain what is right and what is missing from this conclusion, using the idea that accuracy and resource savings are separate outcomes.
Hints
- Ask whether the two measurements were taken separately and whether each one is guaranteed.
- Think about what the new representation can sometimes do, rather than what it always does.
- Consider whether a single good result is enough to call the step a win in every case.
Key Takeaways
- Unsupervised algorithms are often used in an exploratory setting, where the goal is to understand the data and inform a person's judgment rather than to feed an automatic system.
- An unsupervised step can serve as preprocessing: raw data enters, the step learns a new representation, and the supervised algorithm learns from the reshaped data.
- A new representation can sometimes improve accuracy and can lead to reduced memory and time consumption, but none of these outcomes is guaranteed.
- Measure accuracy and resource savings separately, and watch for mistakes such as treating exploratory results as decisions or assuming benefits always appear together.