universal-data-cleaner 2.4.0__tar.gz → 2.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (26) hide show
  1. {universal_data_cleaner-2.4.0/src/universal_data_cleaner.egg-info → universal_data_cleaner-2.5.0}/PKG-INFO +48 -1
  2. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/README.md +47 -0
  3. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/pyproject.toml +1 -1
  4. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/data_cleaner/__init__.py +3 -0
  5. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/data_cleaner/_version.py +1 -1
  6. universal_data_cleaner-2.5.0/src/data_cleaner/ml_audit.py +1212 -0
  7. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0/src/universal_data_cleaner.egg-info}/PKG-INFO +48 -1
  8. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/universal_data_cleaner.egg-info/SOURCES.txt +2 -0
  9. universal_data_cleaner-2.5.0/tests/test_ml_audit.py +765 -0
  10. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/LICENSE +0 -0
  11. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/setup.cfg +0 -0
  12. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/data_cleaner/_roles.py +0 -0
  13. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/data_cleaner/artifacts.py +0 -0
  14. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/data_cleaner/cleaner.py +0 -0
  15. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/data_cleaner/config.py +0 -0
  16. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/data_cleaner/contract.py +0 -0
  17. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/data_cleaner/decisions.py +0 -0
  18. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/data_cleaner/integration.py +0 -0
  19. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/data_cleaner/profiling.py +0 -0
  20. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/data_cleaner/py.typed +0 -0
  21. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/data_cleaner/validation.py +0 -0
  22. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/universal_data_cleaner.egg-info/dependency_links.txt +0 -0
  23. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/universal_data_cleaner.egg-info/requires.txt +0 -0
  24. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/src/universal_data_cleaner.egg-info/top_level.txt +0 -0
  25. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/tests/test_data_cleaner.py +0 -0
  26. {universal_data_cleaner-2.4.0 → universal_data_cleaner-2.5.0}/tests/test_validation.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: universal-data-cleaner
3
- Version: 2.4.0
3
+ Version: 2.5.0
4
4
  Summary: Production-ready, scikit-learn-compatible data cleaning transformer for pandas.
5
5
  Author: Haseeb Khan
6
6
  License-Expression: MIT
@@ -73,6 +73,7 @@ breaks at inference time because the median is recomputed on the new batch.
73
73
  - automatic train-schema contract inference and transform-time drift reports
74
74
  - `on_drift` policy: `raise`, `warn`, or `ignore`
75
75
  - identifier columns that are never numeric-coerced, median-imputed, or capped
76
+ - train/test split audits for duplicate, group, temporal, and target leakage
76
77
  - joblib save / load with artifact versioning
77
78
  - scikit-learn `Pipeline`, `clone`, and `get_feature_names_out` compatibility
78
79
 
@@ -345,6 +346,48 @@ The returned frame preserves the input row order and index. `tie_breaker`
345
346
  prefers non-null values, and null business keys are reported explicitly.
346
347
  The input frame is never mutated.
347
348
 
349
+ ## ML split audits
350
+
351
+ Audit a train/test split for contamination and distribution surprises before
352
+ training:
353
+
354
+ ```python
355
+ from data_cleaner import audit_split
356
+
357
+ audit = audit_split(
358
+ X_train,
359
+ X_test,
360
+ y_train,
361
+ y_test,
362
+ groups=groups, # combined train+test labels, or pass groups_test=
363
+ time_col="event_time",
364
+ id_cols=["customer_id"],
365
+ )
366
+
367
+ audit.valid # False when an error-severity finding exists
368
+ audit.findings # check, column, severity, message, train, test
369
+ audit.summary()
370
+ audit.to_markdown()
371
+ audit.raise_if_invalid()
372
+ ```
373
+
374
+ Schema problems such as missing columns, empty splits, exact duplicate overlap,
375
+ group leakage, temporal leakage, and unparseable or numeric timestamps are
376
+ errors. Near-duplicates, constant / near-constant columns, high-cardinality
377
+ identifiers, missingness and distribution shift, target-leakage heuristics, and
378
+ target shift are warnings because they can be legitimate properties of a
379
+ dataset. The audit only reports; it never repairs or reorders a split.
380
+
381
+ `groups` may hold labels for both splits (`len(X_train) + len(X_test)`); pass
382
+ `groups_test` when it only covers the training rows. Duplicate checks exclude
383
+ `id_cols` and `time_col`; declared identifiers are still reported under
384
+ `high_cardinality_identifier` when their cardinality is high. Near-duplicates
385
+ are approximated deterministically by hashing rows with numeric features
386
+ rounded to `near_duplicate_decimals` (default `3`).
387
+
388
+ Findings never include raw cell values. Messages carry column names, counts,
389
+ rates, and statistics only, so reports can be logged safely.
390
+
348
391
  ## Audit trail, manifests, and fingerprints
