A Machine Learning project for predicting food order delivery time in minutes, trained and tracked on Azure Machine Learning with MLflow.
The goal of this project is to build a regression model capable of estimating the delivery duration (Delivery_Duration_Minutes) of an order, given contextual variables such as city, driver vehicle type, order time, and geographic coordinates of the restaurant, customer, and driver.
The dataset used (OrderDeliveryData) is synthetic, which imposed significant limitations on the quality of relationships between variables and the model's final performance.
The dataset used is the Order Delivery Dataset available on Kaggle. It is a synthetic dataset that simulates food order delivery data, containing fields such as order ID, city, driver vehicle type, restaurant and customer coordinates, driver location, order timestamp, and delivery duration in minutes.
Because the data is synthetically generated, the statistical relationships between features and the target variable (Delivery_Duration_Minutes) are weak or absent, which directly impacted model performance.
- Dataset loaded from Azure ML Data Assets.
- General inspection: data types, missing values, column cardinality.
- Dropped
Order_IDas it carries no predictive value. - Selected a relevant subset of columns for training.
- Extracted temporal components from
Order_Time: year, month, day, hour, minute, day of week, and day of year. - Applied cyclical encoding of the hour (
sin/cos) to preserve the circular nature of time.
A modular pipeline was built with scikit-learn including:
- Numerical preprocessing: mean imputation + standard scaling (
StandardScaler). - Categorical preprocessing: most-frequent imputation + one-hot encoding (
OneHotEncoder). - Target transformation: logarithmic scale (
log1p/expm1) to stabilize the distribution of the target variable.
A select_model() function was defined to compare multiple candidate models (Linear Regression, Decision Tree, SVR, Random Forest) using RMSE on the validation set.
However, since the dataset is synthetic and the relationships between variables are weak or non-existent, the selection process was restricted to a single model: Decision Tree Regressor, in order to document the full training workflow without artificially inflating the comparison.
- Data split: 70% training / 21% validation / 9% test.
- Pipeline trained with
DecisionTreeRegressor. - Evaluation using MAE, RMSE, and R² metrics.
- Metrics logged to MLflow (integrated with Azure ML).
| Model | Justification |
|---|---|
DecisionTreeRegressor |
Baseline model selected given the synthetic nature of the dataset. Allows the full workflow to be documented without assuming real relationships between variables. |
| Metric | Validation | Test |
|---|---|---|
| MAE | 11.73 | 11.93 |
| RMSE | 14.44 | 14.66 |
| R² | -1.085 | -1.094 |
⚠️ A negative R² indicates the model performs worse than a trivial baseline (predicting the mean). This is expected given that the dataset is fully synthetic and contains no real statistical relationships between features and the target.
- Python 3.x
- scikit-learn — pipelines, models, and metrics
- pandas / numpy — data manipulation
- matplotlib — visualization
- Azure Machine Learning — data and workspace management
- MLflow — experiment and metric tracking
- The full regression ML workflow was successfully implemented: exploration, feature engineering, pipeline construction, training, and evaluation with MLflow tracking on Azure ML.
- The obtained metrics (R² ≈ -1.09) reflect the absence of useful signal in the synthetic dataset and do not represent a failure in the pipeline design, but rather a direct consequence of the artificial nature of the data.
- The project architecture is designed to scale easily: simply add models to the
get_models()dictionary and runselect_model()to automatically compare candidates when real data becomes available. - This project serves as a base template for similar delivery time prediction problems with real data, where significantly better performance would be expected.