Skip to content
#Machine Learning#Data Quality#Post-Mortem#Python

What a 93% Accuracy Hid: Circular Features in Synthetic Data

A technical post-mortem on detecting data leakage in an AI job displacement classification model, and our transition to empirical Statistics Canada labour market series.

Henish Patel3 min read

High test accuracy is frequently treated as the primary milestone of a machine learning workflow. In reality, an unusually high score on a noisy real-world classification task is often an alarm: it suggests that the model is exploiting an artifact of the data pipeline rather than learning a genuine predictive relationship.

In our project evaluating occupational displacement risks from automation (dataset-datascience), an initial Random Forest model demonstrated 93% classification accuracy. On the surface, the metric looked impressive. In reality, it was hiding a fundamental failure of synthetic data engineering: circular label leakage.

The Warning Signs: Baseline Comparisons

Before accepting a model metric, standard data practice requires testing against trivial baselines. When evaluating our multiclass displacement predictions, the benchmark metrics immediately raised suspicion:

  • Majority Class Baseline: 77% accuracy (achieved simply by predicting the dominant label without looking at any features).
  • Single-Feature Logistic Regression: 91% accuracy (achieved using only a normalized risk score).
  • Random Forest Classifier: 93% accuracy.

A full non-linear ensemble achieved only a marginal 2% improvement over a single-variable linear baseline. In real-world labour market statistics, occupational vulnerability is multidimensional, shaped by educational attainment, unionization density, geographical concentration, and capital expenditure on automation. A single variable predicting 91% of occupational transitions was implausible.

Model Accuracy Comparison:
+-----------------------------------+----------+
| Model / Benchmark                 | Accuracy |
+-----------------------------------+----------+
| Majority Class Baseline           |   77%    |
| Single-Feature Logistic (Linear)  |   91%    |
| Random Forest (Full Feature Set)  |   93%    |
+-----------------------------------+----------+

Root Cause Analysis: The Circular Generator

Investigating the dataset provenance revealed how the synthetic generator had constructed the tabular rows. The target variable (Displacement_Risk) had been assigned using a deterministic algebraic score:

# Synthetic generation snippet that introduced circular leakage
composite_score = (
    0.45 * automation_exposure
    + 0.35 * routine_task_ratio
    - 0.20 * educational_credential_barrier
)

# Label assignment based on arbitrary thresholds
df["Displacement_Risk"] = pd.cut(
    composite_score,
    bins=[-np.inf, 0.35, 0.65, np.inf],
    labels=["Low", "Moderate", "High"]
)

# Feature table export included normalized components of the generator formula
df["Task_Automation_Index"] = composite_score + np.random.normal(0, 0.02, size=len(df))

The feature set given to the classifier included Task_Automation_Index—which was essentially the generator formula with negligible Gaussian noise. The Random Forest was not identifying latent signals in workplace employment shifts. It was merely reverse-engineering the arithmetic thresholds of the synthetic Python script that created the data.

Measuring the Leakage

To verify this hypothesis, we conducted an ablation test by systematically dropping suspected columns:

# Ablation test: removing formulaic features
leakage_features = ["Task_Automation_Index", "Composite_Vulnerability_Score"]
X_sanitized = X.drop(columns=leakage_features)

model.fit(X_sanitized, y)
sanitized_accuracy = model.score(X_sanitized_test, y_test)
# Result dropped from 93% to the 77% majority baseline

When formulaic columns were removed, the model collapsed to the 77% majority baseline. The remaining synthetic features—such as synthetic age distributions and regional tags—contained zero true explanatory power because their underlying distributions were completely independent of occupational reality.

The Rebuild: Ground Truth from Statistics Canada

Attempting to patch synthetic noise into an ungrounded generator produces fragile artifacts. We decided to retire the synthetic dataset and rebuild the entire analysis from official, empirical government sources:

  1. Statistics Canada Labour Force Survey (LFS): Public use microdata files (PUMF) capturing empirical employment counts, median hourly wages, full-time/part-time splits, and demographic breakdowns across Canada.
  2. National Occupational Classification (NOC 2021): Standardized 5-digit occupational unit groups providing consistent unit-of-analysis definitions.
  3. Empirical Task Exposure Indices: Mapping occupational task statements (physical manipulation, cognitive synthesis, interpersonal negotiation) from validated external research rather than generated heuristics.

By moving to empirical data tables, we eliminated synthetic circularity. While empirical data carries lower headline accuracy due to genuine socioeconomic variance, it provides actionable, scientifically defensible insights into regional labor adjustments.

Practical Takeaways

  1. Always measure the dummy baseline: A 93% accuracy metric is unimpressive if the majority class accounts for 77% of samples.
  2. Inspect single-variable models: If a simple linear model on one variable captures 98% of the complex model's performance, inspect the variable definition for label leakage.
  3. Beware of self-referential synthetic datasets: When generating synthetic data for tabular testing, ensure that feature columns and target variables do not share identical underlying mathematical definitions.

Henish Patel

B.Sc. Computer Science student at Algoma University (graduating December 2026). Focusing on data pipelines, machine learning engineering, and production systems.