Combine text and tabular data with out-of-fold summaries
Sometimes the best way to combine modalities is not to concatenate all features — let each signal produce a validated summary, then combine the summaries.
TL;DR: For support escalation, a text-only model converted decoded text into an out-of-fold escalation-risk score, which became a single feature in a structured-data model. Use out-of-fold predictions for training rows to avoid leakage. When modalities differ strongly, modular summaries beat direct fusion.
Visual Summary
The Problem
In a support-escalation project, the data had two very different signal sources: structured case information and partially decoded support text. The obvious approach would be to create thousands of TF-IDF features and append them to the smaller structured set. That can work, but sparse text features and dense structured features have different shapes, different signal-to-noise ratios, and different failure modes.
The Approach
I used a two-stage design: first, a text-only model converted decoded text into an escalation-risk score; that score became one feature in the main structured-data model. Instead of forcing the final model to learn directly from thousands of individual terms, it received a compact summary: "Given the text alone, how much escalation-related signal is present?"
Out-of-fold is critical
For training rows, the text-model score must be generated out of fold. If the text model predicts on the same rows it trained on, its score can encode target leakage and make the second-stage model look better than it really is.
Safe workflow
Create out-of-fold predictions from the text model for training rows, use those predictions as the text-risk feature, train the final model on structured features plus the out-of-fold text score, then retrain the text model on all training text for future inference.
Outcome
This modular approach produced a cleaner architecture. The final model could focus on how much the text signal mattered relative to structured case attributes, without being overwhelmed by high-dimensional sparse features. Direct fusion isn't always worse, but when modalities differ strongly, combining validated summaries is often safer and easier to reason about.
Key Takeaway
Design insight: Let each modality do its best work first. Turn each signal source into a validated summary, generate those summaries out-of-fold for training, and combine the summaries in the final model. Combine validated summaries — not only raw feature columns.
FAQ
Why not append TF-IDF directly to structured features?
Sparse text vectors and dense structured features have different shapes, signal-to-noise ratios, and failure modes. Direct fusion can create an awkward, high-dimensional feature space and is harder to validate safely.
Why must the text score be out-of-fold?
If the text model predicts on the same rows it trained on, the score can encode target leakage and make the second-stage model look better than it really is. Use out-of-fold predictions for training rows, then retrain the text model on all training text for inference.