Visualizing High-Dimensional Data
Unsupervised transformations are algorithms that create a new representation of a dataset, which may be easier for humans or other machine learning algorithms to understand.
A Dataset With No Answers
Most introductory machine learning examples start from a question that has a known answer, such as whether an email is spam or how much a house will sell for. The answer is attached to each example in advance, and the algorithm learns to predict it. Unsupervised learning is different. The data arrives without labels. Nobody has attached a correct answer to each example, so the algorithm cannot be told what to predict. Instead, it works directly with the data it is given.
This chapter looks at two kinds of unsupervised learning: transformations of the dataset and clustering. This article focuses on the first kind. Keep one question in mind as you read: if the data has no labels to guide the work, what can an algorithm usefully do with it? The answer this article develops is that it can describe the same data in a different way.
What a Representation Is
A dataset is always stored in some representation. Each example is described by a set of features, and the original representation is simply the set of features that were recorded. Think of a small table where every row is one example and every column is one feature. That table is one way of describing the data. Nothing forces the description to stay exactly as it is.
Trace the table below as you read. It is an illustrative example invented for this article, not data from the source. It has three examples, and each example is described by four recorded features. This is the original representation.
| Example | Feature 1 | Feature 2 | Feature 3 | Feature 4 |
|---|---|---|---|---|
| Example A | 2.1 | 0.4 | 7.5 | 1.2 |
| Example B | 3.0 | 0.9 | 6.8 | 1.5 |
| Example C | 1.7 | 0.2 | 8.1 | 0.9 |
Original representation: three examples, each described by four features (generated illustration)
What do you think happens?
An unsupervised transformation is applied to the table above. How many examples does the new table contain?
Reveal answer
Exactly three, because the examples are the same data
The transformation does not add new examples or remove the examples that were there. It changes how the examples are described, not how many examples there are.
The Transformation Step
An unsupervised transformation is an algorithm that creates a new representation of a dataset, which may be easier for humans or other machine learning algorithms to understand.
Two phrases in this definition carry most of the meaning. The first is new representation. The output is a different description of the same data. It is not a prediction and it is not a label. The second is easier to understand. The reason for creating the new description is usefulness. A transformation is judged by whether the new form helps a person or a downstream algorithm, not by whether it matches an answer that was given in advance.
The pipeline has no label input because none exists. The algorithm takes the features as they are and produces the new description directly. Labels therefore do not enter the process at any stage. This is what separates the transformation from a supervised method, where the known answers guide the learning.
Dimensionality Reduction as Summarizing
A common application of unsupervised transformations is dimensionality reduction. Its starting point is a high-dimensional representation of the data, meaning a representation with many features for each example. Dimensionality reduction finds a new way to represent that same data so that the essential characteristics are still captured, but with fewer features.
The goal is summarizing. The new representation keeps the characteristics that matter most, using fewer numbers per example. It is not meant to keep every detail of the original.
Why Two Dimensions Helps Plotting
Reduction to two dimensions is a common choice for visualization. Two features can be drawn on a flat page or screen, with one feature on each axis. A dataset reduced to two dimensions can therefore be plotted and looked at directly. A dataset with four or forty features cannot be drawn that way, because a flat plot has only two axes to carry them.
Each sample in the two-dimensional output receives one pair of coordinates, an x value and a y value. The pair is the sample's location on the plot. The values below are invented for illustration and are not from the source.
Original Versus New Representation
The same three examples now appear twice: once in their original representation and once in a new representation with two features each. The examples did not change identity. Only the description did. The diagram below compares the two states. The values are illustrative and generated for this article.
| Aspect | Original representation | New representation |
|---|---|---|
| What it contains | The features that were recorded for each example | A different description of the same examples |
| Number of examples | Three in the illustration | Still three in the illustration |
| Features per example | Four in the illustration | Fewer, two in the illustration |
| Purpose | Stores the data as it was collected | Aims to be easier for a person or another algorithm to work with |
Contrast between the two representations (generated for this article)
Mistakes Beginners Make
Common mistake Thinking the transformation adds or removes examples
What it looks likeAssuming a table of three examples becomes a table of two after reduction.
Why it failsThe transformation does not add new examples or remove the examples that were there. It only changes how the examples are described.
Do this insteadCount examples before and after. The number should stay the same, while the number of features per example may change.
Common mistake Treating the output as a prediction or a label
Why it failsThe output is a new representation of the same data, not a predicted answer. The algorithm had no answers to predict in the first place.
Do this insteadDescribe the output as a new description of the data and judge it by usefulness.
Common mistake Assuming reduction keeps every detail
Why it failsThe new representation is meant to keep the characteristics that matter most, in fewer numbers per example.
Do this insteadExpect some detail to be lost in exchange for a smaller, more usable description.
Common mistake Plotting data with more than two features directly
Why it failsA flat plot has room for two axes. A dataset with four or forty features cannot be drawn directly on it.
Do this insteadReduce the data to two dimensions first if the goal is a direct plot.
Practice: Reading a Transformed Table
A dataset has five examples, and each example is described by six features. An unsupervised transformation produces a new representation in which each example has two features. State how many examples and how many features per example the new representation has, and explain whether any examples were added or removed.
Hints
- Separate the number of examples from the number of features per example.
- Recall that the transformation changes how examples are described, not how many there are.
Key Takeaways
- An unsupervised transformation takes a dataset without labels and produces a new representation of the same data, judged by whether it is easier for people or other algorithms to use.
- The transformation does not add or remove examples. It changes how each example is described through its features.
- Dimensionality reduction starts from a high-dimensional representation and finds a new one with fewer features while aiming to keep the essential characteristics.
- Reducing data to two dimensions is useful for visualization because two features can be plotted directly, with one on each axis.