liveBook · Manning

Feature engineering

As explained in Deep Learning with Python, Third Edition

The manual design or transformation of input variables into representations better suited for a learning algorithm.

Feature engineering uses knowledge of a problem and a learning algorithm to make its inputs easier to learn from. The transformations are hardcoded, not learned by the model. It can improve generalization when raw data presents a needlessly difficult problem. section 5.4.2 section 5.4.1

Reading a clock

Suppose the input is an image of a clock and the target is the time. Learning directly from pixels calls for a computationally demanding ConvNet. A short Python script could instead locate the tips of the hands and pass their (x, y) coordinates to a simpler learner. Convert those coordinates to angles around the clock’s center, and the representation becomes simpler still: rounding and a lookup can recover the approximate time without machine learning. section 5.4.2

For a practical first pass:

  • Filter out uninformative inputs with feature selection. section 6.2.3
  • Use problem knowledge to construct features likely to help, then try to beat a simple baseline. section 6.2.3
  • Look for relevant prior work rather than assuming every useful representation must be invented anew. section 6.2.3

Deep learning reduces the need to hand-design representations by learning features during training, but it does not make thoughtful input design irrelevant. Keep manual feature engineering distinct from feature extraction with a pretrained model: that technique reuses features the model learned earlier, then trains a new classifier on them. section 1.7 section 8.3.1

How Deep Learning with Python, Third Edition covers it

How deep it goes
Defines hardcoded input transformations and works through progressively simpler clock representations without prescribing a universal procedure.
Examples
Transforms clock pixels into hand-tip coordinates and then angles, eventually replacing learning with rounding and lookup.
What it assumes
Assumes some knowledge of the data and chosen algorithm while introducing the idea through an accessible clock example.
What you can do after
Practice/perform it by selecting useful inputs, constructing problem-informed features, and checking whether a model beats a baseline.
How it connects
Connects feature selection and generalization to baseline testing; contrasts manual transformations with deep learning and pretrained feature extraction.

Also explained in

Compare how 16 books explain feature engineering →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Deep Learning with Python, Third Edition. The section links point to the parts of the book it draws on.