Concepts / Decomposition Techniques for Data Understanding

Decomposition Techniques for Data Understanding

Decomposition is the first family.

  • Programming

The Missing Answer Key

Many beginners arrive at machine learning expecting every algorithm to be judged by a clear score. A classifier is judged by accuracy and a regressor by error. When they meet unsupervised methods, which work with data that has no known answers attached, they often reach a conclusion that sounds reasonable: if there is no target to predict and no obvious number saying the algorithm did well, then the algorithm might not be worth much. This article examines that belief, shows where it comes from, and explains why it leads to a poor habit.

What do you think happens?

You have a large table of patient measurements, and nobody has labeled which patients have a particular condition. Would the lack of a clear accuracy score be a good reason to skip an unsupervised search for structure in the table?

  • Yes, without an accuracy score the method cannot be trusted

  • No, the lack of a score is a reason to interpret results carefully, not a reason to avoid the method

Reveal answer
Answer:

No. The lack of a clear score is not a reason to skip the method.

The source says the difficulty of quantifying an unsupervised algorithm's usefulness is a reason to be careful when interpreting results. It is not a reason to avoid the methods altogether.

What Supervised Learning Gives You for Free

The belief makes sense because supervised learning comes with a built-in test. You hold back some labeled examples, the model predicts their answers, and you compare those predictions to the truth. Each step of that check produces a concrete number that tells you how the model did.

  1. 1
    Hold back some labeled examples so the model does not see their answers during training
  2. 2
    Ask the model to predict the answers for the held-back examples
  3. 3
    Compare the predictions to the true answers to get a score

Unsupervised learning removes that test. The data arrives without the answers the algorithm would need to be checked against, so there is no comparison step at the end. A learner who has grown used to the checking step may conclude that a method without it cannot be trusted or cannot be useful. The source's framing gives a more accurate picture: these algorithms are used for exploratory data analysis and preprocessing, and they are chosen to reveal the properties and structure of data rather than to earn a score.

The Three Families of Unsupervised Tools

The source names three families of unsupervised tools that together cover the main unsupervised algorithms a learner needs at this stage. They are presented as essential tools for further understanding your data, and as methods that practitioners use every day. The three families differ in what they produce from the same data set, as the comparison below shows.

Decompositionessential tool for furtherunderstanding dataManifold learningtool for furtherunderstanding dataClusteringtechnique used to groupdata
How do decomposition, manifold learning, and clustering differ in what they produce from the same data set? Each family is described by the source with a different role in exploring data.

Following an Estimator from Creation to Use

Choosing an algorithm is only part of the work. You also need to know how scikit-learn expects you to use it. The source reviews this through the application programming interface, or API, that is shared across the library. Every algorithm in scikit-learn, whether it is a preprocessing step, a supervised learning method, or an unsupervised method, is implemented as a class. These classes are called estimators.

The consequence is that the same basic pattern applies to a clustering method, a decomposition method, or a classifier. You must first create an object of that particular class. Only after the object exists do you apply the algorithm. The sequence below traces that order of events.

Estimator classa class in the libraryObject instancecreated from the classAlgorithm appliedto the datainstantiateapply to data
What happens in what order when an estimator is used? The class must be instantiated into an object before the algorithm is applied to data.

Mistakes Beginners Make with Unsupervised Results

  • Common mistake

    Skipping an unsupervised method because it has no accuracy score

    What it looks like

    Refusing to explore a table of patient measurements because no one labeled which patients have a condition

    Why it fails

    The source says the difficulty of measuring usefulness is a reason to interpret results carefully, not a reason to avoid the methods altogether

    Do this instead

    Use the method to gather insights, then judge the results with care and domain judgment

  • Common mistake

    Treating the lack of a target as proof that nothing useful can be learned

    Why it fails

    Unsupervised methods are chosen to reveal structure and prepare data, which is a different purpose from earning a prediction score

    Do this instead

    Ask what the method is meant to reveal, such as structure, groups, or a more useful representation, rather than what score it earns

  • Common mistake

    Applying an algorithm's class directly without creating an object from it

    Why it fails

    The source states that you must instantiate an object of the class before applying the algorithm

    Do this instead

    Create the estimator object first, then apply it to the data

Practicing on Toy Data Before Real Data

The source recommends practicing clustering and decomposition on two kinds of data. The first is two-dimensional toy data, which is small enough to see directly. The second is the real-world data sets included with scikit-learn: the digits, iris, and cancer data sets. Starting with toy data lets you check whether a method behaves as you expect. Moving to real data lets you see how it handles more complicated structure.

MEDIUM

You have a small two-dimensional data set that you can plot directly. Before trying the same method on a real data set, what would you check on the toy data, and why does that check help you interpret the result on the larger data set?

Hints
  • Think about what you can see directly in two dimensions that is hard to see in a large real data set
  • Consider whether the method's output matches what you can already see in the plot
MEDIUM

A colleague says that an unsupervised method on a cancer data set is worthless because it cannot be scored like a classifier. Write a short reply explaining what the source actually says about the difficulty of measuring usefulness, and what you would do instead.

Hints
  • Recall that the source calls the difficulty a reason for care in interpreting results
  • Mention the purpose of unsupervised methods as exploration and preprocessing

Key Takeaways

  1. 1
    Unsupervised learning works without answer labels, so it cannot be checked against a built-in test, but it is still useful for exploratory analysis and preprocessing
  2. 2
    Decomposition, manifold learning, and clustering are the three families the source names as essential tools for further understanding your data
  3. 3
    The difficulty of measuring an unsupervised algorithm's usefulness is a reason to interpret results carefully, not a reason to skip the method
  4. 4
    In scikit-learn, every algorithm is an estimator class, and you must instantiate an object of that class before applying the algorithm

At a glance

  • Unsupervised learning is useful when no supervision information is available, because it reveals structure and prepares data rather than earning a score
  • Decomposition, manifold learning, and clustering are the three families the source names as essential tools for exploring data
  • Difficulty in measuring usefulness is a reason for care in interpreting results, not a reason to skip unsupervised methods
  • scikit-learn algorithms are estimator classes, and you must create an object from the class before applying it

Related concepts

More concepts starting with D