Concepts / Data Preprocessing

Data Preprocessing

Feature engineering is a preprocessing step. Its transformations are designed before the model receives the data; they are not features learned by the model during training.

  • Programming

Why Representation Matters

A machine learning model does not always receive data in the form that makes its task easiest. Feature engineering addresses this problem by transforming raw data into more meaningful features before the data enters the model. The central idea is simple: instead of asking the model to work directly with every raw detail, prepare an input representation that expresses the information in a form more useful for the task.

Key point

Feature engineering is a preprocessing step. Its transformations are designed before the model receives the data; they are not features learned by the model during training.

From Raw Data to Features

Raw dataFeature engineeringNon-learned transformationsMeaningful featuresModel-ready representationModelPrediction taskinputcreatesenters
How does raw data move through preprocessing and become model-ready features before reaching the model?

The transformation stage uses knowledge about the data and the machine learning algorithm to create a more meaningful representation. The transformed features then enter the model. This changes what the model has to work with, rather than changing the model itself.

A Simpler Representation

Consider a generated example in which raw data contains many separate observations about an item. A preprocessing designer might transform those observations into a smaller set of features that captures the information most relevant to the prediction task. The exact transformation depends on the problem, but the reasoning follows the same pattern: identify meaningful information, represent it explicitly, and pass that representation to the model.

Raw representationMany separate detailsEngineered featuresMore meaningfulrepresentationPrediction taskSimpler formtransformcan simplify
What changes between a raw representation and an engineered representation, and how can that make the prediction task easier?
Worked example

Choosing a More Meaningful Representation

A model receives raw data that does not express the prediction task in an easy-to-use form. How should feature engineering be used?

  1. 1
    Identify the difficulty

    Examine what makes the raw representation difficult for the model and determine which parts of the data are meaningful for the task.

  2. 2
    Design a transformation

    Use knowledge about the data and the algorithm to create features that express the meaningful information more directly.

  3. 3
    Place the transformation before the model

    Apply the non-learned transformation before the data enters the model, so the model receives the engineered features rather than only the original representation.

  4. 4
    Evaluate the new representation

    The goal is not transformation for its own sake. The goal is to express the problem more simply.

Result

Feature engineering can turn a difficult machine learning problem into a simpler one by changing how the relevant information is represented before modeling.

Key point

The difficult part is often not performing a transformation but choosing one that reflects the problem. Useful feature design depends on understanding which aspects of the raw data are meaningful for the task.

Shallow Models and Deep Models

Raw dataRaw dataEngineered featuresDesigned before modelingLearned featuresExtracted automaticallyShallow modelDeep modelhuman transformationinputautomatic extractioninternal representation
What is the difference between manually engineered features entering a classical shallow model and features being learned through multiple layers in a deep model?

Before deep learning, feature engineering was critical. Classical shallow algorithms did not have hypothesis spaces rich enough to learn useful features by themselves, so the way data was presented to the algorithm was essential to success. Human-designed features supplied the representation that the shallow algorithm needed.

Deep learning changes the balance. Deep learning models can automatically extract useful features from raw data, which removes the need for most manual feature engineering. However, automatic extraction does not make human-designed transformations worthless. A good manually designed feature can still produce a more elegant solution, use fewer resources, or solve a problem with far less data.

AspectClassical shallow algorithmsDeep learning
Feature extractionUseful features generally had to be designed before modeling.Useful features can be extracted automatically from raw data.
Role of representationHow the data was presented was essential to algorithm success.The model can learn useful internal representations.
Value of manual featuresHistorically critical.Reduced in many cases, but not eliminated.
Possible benefit of good manual featuresProvide the representation the algorithm needs.Can produce a more elegant solution, use fewer resources, or require less data.

The role of feature engineering changes between classical shallow algorithms and deep learning, but its value does not disappear.

Designing Useful Features

Begin with the problem rather than with a favorite transformation. Ask what information is meaningful for the task and whether the raw representation expresses that information clearly. Then use knowledge about both the data and the machine learning algorithm to design a representation that makes the task easier.

Common Mistakes

  • Common mistake

    Assuming feature engineering is unnecessary whenever deep learning is used.

    What it looks like

    Treating automatic feature extraction as proof that manually designed features can never help.

    Why it fails

    Deep learning reduces the need for most manual feature engineering, but good features can still provide a more elegant solution, use fewer resources, or solve a problem with less data.

    Do this instead

    Consider whether problem knowledge can produce a useful representation before deciding that automatic extraction is sufficient.

  • Common mistake

    Creating a transformation without understanding the prediction problem.

    What it looks like

    Changing the raw data simply because a transformation is available, without identifying which information matters.

    Why it fails

    Useful feature design usually requires a deep understanding of the problem and of how meaningful information should be represented.

    Do this instead

    Start by identifying the parts of the raw data that are relevant to the task.

  • Common mistake

    Thinking that feature engineering changes the model's internal learning process.

    What it looks like

    Describing a preprocessing transformation as if the model had learned that transformation itself.

    Why it fails

    Feature engineering creates more meaningful features before the data enters the model; it is distinct from features extracted automatically by a model.

    Do this instead

    Separate the non-learned preprocessing stage from the model's own learned representations.

  • Common mistake

    Treating raw data as automatically suitable for a model.

    What it looks like

    Assuming that the model always receives data in the form that makes its task easiest.

    Why it fails

    A model does not always receive data in the most useful form, and a good transformation can simplify a difficult machine learning problem.

    Do this instead

    Ask whether a different representation would express the relevant information more directly.

Practice

MEDIUM

A team has raw data that makes its prediction task difficult. The team is considering a manually designed transformation before the model receives the data. Explain why this could help, and explain why the same idea can still be valuable when the team uses deep learning.

Hints
  • Describe what happens before the data enters the model.
  • Explain how a more meaningful representation can simplify the task.
  • Contrast automatic feature extraction in deep learning with the possible benefits of human-designed features.

What do you think happens?

A deep learning model can automatically extract useful features. Does that mean manually designed features have no remaining value?

  • Yes, manual features are always unnecessary.

  • No, good manual features can still produce a more elegant solution, use fewer resources, or require less data.

  • Yes, because deep learning cannot use transformed input.

  • No, because classical shallow algorithms learn all features automatically.

Reveal answer
Answer:

No, good manual features can still produce a more elegant solution, use fewer resources, or require less data.

Deep learning reduces the need for most manual feature engineering, but it does not eliminate the value of problem-specific representations.

Key Takeaways

  1. 1
    Feature engineering transforms raw data into more meaningful features before modeling.
  2. 2
    The goal is to express the problem in a simpler form for the machine learning model.
  3. 3
    Useful feature design requires understanding which parts of the raw data matter and how to represent them.
  4. 4
    Feature engineering was historically critical for classical shallow algorithms because they could not learn useful features by themselves.
  5. 5
    Deep learning can automatically extract features, but manually designed features can still reduce resources, require less data, or provide a more elegant solution.

At a glance

  • Feature engineering is a preprocessing stage that creates more meaningful features before data enters a model.
  • A well-designed representation can turn a difficult machine learning problem into a simpler one.
  • Classical shallow algorithms depended heavily on human-designed features because they could not learn useful features by themselves.
  • Deep learning reduces the need for manual feature engineering by extracting features automatically.
  • Manual feature engineering remains useful when it produces a more elegant solution, uses fewer resources, or works with less data.

Related concepts

More concepts starting with D