349
392
 
350
393
  Every learned or configured decision is recorded during `fit()` and exposed as
@@ -456,6 +499,8 @@ predictions = pipeline.predict(X_test)
456
499
  | `ReferentialIntegrityReport` | Orphan counts/keys, null keys, and validity |
457
500
  | `deduplicate_by_business_key` | Deduplicate by key and report removed rows |
458
501
  | `DeduplicationReport` | Removed rows, duplicate-key counts, and tie-breaker details |
502
+ | `audit_split` | Audit a train/test split for leakage and distribution shift |
503
+ | `SplitAudit` | Findings table with validity, Markdown, and raise helper |
459
504
  | `DataCleaner.drift_report()` | Drift findings from the last `transform` |
460
505
  | `DataCleaner.fitted_contract()` | The contract used by the fitted cleaner |
461
506
  | `DataCleaner.decision_log()` | Tidy DataFrame of cleaning decisions |
@@ -505,12 +550,14 @@ predictions = pipeline.predict(X_test)
505
550
  │ ├── cleaner.py # DataCleaner
506
551
  │ ├── decisions.py # CleaningDecision and decision log
507
552
  │ ├── integration.py # joins, referential integrity, dedup
553
+ │ ├── ml_audit.py # train/test leakage and shift audit
508
554
  │ ├── profiling.py # profiling and validation helpers
509
555
  │ ├── validation.py # expectations and ValidationReport
510
556
  │ └── py.typed # PEP 561 marker
511
557
  ├── Universal_Data_Cleaner.ipynb # end-to-end reference workflow
512
558
  ├── tests/test_data_cleaner.py # core unit and integration tests
513
559
  ├── tests/test_validation.py # expectations and integration tests
560
+ ├── tests/test_ml_audit.py # split/leakage audit tests
514
561
  ├── pyproject.toml # package metadata and dev tooling
515
562
  ├── uv.lock # reproducible dependency lock
516
563
  ├── .pre-commit-config.yaml # local lint/format/type hooks
@@ -40,6 +40,7 @@ breaks at inference time because the median is recomputed on the new batch.
40
40
  - automatic train-schema contract inference and transform-time drift reports
41
41
  - `on_drift` policy: `raise`, `warn`, or `ignore`
42
42
  - identifier columns that are never numeric-coerced, median-imputed, or capped
43
+ - train/test split audits for duplicate, group, temporal, and target leakage
43
44
  - joblib save / load with artifact versioning
44
45
  - scikit-learn `Pipeline`, `clone`, and `get_feature_names_out` compatibility
45
46
 
@@ -312,6 +313,48 @@ The returned frame preserves the input row order and index. `tie_breaker`
312
313
  prefers non-null values, and null business keys are reported explicitly.
313
314
  The input frame is never mutated.
314
315
 
