Do not ask ML to learn what a formula already knows

Use domain knowledge as a benchmark. Test whether ML adds useful correction — either as a feature or via explicit residual modeling.

Feature EngineeringResidual ModelingBaselineModel Validation

TL;DR: Use domain knowledge as a benchmark. Then test whether ML adds useful correction. A formula as a feature is not the same as training a residual model.

Visual Summary

The Problem

When predicting delivery time, you often have a defensible baseline: Estimated ETA ≈ distance ÷ expected speed. The question is not whether to use that formula, but how.

There is an important distinction: using a formula as a feature is not the same as training a residual model.

The Approach

There are at least three reasonable ways to use a domain formula in a predictive model.

1. Use the formula directly

This is appropriate when the relationship is stable, explainability matters, and the missing variation is limited. But a simple baseline may miss traffic, local geography, preparation delays, and operational variation.

2. Give the formula output to a model as a feature

The model predicts the final target directly. This lets the model use the baseline alongside other signals. It is often a strong practical baseline, but the model is still free to learn the whole target from scratch.

3. Model the residual explicitly

First calculate the baseline estimate. Then train the model on Actual ETA − baseline ETA. The final prediction becomes Baseline ETA + predicted correction. This focuses the model on a narrower question: When is the baseline wrong—and by how much?

Residual modelling can be useful when the formula captures stable structure and the remaining error has learnable patterns. But it is not automatically better. It depends on whether the baseline is meaningful, its error is stable enough to learn, the remaining inputs explain that error, and evaluation reflects the real prediction-time setting.

TL;DR: Use domain knowledge as a benchmark. Then test whether ML adds useful correction. A formula as a feature is not the same as training a residual model.

Key Takeaway

Design insight: Use domain knowledge as a benchmark. Then test whether ML adds useful correction.

FAQ

Is a formula as a feature the same as residual modeling?

No. Using a formula as a feature lets the model predict the target directly using the baseline alongside other signals. Residual modeling trains the model to predict the error (actual minus baseline) and adds the correction to the baseline.

When should you use residual modeling?

Use it when the baseline captures stable structure and the remaining error has learnable patterns, with good validation that reflects the real prediction-time setting.

Comments

ForecastingTime SeriesMachine LearningPredictive ModelingFeature EngineeringNLPLLM ApplicationsDocument AICustomer SegmentationTelecom AnalyticsAnomaly DetectionRecommendation SystemsGraph AnalyticsGeospatial AnalyticsStatistical AnalysisExperimentation & A/B TestingPythonRSQLDataikuShiny DashboardsStreamlit AppsData VisualizationProduction MLModel EvaluationDecision SystemsData AutomationBusiness Analytics