---
title: "Discussion on \"How to Detect Hidden Target Leakage in Public Datasets with Python and a Dependency Graph\" | Hashnode"
description: "Discussion on \"How to Detect Hidden Target Leakage in Public Datasets with Python and a Dependency Graph\". Some time ago, I gave a machine learning model five columns from a public CDC dataset and asked it to predict a sixth column from the same file. The model scored an R² of 0.998, which is about as clos"
url: "https://hashnode.com/posts/how-to-detect-hidden-target-leakage-in-public-datasets-with-python-and-a-dependency-graph/6aaec60b559dfa1d9e4f1ddc"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to Detect Hidden Target Leakage in Public Datasets with Python and a Dependency Graph](https://freecodecamp.org/news/how-to-detect-hidden-target-leakage-in-public-datasets-with-python-and-a-dependency-graph?utm_source=hashnode&utm_medium=feed)

Some time ago, I gave a machine learning model five columns from a public CDC dataset and asked it to predict a sixth column from the same file. The model scored an R² of 0.998, which is about as clos

Sep 19 · 36 min read · freecodecamp.org  
Read the article

-   [#python](https://hashnode.com/tag/python)
-   [#data-analysis](https://hashnode.com/tag/data-analysis)
-   [#dependency-graph](https://hashnode.com/tag/dependency-graph)
-   [#machine-learning](https://hashnode.com/tag/machine-learning)

## Written by

[Kayode Adeniyi](https://hashnode.com/@mkbadeniyi)

@mkbadeniyi · London, UK

  
[View profile](https://hashnode.com/@mkbadeniyi)

AI Research Engineer

## Responses 2

Markdown supported · ⌘↵ to post

[Puneet Khandelwal](https://hashnode.com/@lifestyle4u)

[Sep 20](https://hashnode.com/posts/how-to-detect-hidden-target-leakage-in-public-datasets-with-python-and-a-dependency-graph/6aaec60b559dfa1d9e4f1ddc/comment/6ab0027215bc8f0e72f2e3d0)

Building that dependency graph to trace feature lineage is such a clean way to catch silent leakage before training.

[Mihai\_LeanZero](https://hashnode.com/@mihaileanzero)

[Sep 20](https://hashnode.com/posts/how-to-detect-hidden-target-leakage-in-public-datasets-with-python-and-a-dependency-graph/6aaec60b559dfa1d9e4f1ddc/comment/6aaf4f400dbe5113961c0171)

Really solid approach, the dependency-graph angle catches a whole class of leakage that column-correlation checks miss entirely. One kind it won't catch though: row-level leakage, like the same census tract showing up in both the train and test fold across different years of a longitudinal file. No column is derived from another there, so the lineage manifest looks clean, but the model is still seeing the answer wearing a different row index. Worth a companion check that groups by entity ID before the K-fold split runs, not just the column graph.
