Course contents · Chapter 4
Building with AIChapter 4 of 42 min reading + practice

Keep the transformation inspectable

A cleaning pipeline should preserve inputs, state its rules and account for its outputs.

A cleaning pipeline should preserve inputs, state its rules and account for its outputs.

Make rerunning the same input produce the same documented result. Row counts alone are insufficient, but they help detect accidental losses.

The bigger picture

Data preparation changes the representation used by later calculations. Every conversion, dropped row or missing-value decision can change the result. Preserve raw inputs so transformations can be inspected and repeated.

  1. Preserve raw data
  2. Parse
  3. Validate records
  4. Report changes
A working model for this course. Use it to locate where a decision or failure occurs.

Concepts to keep close

Schema
The expected fields, value types and constraints for a record.
Missing value
An absent observation whose meaning must be distinguished from zero or an empty label.
Audit trail
A record of transformations, rejected rows and reasons for changes.

Reasoning through the problem

Preserve the raw input separately.

Report accepted and rejected counts with reasons.

Check totals and repeatability.

Use the idea carefully

Inspect a few raw rows and define a schema before writing transformations. Parse structured formats with appropriate tools, validate each record and report rejected inputs. Keep missing and zero distinct. Test the cleaning function on deliberately malformed examples and confirm that summary counts account for every input row.

Further reading & course resources

Original documentation and teaching references for further investigation.