--- stage: 5 type: note status: reference tags: [stage-5, note] --- # RetainIQ — Data Remediation Log *The governance artifact closing the data-preparation stage: a complete, auditable record of every data-preparation and remediation decision, with rationale and impact. Modeled on CRISP-DM's **Data Cleaning Report** (+ Derived Attributes / Generated Records reports) and the **Datasheets for Datasets** preprocessing section. The point (per CRISP-DM): document, in detail, every decision and action and its possible impact, so a reviewer can verify the preparation didn't distort the data.* **Dataset:** IBM HR Attrition (synthetic) standing in for RetainIQ training data · **Raw copy retained, unmodified:** `WA_Fn-UseC_-HR-Employee-Attrition.csv` · **Reproducibility:** fixed `random_state`; all *learned* steps fit on training only. --- ## Log | ID | Stage (CRISP-DM) | Issue / reason | Action taken | Parameters | Scope & leakage-safety | Applied or Demonstrated | Impact | |---|---|---|---|---|---|---|---| | R-01 | Select/Clean | 3 constant columns carry no information | Drop `EmployeeCount`, `StandardHours`, `Over18` | — | Whole dataset (fixed, row-wise → no leakage) | **Applied** | 35 → 32 cols | | R-02 | Select/Clean | `EmployeeNumber` is an identifier (memorization/leakage + privacy) | Drop it | — | Whole dataset (fixed) | **Applied** | removes ID | | R-03 | Construct | Need a numeric target | Define `y` = Attrition (Yes→1, No→0) | — | Whole dataset (fixed) | **Applied** | 30 features, 1 target | | R-04 | Format | Models need numeric inputs; text categories have no order | One-hot encode 7 categoricals (BusinessTravel, Department, EducationField, Gender, JobRole, MaritalStatus, OverTime) | drop_first=False | **Fit on train**, applied to all (pipeline) | **Applied** | 30 → 51 features | | R-05 | Format | Ordinal scales are *ordered* categories | Keep encoded ordinals as integers (Education, JobLevel, satisfaction/involvement/WLB scales, StockOptionLevel) — do **not** one-hot | — | n/a (fixed) | **Applied** | preserves order | | R-06 | Format | Features span very different ranges; weight/distance-based models let big-magnitude features dominate | **Scale numeric features (StandardScaler / z-score)** | mean & SD per feature | **Fit on train**, applied to all (pipeline) | **Applied — logistic-regression recipe only** (tree/boosting skip scaling) | numerics on one 0-centered scale | | R-07 | Construct (modeling) | Class imbalance 5.2:1 → model defaults to "stays" | Class weights (`class_weight="balanced"`) | leaver weight ≈5.2× (from train class counts) | At model fit (train) | **Applied** | model attends to minority | | R-08 | Construct | P-01 — proxy/protected-signal bias | Compared biased, all-3-attribute mitigation, and **age-only** CorrelationRemover | sensitive considered = Age, Gender, MaritalStatus | **Fit on train** | **Applied — age-only deployed (v2.0)** | age-only closes the ADEA gap (EOD 0.369→0.045) with no gender regression / no accuracy loss; see R-16 | | R-09 | Clean | Missing values | Impute — numeric: median; categorical: mode | learned from **train** | Train-only | **Demonstrated** (actual data has 0 missing) | technique shown on sample | | R-10 | Clean | Duplicate records | Detect & drop exact duplicates | — | before the split | **Demonstrated** (no dupes in actual data) | technique shown on sample | | R-11 | Clean | Inconsistent / invalid entries | Standardize (e.g., "Y"→"Yes"); flag out-of-range (Age 199) → impute/correct | Age valid range 16–90 | — | **Demonstrated** | technique shown on sample | | R-12 | Privacy | Re-identification risk (real deployment) | k-anonymity via Age generalization (bands) | quasi-identifiers: Age, Dept, Gender, JobRole, MaritalStatus | — | **Demonstrated, not applied** (synthetic data → no real subjects) | uniques shown to drop sharply | | R-13 | Privacy | Individual value disclosure (real deployment) | Differential privacy (calibrated noise) | illustrative Laplace noise | — | **Demonstrated, not applied** | per-person scramble; aggregates hold at scale | | **R-16** | **Deploy (Stage 5)** | **Which trained model to deploy: biased champion vs bias-mitigated variant** | **Deploy the biased champion v1.0 with the residual disparity disclosed + a monitoring/revisit commitment** | held-out evidence: age EOD 0.369→0.052 under mitigation, at ROC/PR −0.04 | Decision recorded in the **Model Card §8** | **Resolved (deploy-with-disclosed-residual-risk)** | age/marital-status disparity becomes a named monitoring target | ## Applied vs. demonstrated (summary) - **Applied to the model pipeline:** R-01–R-08 (drops, target, one-hot, ordinal handling, **scaling**, class weights, and the two P-01 treatments). The *learned* transforms — one-hot (R-04), scaling (R-06), CorrelationRemover (R-08) — are fit on **training data only**; class weights (R-07) are derived from the training class counts. **Scaling (R-06) applies only to the logistic-regression recipe**; tree and gradient-boosting recipes skip it (scale-invariant). - **Demonstrated only:** R-09–R-13. The actual dataset is clean (0 missing, no duplicates) so no cleaning was *needed*; privacy PETs aren't applied because the data is synthetic (no real individuals to protect). In a real RetainIQ deployment, R-09–R-13 would be applied. *(This demonstrate-vs-apply distinction is itself a documented governance decision.)* ## Notes - **Raw data retained** unmodified for reproducibility and audit. - **No leakage:** fixed row-wise edits (R-01–R-03, R-05) done on full data; all distribution-learned steps (R-04 one-hot, R-06 scaling, R-08 CorrelationRemover) fit on train only. - **Bias watch:** protected attributes (Age, Gender, MaritalStatus) deliberately *retained* through prep so fairness can be measured; the use decision is handled via R-08, and the deploy decision via **R-16** (resolved above — biased champion deployed with disclosure and a monitoring commitment). ## References - Chapman, P., et al. (2000). *CRISP-DM 1.0: Step-by-Step Data Mining Guide* — Data Preparation phase. https://www.kde.cs.uni-kassel.de/lehre/ws2012-13/kdd/files/CRISPWP-0800.pdf - Gebru, T., et al. (2018). *Datasheets for Datasets* — Preprocessing/cleaning/labeling section. https://arxiv.org/abs/1803.09010 - *(Governance-level, optional:)* W3C **PROV** (data provenance); **DAMA-DMBOK** (data-quality management).