Data ScienceFeature engineering and data quality

Detect accidental identifiers in a training dataset

PK
Pankit Kumar
Sr. Data Scientist at Parexel (a Goldman Sachs–backed company) · 20 September 2026 · 2 min read
Technically reviewed by Ishaan Sharma
In this article (3 sections)

Transaction IDs, row numbers and export indexes can let a model memorize records or encode time and source. A uniqueness screen finds candidates quickly, but it also flags legitimate continuous measurements. Structure starts the audit; semantics decide the action.

Run a four-column screen

Our 300-row table contains unique transaction_id, 80 repeated customer_id values, a linearly varying amount and a constant column.

The near-unique rule flags any column with uniqueness ratio above 0.98. It correctly flags transaction ID. It also flags amount because all 300 numeric values are distinct. Customer ID has ratio 0.2667 and is not flagged; constant is detected separately.

python
from feature_cases import identifier_case

r = identifier_case()
audit = {row['feature']: row for row in r['audit']}
assert audit['transaction_id']['identifier_candidate']
assert audit['amount']['identifier_candidate']
assert not audit['customer_id']['identifier_candidate']
assert audit['constant']['constant']
print(r)

Run the audit in the feature-engineering lab. The amount false positive is intentional: uniqueness alone cannot classify feature meaning.

Look for memorization and hidden order

Inspect names, types, examples, generation logic and time correlation. Sequential IDs can encode chronology. UUIDs can reveal source systems through prefixes. Hashing an ID does not remove identity; it merely changes representation.

Group splits by the entity that repeats at deployment. A customer ID may be useful for retrieving history but dangerous as a direct categorical feature when evaluation randomly mixes the same customers across folds. Report new-entity and returning-entity performance separately.

Check high-cardinality category coefficients, train-test category overlap and performance after removing candidates. Target encoding IDs is especially risky because rare categories can memorize outcomes.

Preserve identifiers for lineage and joins in metadata while excluding them from the model matrix. Feature allowlists are safer than trying to remove every suspicious column from a broad extract.

Exercise: add sequential row number, random UUID and a valid continuous timestamp. Measure their correlation with split and target, then write an allowlist validator that separates metadata from predictors.

NeuraPath's Data Science course teaches identifier audits with structural and semantic evidence. A uniqueness flag is a question, not an automatic deletion rule.

Continue learning

This article is part of the Feature engineering and data quality sequence. Use the neighbouring tasks when you need the prerequisite or the next application.

PK
Pankit Kumar
Lead Instructor, NeuraPath Academy

Pankit Kumar has 10 years in Data Science & AI, building and shipping production systems in regulated pharma and clinical environments. He is a freelance trainer at Boston Institute of Analytics, AnalytixLabs and Scaler, and has taught this material to thousands of working professionals.

This article is part of our Data Science programme — 6 months. From data foundations to machine learning, deep learning and deployment.

Explore Data Science
Counselling is free · no obligation

Not sure which programme fits?

Tell us your background and we will map it to the right entry point — including saying so when a cheaper programme is the better fit. A counsellor replies within one working day.