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 m/s2)((1+3+5+7)/4=4\ \mathrm{m/s^2})((1+3+5+7)/4=4 m/s2).
  • The range is (7−1=6 m/s2)(7-1=6\ \mathrm{m/s^2})(7−1=6 m/s2).
  • Feature window design is part of the recipe.
  • With 50% overlap, a feature row starts every second.

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 5

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. How should reviewers decide whether the feature can be used at prediction time?

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

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

iotclass.org

Retrieval practice

Recall check 2 of 5

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

Q2A feature called energy adds temperature readings in °C directly to voltage readings in V, with no physical conversion rule. What should the team fix first?

ADefine the source, units, window, and physical meaning.
BHide the units in the training notebook.
CNormalize values before checking their meaning.
DKeep the name because the model score improved.
Show answer

Answer: A Define the physical quantity, source units and conversion or calculation before choosing a window and implementing the feature.

iotclass.org

Retrieval practice

Recall check 3 of 5

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

Q3A 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 device can reconstruct it within its thirty-second memory limit.
BRepeat thirty seconds to simulate five minutes and hide changed confidence.
CDrop timestamps because the newest thirty seconds are enough by assumption.
DRedesign and revalidate the feature recipe for the deployable 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 4 of 5

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

Q4Training and edge firmware produce a feature with the same name but different windows. What record should be aligned?

AMatch only the feature name, because identical names guarantee matching training and edge windows.
BMatch only the model file hash, because it captures how firmware computes each input feature.
CA versioned recipe specifying window, units, missing-data rule, and code.
DUse only the notebook accuracy score, because it certifies the deployed input recipe.
Show answer

Answer: C The recipe makes the feature reproducible at inference time.

iotclass.org

Retrieval practice

Recall check 5 of 5

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

Q5A 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. How should validation be arranged for deployment to machines absent from training?

AKeep random row splitting because rows from one machine provide independent validation examples.
BUse machine-held-out validation, add time checks, and review device-identity features.
CRemove all device and site features and assume that alone removes leakage.
DAccept close train and random-validation scores without a machine-held-out test.
Show answer

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

iotclass.org

Print reference

Answers 1 of 2

Answer key.

  1. D · Feature engineering must preserve signal meaning and prediction-time availability; otherwise model evidence is not trustworthy.
  2. A · Define the physical quantity, source units and conversion or calculation before choosing a window and implementing the feature.
  3. D · Feature engineering needs a reproducible recipe that can be computed with the same meaning during training and deployment.
  4. C · The recipe makes the feature reproducible at inference time.
iotclass.org

Print reference

Answers 2 of 2

Answer key.

  1. B · Feature evidence must be checked against the deployment boundary, including time, device, site, user, and operating-condition separation.
iotclass.org