316
+ ## ML split audits
317
+
318
+ Audit a train/test split for contamination and distribution surprises before
319
+ training:
320
+
321
+ ```python
322
+ from data_cleaner import audit_split
323
+
324
+ audit = audit_split(
325
+ X_train,
326
+ X_test,
327
+ y_train,
328
+ y_test,
329
+ groups=groups, # combined train+test labels, or pass groups_test=
330
+ time_col="event_time",
331
+ id_cols=["customer_id"],
332
+ )
333
+
334
+ audit.valid # False when an error-severity finding exists
335
+ audit.findings # check, column, severity, message, train, test
336
+ audit.summary()
337
+ audit.to_markdown()
338
+ audit.raise_if_invalid()
339
+ ```
340
+
341
+ Schema problems such as missing columns, empty splits, exact duplicate overlap,
342
+ group leakage, temporal leakage, and unparseable or numeric timestamps are
343
+ errors. Near-duplicates, constant / near-constant columns, high-cardinality
344
+ identifiers, missingness and distribution shift, target-leakage heuristics, and
345
+ target shift are warnings because they can be legitimate properties of a
346
+ dataset. The audit only reports; it never repairs or reorders a split.
347
+
348
+ `groups` may hold labels for both splits (`len(X_train) + len(X_test)`); pass
349
+ `groups_test` when it only covers the training rows. Duplicate checks exclude
350
+ `id_cols` and `time_col`; declared identifiers are still reported under
351
+ `high_cardinality_identifier` when their cardinality is high. Near-duplicates
352
+ are approximated deterministically by hashing rows with numeric features
353
+ rounded to `near_duplicate_decimals` (default `3`).
354
+
355
+ Findings never include raw cell values. Messages carry column names, counts,
356
+ rates, and statistics only, so reports can be logged safely.
357
+
315
358
  ## Audit trail, manifests, and fingerprints
316
359
 
317
360
  Every learned or configured decision is recorded during `fit()` and exposed as
@@ -423,6 +466,8 @@ predictions = pipeline.predict(X_test)
423
466
  | `ReferentialIntegrityReport` | Orphan counts/keys, null keys, and validity |
424
467
  | `deduplicate_by_business_key` | Deduplicate by key and report removed rows |
425
468
  | `DeduplicationReport` | Removed rows, duplicate-key counts, and tie-breaker details |
469
+ | `audit_split` | Audit a train/test split for leakage and distribution shift |
470
+ | `SplitAudit` | Findings table with validity, Markdown, and raise helper |
426
471
  | `DataCleaner.drift_report()` | Drift findings from the last `transform` |
427
472
  | `DataCleaner.fitted_contract()` | The contract used by the fitted cleaner |
428
473
  | `DataCleaner.decision_log()` | Tidy DataFrame of cleaning decisions |
@@ -472,12 +517,14 @@ predictions = pipeline.predict(X_test)
472
517
  │ ├── cleaner.py # DataCleaner
473
518
  │ ├── decisions.py # CleaningDecision and decision log
474
519
  │ ├── integration.py # joins, referential integrity, dedup
520
+ │ ├── ml_audit.py # train/test leakage and shift audit
475
521
  │ ├── profiling.py # profiling and validation helpers
476
522
  │ ├── validation.py # expectations and ValidationReport
477
523
  │ └── py.typed # PEP 561 marker
478
524
  ├── Universal_Data_Cleaner.ipynb # end-to-end reference workflow
479
525
  ├── tests/test_data_cleaner.py # core unit and integration tests
480
526
  ├── tests/test_validation.py # expectations and integration tests
527
+ ├── tests/test_ml_audit.py # split/leakage audit tests
481
528
  ├── pyproject.toml # package metadata and dev tooling
482
529
  ├── uv.lock # reproducible dependency lock
483
530
  ├── .pre-commit-config.yaml # local lint/format/type hooks
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "universal-data-cleaner"
7
- version = "2.4.0"
7
+ version = "2.5.0"
8
8
  description = "Production-ready, scikit-learn-compatible data cleaning transformer for pandas."
9
9
  readme = "README.md"
10
10
  license = "MIT"
@@ -30,6 +30,7 @@ from .integration import (
30
30
  deduplicate_by_business_key,
31
31
  diagnose_join,
32
32
  )
33
+ from .ml_audit import SplitAudit, audit_split
33
34
  from .profiling import (
34
35
  assert_frame_clean,
35
36
  dataset_summary,
@@ -62,11 +63,13 @@ __all__ = [
62
63
  "Expectation",
63
64
  "JoinDiagnosis",
64
65
  "ReferentialIntegrityReport",
66
+ "SplitAudit",
65
67
  "ValidationReport",
66
68
  "ValidationResult",
67
69
  "__version__",
68
70
  "assert_frame_clean",
69
71
  "assert_schema_stable",
72
+ "audit_split",
70
73
  "between",
71
74
  "check_referential_integrity",
72
75
  "compare_fingerprints",
@@ -1,4 +1,4 @@
1
1
  """Single source of truth for the package version."""
2
2
 
3
- __version__ = "2.4.0"
3
+ __version__ = "2.5.0"
4
4
  _ARTIFACT_VERSION = 2