Concepts / Features and Representations of Data

Features and Representations of Data

Instead, it works directly with the data it is given.

  • Programming

Data With No Answer Key

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. Each example in the data comes with a correct answer attached in advance, so the algorithm can be shown what to predict. Unsupervised learning is different. The data arrives without labels. Nobody has attached a correct answer to any example, so the algorithm cannot be told what to predict. Instead, it works directly with the data it is given.

What do you think happens?

A dataset arrives with no labels attached to any of its examples. What can an unsupervised transformation produce from it?

  • A predicted label for each example

  • A new description of the same examples

  • Brand new examples added to the dataset

  • A removal of the examples that do not fit a pattern

Reveal answer
Answer:

A new description of the same examples

An unsupervised transformation does not predict labels, add examples, or remove them. It takes the existing examples and produces a different description of them, one that may be easier for a person or another machine learning algorithm to work with.

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 to that question starts with understanding how data is represented in the first place.

Original Versus New Representation

A dataset is always stored in some representation. Each example is described by a set of features, which are the properties that were recorded for it. The original representation is simply the set of features that were recorded. Nothing forces that description to stay as it is.

Definition

Original representation: the description of each example using the set of features that were actually recorded when the data was collected.

Definition

New representation: a different description of the same data, produced by a transformation. It describes the same examples, but not necessarily with the same features.

Worked example

Recording Three Houses in the Original Representation

A small dataset records four features for each of three houses: area in square metres, number of bedrooms, age in years, and distance to the nearest station in kilometres. Describe the original representation, then describe what a new representation of the same data must still contain.

  1. 1
    Identify the examples

    There are three examples, one for each house. Each house is one row in the dataset.

  2. 2
    Identify the features

    Each example is described by four recorded features: area, number of bedrooms, age, and distance to the station. Together these four features form the original representation.

  3. 3
    Check what a new representation changes

    A new representation describes the same three houses, so it still has three examples. What can change is the set of features used to describe each house.

Result

The original representation has three examples with four recorded features each. A new representation of the same data still has three examples, but each one may be described by a different set of features.

Example A4 recorded featuresExample Anew descriptionExample B4 recorded featuresExample Bnew descriptionExample C4 recorded featuresExample Cnew descriptiontransformedtransformedtransformed
What stays the same and what changes when an unsupervised transformation converts the original representation into a new one. The number of examples stays at three; the description of each example changes.

The diagram shows the key point. Each example on the left has a one-to-one counterpart on the right, so the transformation does not add new examples or remove the ones that were there. It changes how each example is described. This is the source of most confusion about the topic, so it is worth checking each time: count the examples before and after, and the count should match.

What an Unsupervised Transformation Produces

An unsupervised transformation is an algorithm that creates a new representation of a dataset. The new representation may be easier for humans or other machine learning algorithms to understand. Because there are no labels, the goal of the transformation is a new description of the data, not a predicted answer.

Original datasetexamples with recordedfeaturesUnsupervisedtransformerno labels usedNew representationsame examples, newdescriptionPerson or algorithmuses the new forminputproducesis easier to work with
The steps a dataset passes through when an unsupervised transformer, which uses no labels, converts it into a new representation that a person or another algorithm can then use.

The definition carries two phrases that hold most of its meaning. The first is new representation. The output is a different description of the same data. It is not a prediction and 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 people or downstream algorithms, not by whether it matches an answer that was given in advance, because no such answer exists for unlabeled data.

  1. 1
    Start with a dataset whose examples are described by recorded features.
  2. 2
    Pass the data to an unsupervised transformer, which does not receive any labels.
  3. 3
    Receive a new representation of the same examples.
  4. 4
    Check whether the new representation is useful to the person or algorithm that will use it.

Dimensionality Reduction as Fewer Features

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 per example.

The goal is best described as summarizing. The new representation is not meant to keep every detail of the original. It is meant to keep the characteristics that matter most, in fewer numbers per example. Some information is therefore given up on purpose, in exchange for a shorter description that is still useful.

AspectOriginal representationReduced representation
Features per exampleFour recorded featuresTwo features
Examples in the datasetThreeThree, unchanged
PurposeRecord what was measuredSummarize the essential characteristics
Detail keptEvery recorded featureOnly the characteristics that matter most

What is kept and what is given up when the three houses are represented with fewer features

Why Two Dimensions Suits Visualization

A common choice of target for dimensionality reduction is two dimensions, chiefly 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 features, or forty, cannot be drawn that way on a flat surface, because there is no direct way to place it on a plane with one axis per feature.

Example 1x and y coordinatesExample 2x and y coordinatesExample 3x and y coordinatesExample 4x and y coordinates
How each example in a two-feature representation maps to a single point with an x coordinate and a y coordinate, so the whole dataset can be plotted on a 2D plane.

In the reduced representation, each example has exactly two values, so each example becomes one point. The first value is read as the horizontal position and the second as the vertical position. Once every example is a point, the whole dataset can be drawn as a scatter of points and inspected by eye. Read this way, the two-feature representation is a practical tool for looking at data that would otherwise be impossible to picture.

Mistakes Learners Make With Representations

  • Common mistake

    Expecting an unsupervised transformation to predict a label for each example

    What it looks like

    Looking for a predicted spam or not-spam label after transforming a dataset that has no labels

    Why it fails

    The data has no labels, so the algorithm has no answer to predict. The output of an unsupervised transformer is a new description of the data.

    Do this instead

    Expect a new representation of the same examples, judged by whether it is useful.

  • Common mistake

    Thinking that dimensionality reduction removes examples

    What it looks like

    Concluding that the three houses have become two houses because the features dropped from four to two

    Why it fails

    Dimensionality reduction changes the number of features per example, not the number of examples. The source states that the example count stays the same.

    Do this instead

    Count the examples before and after. Both counts should match, while the features per example go down.

  • Common mistake

    Assuming the reduced representation keeps every detail of the original

    Why it fails

    The goal is to summarize, keeping the characteristics that matter most in fewer numbers per example. Detail is deliberately reduced.

    Do this instead

    Treat the new representation as a summary that is useful for a purpose, not as a lossless copy of the original.

  • Common mistake

    Assuming that a two-dimensional representation is needed for every task

Checking Your Understanding

EASY

A dataset has 50 examples, and each example is described by 40 features. An unsupervised transformation produces a new representation that reduces each example to 2 features. How many examples does the new representation contain, and how many features describe each one?

Hints
  • Ask first whether the transformation changes the number of examples or only the features per example.
  • The source describes a transformation as changing how examples are described, not how many examples exist.

Key Takeaways

  • A dataset is always stored in some representation: each example is described by a set of recorded features, and that set is the original representation.
  • An unsupervised transformation works without labels and produces a new representation of the same examples, judged by whether the new form is easier for a person or another algorithm to use.
  • The transformation does not add or remove examples; it changes how each example is described.
  • Dimensionality reduction starts from a high-dimensional representation and finds a new one with fewer features that summarizes the essential characteristics, without keeping every detail.
  • Reducing data to two dimensions is common for visualization, because each example can then be plotted as a point on a flat plane.

Related concepts

More concepts starting with F