Skip to content
ORBIT

Chapter 2 of 6

Prepare the table

Prepare is the first arc. Profile, quality, and outlier policy leave files Fit can refuse. After every repair, describe the table again — a fill, drop, or clip changes the distribution the next stage will trust.

Operating rule

My operating rule: assign every column a role, score quality before any impute, write an outlier policy instead of a silent delete, and stop when the quarantine rate exceeds quarantine_rate_max for this run.

Checked 29 Oct 2026ML pipeline field card

Profile first

Write profile.json before anything is cleaned. For every column: type, null count, null rate, distinct count, five examples. Numeric columns add min, p01, median, p99, max, mean, standard deviation, and skew. For the label add the positive rate on rows whose fourteen-day window has already closed. For decision time add min and max.

On the call-order path: entity key = invoice id; decision time = this morning’s cut; label = paid within fourteen days of the cut (not whether a call was placed). Candidates include days past due, open amount, dispute flag, and customer segment. Invoice id is id, not a feature. A constant column is drop.

Assign one role per column: id, time, decision_time, label, feature, or drop. Pass only when every column has a role and label and decision time are set. Fail → stop. Do not invent a label.5

ONE ROLE PER COLUMN · CALL-ORDER TABLECOLUMNEXAMPLEROLEWHYinvoice_idINV-20417IDEntity keyissued_at2026-09-02TimeSource timestampcut_at2026-10-28 07:00Decision timeThis morning’s cutpaid_within_14dtrue · falseLabelMatured rows onlydays_past_due37FeatureKnown at the cutdispute_flagfalseFeatureKnown at the cutsegmentSMBFeatureKnown at the cutcurrencyEUR on every rowDropConstant columnref_codeA7-…? no roleNobody named itRole rules: a constant column is Drop. Distinct on more than 95% of rows is ID, never Feature.Columns and values are a synthetic illustration.profile.jsonEvery column: type, nulls, distinctcount, five examplesNumeric: min, p01, median, p99,max, mean, sd, skewLabel: positive rate on maturedrowsDecision time: earliest and latestcutEvery column one role?Label and decision time set?yesNext: QualityStage 2noStopDo not invent a role.
ONE ROLE PER COLUMNCOLUMN · EXAMPLEROLEinvoice_idINV-20417IDissued_at2026-09-02Timecut_at2026-10-28 07:00Decision timepaid_within_14dtrue · falseLabeldays_past_due37Featuredispute_flagfalseFeaturesegmentSMBFeaturecurrencyEUR on every rowDropref_codeA7-… · Nobody named it? no roleConstant → Drop. Distinct on more than 95% of rows → ID.profile.jsonEvery column: type, nulls, distinct count, fiveexamplesNumeric: min, p01, median, p99, max, mean, sd,skewLabel: positive rate on matured rowsDecision time: earliest and latest cutEvery column one role?Label and decision time set?yesnoNext: QualityStage 2 reads the roles.Stopref_code has no role. Donot guess one.Columns and values are a synthetic illustration.
Figure 1. Profile contract. Writes profile.json. A blank role stops the run.

Say what one row meansWhat good looks like

Quality before impute

Quality does not impute yet. Completeness marks high-null columns for drop or a later missing indicator (null rate above forty percent in this recipe). Validity quarantines illegal labels and nulls out-of-domain feature cells. Uniqueness keeps the latest row on entity key at decision time. The clock fails when a feature’s event time is at or after the decision time.

Prepare’s maturity job: exclude immature invoices — fourteen-day window still open, or outcome not yet available — from the labeled set Fit will freeze; count them in quality.json. On matured rows only, write label_delay_days as the median cut-to-label delay. That median sizes Fit’s embargo; it does not prove maturity. Fit owns the train / validation / test freeze. A post-cut payment offered as a feature fails the clock. Planned train-only imputation is recorded here and fitted only later on train.

Recompute the profile on kept matured rows. Write quality.json and quarantine.parquet. Pass when label validity is 100% on those rows, the key is unique, no remaining feature uses post-decision values, and quarantine rate ≤ quarantine_rate_max (task.json; this recipe’s default 0.05 is an operating threshold with an owner, not a universal law). Above that → stop.5

