Analytics & ML · Study deck

Missing-Data Repair Filter Contracts

A missing-data repair must mark each estimate and preserve the raw gap so a later alert can be reviewed.

Data Dora is your guide for this deck.

dataqualityimputation
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 why the cause of missing data changes whether imputation is safe.
  • Choose forward-fill, interpolation, model-based repair, median filtering, or Hampel filtering based on sensor semantics.
  • Preserve quality flags, gap metadata, and repair methods alongside cleaned values.
  • Distinguish MCAR, MAR, and MNAR missingness when approving automated repairs.
iotclass.org

Major section

Gaps and Spikes as Data Problems

Real sensor streams have holes (dropped packets, sleeping nodes, failed reads) and spikes (impulse noise, glitches).

  • Imputation fills the holes with plausible estimates; filtering removes the spikes.
  • The single most important idea is that how data went missing changes whether filling it is safe.
  • Filling it in can delete the very event you care about.

Key terms

Missing and noisy values
Missing and noisy values are not permission to make a series look smooth.
Imputation and noise filtering belong in the repair step of a data-cleaning pipeline: first validate the raw stream, then fill or filter only when the repair preserves the meaning of the sensor signal.
Imputation and noise filtering belong in the repair step of a data-cleaning pipeline: first validate the raw stream, then fill or filter only when the repair preserves the meaning of the sensor signal.
iotclass.org

Major section

Gaps and Spikes as Data Problems (continued)

Noise has the same trap.

  • If a sensor fails precisely when values get extreme, naively filling the gap with an average erases exactly the information you needed and biases every downstream result.
  • Intuition: a missing value is not always a random blank to paint over.
  • A good cleaned dataset also keeps provenance.
iotclass.org

Major section

Gaps and Spikes as Data Problems (continued)

The output explicitly includes a quality flag, repair provenance, and decision check, keeping later analytics honest about what was measured, inferred, or deliberately left missing.

  • If five samples vanish during a Wi-Fi retry, a short forward-fill or interpolation may preserve enough continuity for a dashboard.
  • If the same five samples vanish every time the freezer door opens and the transmitter browns out, the gap is not a harmless hole; it is evidence that the physical process exceeded a boundary.
  • Missing and noisy values are not permission to make a series look smooth. the Imputation and noise filtering belong in the repair step of a data-cleaning pipeline: first validate the raw stream, then fill or filter only when the repair preserves the meaning of the sensor signal diagram places diagnosis before repair so the worked rules can preserve events that matter to the downstream decision.
iotclass.org

Major section

Imputation and Impulse Filters

For a slow temperature probe, a two-minute gap might be forward-filled and marked.

  • For a binary door or motion event, interpolation is usually wrong because there is no meaningful value halfway between closed and open.
  • Dashboards often need continuity, so short forward-fill or interpolation can be enough.
  • Those thresholds are not universal constants.

Why it matters

For a pulse counter, the same two-minute gap may need an unknown total because missing pulses cannot be reconstructed.

iotclass.org

Major section

Under the Hood: MCAR, MAR, MNAR

Model-based imputation using those variables can fill it with little bias.

  • MNAR means the missingness depends on the unobserved value itself, such as a pressure sensor that saturates and stops reporting exactly when pressure is high.
  • In a MAR case, hide samples only when the gateway queue length is high; a model that includes queue length and neighbouring sensors can still recover useful estimates.
  • So imputation and filtering are not mechanical clean-up.

Key terms

MCAR
MCAR means the missingness is unrelated to the value and unrelated to other variables, such as a random packet collision.
iotclass.org

Major section

Under the Hood: MCAR, MAR, MNAR (continued)

In an MNAR case, hide samples only when temperature exceeds 39 degrees C; interpolation from normal neighbouring points systematically replaces overheating evidence with ordinary values.

  • A downstream alarm can choose to fire on long MNAR-suspect gaps, while a trend dashboard can show a dashed segment for imputed values.
  • The pipeline stays honest because uncertainty is carried forward instead of being hidden behind a neat number.
  • If the cleaner reduces variance, removes rare extremes, or shifts event timing, there must be a physical explanation.
  • Without one, keep the raw value, mark the quality issue, and investigate the sensor or transport path.
