Are Key-Foreign Key Joins Safe to Avoid when Learning High-Capacity Classifiers?

Vraj Shah, Arun Kumar, Xiaojin Zhu

TL;DR

This paper investigates whether it's safe to skip joining tables based on key-foreign key dependencies (KFKDs) when training complex machine learning models. Surprisingly, they found that high-capacity classifiers (like decision trees and ANNs) are more robust to skipping these joins than simpler linear models, challenging prior assumptions. This suggests that data scientists can potentially simplify data sourcing for ML without sacrificing accuracy, even with sophisticated models.

What Problem Does This Paper Address?

Data scientists often face a significant hurdle when preparing data for machine learning: integrating information from numerous database tables. This typically involves joining tables, which can be time-consuming and complex, especially when tables are "owned" by different teams. A previous study by Kumar et al. showed that for linear classifiers, it's often possible to safely avoid joining tables based on key-foreign key dependencies (KFKDs) without a significant drop in accuracy. This idea, termed "avoiding joins safely," relies on the observation that KFKDs create functional dependencies, and the safety of skipping a join is related to the "tuple ratio" (the ratio of tuples in the main table to the dimension table). However, this prior work was limited to linear classifiers. The authors of this paper address the question: Does this "avoiding joins safely" principle extend to more powerful, high-capacity classifiers like decision trees, SVMs, and Artificial Neural Networks (ANNs)? Prior theoretical analysis suggested that these complex models, being more prone to overfitting, might require more data and thus be less tolerant of skipping joins.

Methods

The core of this research is an extensive empirical study comparing two approaches for training classifiers:

  1. JoinAll: The standard approach where all relevant tables are joined to include all available features.
  2. NoJoin: The approach where tables linked by KFKDs are not joined, effectively discarding the "foreign features" derived from those tables.

They also introduce a NoFK approach for decision trees, which discards the foreign key itself but still joins the table.

The researchers employed a rigorous 10-fold nested cross-validation methodology to evaluate the performance of various classifiers under these different data preparation strategies. They tested several popular classifiers, including:

  • High-capacity classifiers: CART decision trees (with different splitting criteria), RBF and quadratic SVMs, and multi-layer perceptron ANNs.
  • Linear classifiers: Naive Bayes (with backward selection), logistic regression (with L1 regularization), and linear SVM.

To further understand the behavior, they conducted a Monte Carlo-style simulation study using decision trees. This involved generating synthetic data with controlled "true" distributions and varying parameters like the number of training examples, foreign key domain size, and feature dimensionality. This allowed them to stress-test the robustness of avoiding joins under various conditions, including scenarios known to be problematic for linear models.

Datasets

The study utilized seven real-world datasets previously used in the Kumar et al. paper, sourced from platforms like Kaggle and GroupLens. These datasets represent various domains, including e-commerce (Expedia), entertainment (Movies, LastFM), social networking (Yelp), and retail (Walmart). The authors note that they retained numeric features, unlike the prior work which discretized them, to generalize the problem. They also made all their code and datasets publicly available for reproducibility.

Key Insights and Ideas

  • Counter-intuitive Robustness: The most striking finding is that high-capacity classifiers (decision trees, SVMs, ANNs) are surprisingly more robust to avoiding KFK joins than linear classifiers. This directly refutes the intuition that complex models, being more prone to overfitting, would suffer more from reduced data.
  • Tuple Ratio is Less Critical for High-Capacity Models: While the tuple ratio (number of main table rows / number of dimension table rows) was a key indicator for linear models, high-capacity classifiers seem to tolerate much lower tuple ratios before significant accuracy drops occur.
  • Foreign Keys are Still Useful: The "NoFK" experiments showed that simply discarding the foreign key itself (while still joining) often leads to worse performance than even the "NoJoin" approach, indicating that the foreign key itself carries valuable information.
  • Simulation Confirms Real-World Findings: The simulation studies, particularly the "OneXr" scenario (where a single foreign feature determines the target), strongly supported the empirical results, showing that decision trees maintain accuracy even with very low tuple ratios when joins are avoided.
  • Practical Bottlenecks Addressed: The paper also tackles practical issues with large foreign key domains, proposing domain compression (hashing and sort-based methods) and smoothing techniques to make these features more manageable without sacrificing too much accuracy.

Key Results

  • Accuracy: For most datasets and classifiers, the accuracy difference between "JoinAll" and "NoJoin" was negligible (within 0.01). In cases where avoiding the join did cause a decrease in accuracy, this decrease was often smaller for high-capacity classifiers compared to linear ones.
  • Speedup: Avoiding joins significantly reduced training and evaluation times. For high-capacity classifiers, an average speedup of about 2x was observed, with some cases reaching over 6x. This is in line with the substantial speedups reported for linear models in prior work.
  • Robustness to Skew: Even in simulated scenarios with skewed foreign key distributions (which are problematic for linear models), decision trees remained robust to avoiding joins.
  • Domain Compression Effectiveness: Techniques like sort-based domain compression for decision trees showed that even with significant compression (reducing a domain of thousands to a few dozen values), the accuracy drop was minimal, and in some cases, even improved.

Limitations and Future Work

The authors acknowledge several limitations and suggest future research directions:

  • Theoretical Formalization: While they provide intuitive explanations, a formal theoretical analysis of why high-capacity classifiers are more robust to avoiding KFK joins is still needed. The existing VC dimension theory seems to predict the opposite.
  • Generalizing Dependencies: The study focused on KFKDs. Future work could explore the impact of other database dependencies (like embedded multi-valued dependencies) on ML models.
  • Broader ML Tasks: The research was limited to classification. Extending the analysis to regression and clustering tasks would be valuable.
  • Automated Advisor: The authors envision an automated "advisor" that could help data scientists decide when and how to avoid joins based on schema information and ML task characteristics.
  • Cold Start and Serving Latency: The interplay of avoiding joins with cold-start issues and latency during model serving remains an open area.

Summary updated

BibTeX
@article{shah2017are,
  author = {Vraj Shah and Arun Kumar and Xiaojin Zhu},
  title = {{Are Key-Foreign Key Joins Safe to Avoid when Learning High-Capacity Classifiers?}},
  journal = {Proc. VLDB Endow.},
  year = {2017},
  url = {https://openreview.net/forum?id=f98KtMZPJj},
}
Figure