profile.jsonroles, plus task.json domainsPrepareFitEVERY ROW AND CELLQuality checksCompletenessValidityUniquenessClockIllegal labels andolder copiesquarantine.parquetCONTROL · PER ROWLabel maturityWindow closedand outcome available.Both, or the row is out.Immature rows:counted, neverlabeledMEASUREMENTLabel delayMedian days fromcut to label, onmatured rows only.Sizes the embargo.Never proves a row ismature.STAGE 2 WRITESquality.jsonKept, immature, andquarantined counts;label_delay_daysImputation plannedhere, fitted later ontrain onlyFIT · STAGE 5Freeze the splitMatured rows only.Embargo =label_delay_days.Test ids hashedbefore any fit
profile.jsonroles, plus task.json domainsEVERY ROW AND CELLQuality checksCompleteness · Validity · Uniqueness · ClockIllegal labels and older copiesquarantine.parquetCONTROL · PER ROWLabel maturityWindow closed and outcome available. Both, or therow is out.Immature rows: counted, neverlabeledMEASUREMENTLabel delayMedian days from cut to label, on matured rows only.Sizes the embargo. Never proves arow is mature.STAGE 2 WRITESquality.jsonKept, immature, and quarantined counts;label_delay_daysImputation planned here, fittedlater on train only↑ Prepare↓ FitFIT · STAGE 5Freeze the splitMatured rows only. Embargo = label_delay_days.Test ids hashed before any fit
Figure 2. Prepare data flow into Fit. Maturity and label_delay_days leave here; the freeze lives on Fit without spending the holdout.
days_past_duequarantine.parquet
Figure 3. One column profiled at a time. A row that fails Quality leaves the table with its reason, into quarantine.parquet.

Keep trust in forceFit without spending the holdout

Outliers as policy

Extremes are measured after impossibles were quarantined. Per numeric feature I use the modified Z-score with MAD and label |M| > 3.5 as a potential outlier, from the NIST note on Iglewicz and Hoaglin. That note is for labeling, not automatic deletion. If MAD is zero, my operating fallback is Tukey fences (Q1 − 1.5 IQR, Q3 + 1.5 IQR) — not a NIST rule.

Write outlier_policy.json: keep, log1p (skew high and min ≥ 0), cap (bounds learned later on train), or quarantine. Rare categories become OTHER later from train counts only. New quarantine → return through Quality. Cap bounds and OTHER maps are not fitted here.1

1Profileprofile.jsonPASSEvery column has one role; labeland decision time are set.2Qualityquality.jsonquarantine.parquetPASSLabels valid on kept maturedrows, key unique, clock clean,quarantine ≤ max.3Outliersoutlier_policy.jsonPASSEvery numeric feature has apolicy and a touch-rate.New quarantine from Outliers → back through QualityOUTLIER_POLICY.JSON · CALL-ORDER PATH, ILLUSTRATIVECOLUMNTRIGGERPOLICYFITTED WHENdays_past_due|M| > 3.5 flags the tailcap at p01 / p99Bounds learned on train, in Fitopen_amountskew > 1, min ≥ 0log1pNothing to fitsegmentrare levelsOTHER below 30Counts from train, in FitFlags label the tail; they never delete a row by default. Modified z uses the median and MAD; if MAD is zero, Tukey fences.
1Profileprofile.jsonPASSEvery column has one role; label anddecision time are set.2Qualityquality.jsonquarantine.parquetPASSLabels valid on kept matured rows, keyunique, clock clean, quarantine ≤ max.3Outliersoutlier_policy.jsonPASSEvery numeric feature has a policy and atouch-rate.New quarantine from Outliers → back through QualityOUTLIER_POLICY.JSON · ILLUSTRATIVEdays_past_duecap at p01 / p99Trigger: |M| > 3.5 flags the tailBounds learned on train, in Fitopen_amountlog1pTrigger: skew > 1, min ≥ 0Nothing to fitsegmentOTHER below 30Trigger: rare levelsCounts from train, in FitFlags label the tail; they never delete a row by default. If MADis zero, Tukey fences.
Figure 4. Profile, Quality, Outliers: each stage’s file and pass line. The outlier policy is learned on train only.

When a draft is cheap

A generated cleaning script can drop large open amounts to raise a later metric and still leave no quarantine file, no role list, and no clock test. Prepare still applies. Features cannot be chosen from a morning list nobody can describe.

References

  1. NIST / Iglewicz and Hoaglin, modified Z-score
  2. Say what one row means
  3. Keep trust in force
  4. ML pipeline field card
  5. ML pipeline agent recipe