iotclass.org

Major section

Under the Hood: MCAR, MAR, MNAR (continued)

MCARMissing completely at random: the gap is unrelated to any value (a random dropped packet).

  • MARMissing at random: missingness depends on other observed variables (a sensor that fails when the gateway is busy).
  • MNARMissing not at random: missingness depends on the missing value itself (a sensor that saturates and drops out at extremes).
  • A moving average assumes neighbouring samples should look similar and reduces high-frequency variation, which is helpful for Gaussian measurement noise but harmful for sharp transitions.
  • The statistical name for the gap mechanism matters because it states what information is allowed to explain the missing sample.
iotclass.org

Deck summary

Key takeaways

Real sensor streams have holes (dropped packets, sleeping nodes, failed reads) and spikes (impulse noise, glitches).

  • Noise has the same trap.
  • The output explicitly includes a quality flag, repair provenance, and decision check, keeping later analytics honest about what was measured, inferred, or deliberately left missing.
  • For a slow temperature probe, a two-minute gap might be forward-filled and marked.
  • Model-based imputation using those variables can fill it with little bias.
iotclass.org

Retrieval practice

Recall check 1 of 5

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

Q1Why does the REASON data is missing matter before choosing an imputation method?

AIt tells whether filling the gap would preserve or erase the event
BIt lets one universal fill value work across every sensor type
CIt proves the missing samples can always be dropped safely
DIt matters only after a machine-learning model has been trained
Show answer

Answer: A A value-dependent outage can be the evidence, so a naive fill can hide the event instead of repairing the record.

iotclass.org

Retrieval practice

Recall check 2 of 5

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

Q2A temperature gap is filled for a chart. What must travel with the cleaned value so a reviewer can tell it from a measurement?

AStore only a smooth value, discarding the original gap and repair marker.
BAttach a normal-quality label because the repaired chart looks continuous.
CMove the timestamp later and remove any record of the original gap.
DCarry the original gap span, repair method, and imputed-quality flag.
Show answer

Answer: D The repaired value needs its source and method to stay visible.

iotclass.org

Retrieval practice

Recall check 3 of 5

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

Q3Why is a median filter better than a mean filter for removing occasional impulse spikes?

ABecause a mean cannot be calculated from ordinary sensor readings.
BBecause the median resists an occasional extreme value in its window.
CBecause the median deliberately magnifies the largest impulse spike.
DBecause mean and median always return identical values for every window.
Show answer

Answer: B A lone spike does not move the median much, while the mean is dragged toward the extreme value.

iotclass.org

Retrieval practice

Recall check 4 of 5

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

Q4A door sensor misses an event during a link outage. The chart wants a smooth line between closed and open. What repair is defensible?

APreserve the gap and uncertainty until another source resolves door state.
BInterpolate a half-open state and claim it was measured during the outage.
CForward-fill the prior door state through the outage without a gap flag.
DReplace the missed event with a daily average and call it a door reading.
Show answer

Answer: A The missing binary event must stay visible unless evidence supports a bounded repair.

iotclass.org

Retrieval practice

Recall check 5 of 5

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

Q5A sensor saturates and stops reporting whenever the true value is very high (missing not at random). Why is mean imputation especially harmful here?

AThe missing points are exactly the extreme high values
BThe mean is always representative of hidden sensor values
CThe observed mean cannot be computed if any value is missing
DMean imputation mainly adds new high spikes to the series
Show answer

Answer: A Replacing those hidden highs with an average removes the extremes and biases statistics and models downward.

iotclass.org

Print reference

Answers 1 of 2

Answer key.

  1. A · A value-dependent outage can be the evidence, so a naive fill can hide the event instead of repairing the record.
  2. D · The repaired value needs its source and method to stay visible.
  3. B · A lone spike does not move the median much, while the mean is dragged toward the extreme value.
  4. A · The missing binary event must stay visible unless evidence supports a bounded repair.
iotclass.org

Print reference

Answers 2 of 2

Answer key.

  1. A · Replacing those hidden highs with an average removes the extremes and biases statistics and models downward.
iotclass.org