Analytics & ML · Study deck

Feature Engineering for ML

A vibration trace contains thousands of samples, but a maintenance model may need only energy, spread, peaks, and frequency content from a timed window.

Data Dora is your guide for this deck.

modelingfeatureengineering
Data Dora, the module guide, in a scene from this chapter.
iotclass.org

After studying this chapter

Learning objectives

You will be able to:

  • Explain: Useful feature sets separate the decision groups with reproducible dimensions, whether those dimensions come from direct measurements, encoded images, fixed signal windows, summary statistics, or distribution summaries.
  • Explain: The window fixes sample membership and latency; statistics encode the chosen signal behavior; normalization uses training-derived parameters to place features on the expected scale.
  • Explain: Feature selection is an operations decision as well as a modeling decision because retained and dropped features change cost, latency, privacy, monitoring, and failure coverage.
  • Explain: Ports are cheap to read but are weak identities because applications share, change, or deliberately reuse them.
iotclass.org

Major section

Turn a Waveform Into a Versioned Record

Each stage changes representation.

  • For four acceleration samples 1, 3, 5, and 7 m/s², the mean is ((1+3+5+7)/4=4\ \mathrm{m/s^2}).
  • The range is (7-1=6\ \mathrm{m/s^2}).
  • Feature window design is part of the recipe.
  • With 50% overlap, a feature row starts every second.

Numbers to remember

100 HzA 100 Hz sensor gives 200 samples in two seconds.

Why it matters

A feature can be dropped because it is constant, too often missing, redundant under a written rule, too expensive on the target, or harmful in validated comparisons.

Feature engineering pipeline from raw sensor values through windowing, statistics, and normalization
Feature engineering pipeline from raw sensor values through windowing, statistics, and normalization
iotclass.org

Major section

Turn a Waveform Into a Versioned Record (continued)

The four-sample feature window should yield mean 4 m/s² and range 6 m/s².

  • These two features describe centre and spread but not sample order: the sequence 7, 5, 3, 1 has the same mean and range.
  • A 100 Hz sensor gives 200 samples in two seconds.
  • Packet traces need different features.
iotclass.org

Major section

Turn a Waveform Into a Versioned Record (continued)

Counts by direction, inter-arrival summaries, sizes, and burst lengths may help infer an application without inspecting payloads.

  • Yet a device identifier, destination unique to one lab, or capture-file name can become a shortcut.
  • Selection should use training evidence only.
  • Reorder it and expect those two values to stay equal, demonstrating their limit.
iotclass.org

Major section

Start With the Story

Raw samples fill a file, but the repair team needs a clear sign of change.

  • A useful model input keeps the part of the signal that helps that choice.
  • A feature is a measured clue made from raw data.
  • Firmware is the software stored on the device that may collect or shape that data.
iotclass.org

Major section

Start With the Story (continued)

A clue made after the result happened must not leak back into training.

  • A clue that the field device cannot make is not ready for live use.
  • One feature rarely proves a cause.
  • Those details can change which clue is trusted.
  • They must not turn a late or missing clue into valid live evidence.
iotclass.org

Major section

Inferring Applications from Packet Traces

Ports are cheap to read but are weak identities because applications share, change, or deliberately reuse them.

  • When endpoints do not identify their application, an observer can infer a traffic class from packet traces.
  • Clustering can explore unlabelled traces, while a supervised classifier can assign known classes when representative labels exist.
  • Each route has a different boundary.
iotclass.org

Major section

Features Preserve Signal Meaning

The window fixes sample membership and latency; statistics encode the chosen signal behavior; normalization uses training-derived parameters to place features on the expected scale.

  • Every arrow must execute identically after deployment.
Feature engineering pipeline from raw sensor values through windowing, statistics, and normalization
Feature engineering pipeline from raw sensor values through windowing, statistics, and normalization
iotclass.org

Major section

Summary

Useful feature sets separate the decision groups with reproducible dimensions, whether those dimensions come from direct measurements, encoded images, fixed signal windows, summary statistics, or distribution summaries.

  • Leakage checks must verify that the feature is available at prediction time and does not encode future labels, post-event actions, or inappropriate proxies.
  • Retest feature recipes after sensor, firmware, label process, sampling, transform code, deployment path, population, environment, or decision-use changes.
  • Feature selection is an operations decision as well as a modeling decision because retained and dropped features change cost, latency, privacy, monitoring, and failure coverage.
iotclass.org

Deck summary

Key takeaways

Each stage changes representation.

  • The four-sample feature window should yield mean 4 m/s² and range 6 m/s².
  • Counts by direction, inter-arrival summaries, sizes, and burst lengths may help infer an application without inspecting payloads.
  • Raw samples fill a file, but the repair team needs a clear sign of change.
  • A clue made after the result happened must not leak back into training.
iotclass.org

Retrieval practice

Recall check 1 of 3

Data Dora says: answer from memory, then check your reasoning.

Q1A model improves after adding a feature named recent_fault_count, but the count is calculated from maintenance tickets written after the prediction time. What is the strongest review response?

AReject or redesign the feature because it leaks future outcome information that will not be available at prediction time.
BKeep the feature because validation accuracy improved, then document that the tickets are high-value context.
CRename the feature as historical_fault_count so the model report does not expose the leakage boundary.
DUse the feature only on edge devices because field models can accept more missing information.
Show answer

Answer: A Feature engineering must preserve signal meaning and prediction-time availability; otherwise model evidence is not trustworthy.

iotclass.org

Retrieval practice

Recall check 2 of 3

Data Dora says: answer from memory, then check your reasoning.

Q2A training notebook computes a vibration feature over five-minute windows, but the deployed edge device can only keep thirty seconds of samples. What should the practitioner do?

AKeep the five-minute feature because the notebook score is stronger than the edge-device constraint.
BApproximate five minutes by repeating the same thirty-second window and hide the lower confidence.
CDrop timestamp handling because the edge device only needs the newest samples for prediction.
DRedesign and revalidate the feature recipe for the deployed window.
Show answer

Answer: D Feature engineering needs a reproducible recipe that can be computed with the same meaning during training and deployment.

iotclass.org

Retrieval practice

Recall check 3 of 3

Data Dora says: answer from memory, then check your reasoning.

Q3A held-out validation split is random by row, but rows from the same machine appear in both training and validation. The model will be deployed to new machines. What is the best review response?

AKeep the random split because it increases row coverage and usually stabilizes the reported score.
BRemove all device and site features so the model has no remaining path to overfit.
CUse a machine-held-out or time-aware validation split and recheck the feature set for device identity proxies.
DAccept the result if training accuracy and random validation accuracy are close enough.
Show answer

Answer: C Feature evidence must be checked against the deployment boundary, including time, device, site, user, and operating-condition separation.

iotclass.org

Print reference

Answers

Answer key.

  1. A · Feature engineering must preserve signal meaning and prediction-time availability; otherwise model evidence is not trustworthy.
  2. D · Feature engineering needs a reproducible recipe that can be computed with the same meaning during training and deployment.
  3. C · Feature evidence must be checked against the deployment boundary, including time, device, site, user, and operating-condition separation.
iotclass.org