Hello everyone,
I'm working on a multivariate linear regression project to predict delivery durations in minutes.
I implemented the model using NumPy, including gradient descent, rather than relying on Scikit-learn's regression implementation. My model uses the following features: Distance (km), Number of stop, Package weight (kg), Departure time, Traffic index, Day of the week, Weather, Vehicle type
I used One-Hot Encoding for categorical variables and StandardScaler for numerical variables. The preprocessing steps were fitted on the training set only.
Overall test performance : MAE: 3.27 minutes, RMSE: 5.63 minutes, R²: 0.855
These results look reasonably good overall.
The problem
When I analyze the model's errors on long deliveries, I notice a significant performance degradation.
I defined long deliveries as durations above 77 minutes, based on the upper Tukey fence calculated from the training target distribution.
On the independent test set, I obtained:
- 37 long deliveries
- MAE: 14.76 minutes
- Mean signed error (prediction - actual): -13.12 minutes
This indicates that the model systematically underestimates long delivery durations.
What I have investigated so far
I also experimented with feature engineering by adding: Squared distance, Distance × traffic, Distance × number of stops
However, these additional features did not meaningfully improve overall performance or solve the long-delivery problem.
I decided to retain the original model for now.
My questions
- What are the most likely explanations for this behavior? Could it be a limitation of linear regression, insufficient representation of long-distance examples, missing features, or a combination of these factors?
- How would you investigate whether the problem comes from the data, the model's assumptions, or the feature representation?
- Would you recommend trying polynomial regression, interaction terms, a decision tree, Random Forest, or another approach?
- How can I improve predictions for long deliveries without significantly degrading performance on shorter deliveries?
- With only 37 long deliveries in the test set, what statistical precautions should I take before drawing conclusions?
I'm particularly interested in understanding the reasoning behind the diagnostic process, not just receiving a recommendation to switch algorithms.
Thank you for your insights!