Introduction
In real-world machine learning applications, data distributions are rarely stationary. "Distribution shift" occurs when production data deviates from the training distribution, often leading to model performance degradation. In many practical scenarios, this shift is not global but is instead localized to a subset of "corrupted" features—such as a malfunctioning sensor or a change in data collection protocols.
While existing methods can detect the presence of a shift, they often struggle to localize the specific culprit features or correct them without losing data integrity. Traditional statistical tests often fail in high-dimensional spaces, and neural-network-based imputation methods frequently suffer from "mean collapse," where the natural variance of the data is lost. This paper introduces DataFix, a framework designed to both localize and correct feature shifts using iterative adversarial learning.
Methodology
DataFix addresses the problem through two primary components: DF-Locate for localization and DF-Correct for correction.
DF-Locate: Feature Shift Localization
DF-Locate employs an iterative "search and destroy" strategy to identify corrupted features. The process begins by training a tree-based discriminator (e.g., Random Forest) to distinguish between a "Reference" (clean) dataset and a "Query" (shifted) dataset.
The system utilizes feature importance scores (such as Gini importance) to determine which dimensions contribute most to the discriminator's ability to separate the datasets. The most "guilty" features are iteratively removed until the discriminator can no longer reliably tell the two sets apart. An elbow-method heuristic is used in the final stage to prevent over-filtering and ensure only truly shifted features are removed.
DF-Correct: Feature Shift Correction
Once corrupted features are localized, DF-Correct repairs them using an adversarial approach. Unlike standard GANs that generate data from scratch, DF-Correct generates a pool of $M$ "proposals" for the corrupted values using methods like KNN, linear regression, or random sampling from the reference set.
A powerful discriminator (e.g., CatBoost) evaluates these proposals. The system iteratively updates the query samples by selecting the proposal values that minimize the discriminator's ability to identify the sample as "corrupted." This approach preserves the natural variance and "shape" of the original distribution, avoiding the pitfalls of mean-based imputation.
Experimental Evaluation
The authors evaluated DataFix across a diverse set of benchmarks:
- Real-world Datasets: 12 datasets including sensor data (Gas), medical records (Covid-19), MNIST images (flattened), and high-dimensional genomic data (Founders, Canine) with up to 198,000 features.
- Simulated Shifts: 15 custom datasets designed to test marginal mean shifts, scale shifts, and complex correlation shifts.
- Corruptions: 10 different types of manipulations (noise, shuffling, negation, etc.) applied at intensities of 5%, 10%, and 25% of features.
Results and Key Insights
The experimental results highlight several key advantages of the DataFix framework:
- Trees Over Neural Networks: Tree-based discriminators (Random Forest, CatBoost) proved significantly more effective than Multi-Layer Perceptrons (MLPs) for detecting shifts in structured data.
- Superior Localization: DataFix achieved higher F1 scores in identifying corrupted features compared to state-of-the-art statistical methods like MB-SM or KNN-KS, particularly in high-dimensional settings where other methods timed out.
- High-Fidelity Correction: DF-Correct produced datasets with the lowest empirical divergence (measured by Wasserstein distance) among 13 competing techniques, including GAIN and Sinkhorn-based optimal transport.
- Downstream Performance: Models trained on data corrected by DataFix performed nearly as well as those trained on uncorrupted data, demonstrating the practical utility of the framework for maintaining model reliability in production.
Conclusion
DataFix provides a robust solution for managing distribution shifts in tabular data by combining the interpretability of tree-based models with the power of adversarial learning. While the iterative nature of the framework introduces some computational overhead, its ability to scale to high-dimensional data and preserve distributional variance makes it a valuable tool for data maintenance. Future work may involve optimizing the proposal generation process and adapting the framework for real-time, online monitoring of data streams.
Summary updated