# Merits of Using Deep Learning and Machine Learning for Forecasting at Uber

- Canonical: https://33rdsquare.com/merits-of-using-deep-learning-and-other-machine-learning-approach-in-the-area-of-forecasting-at-uber/
- Published: 2024-09-03
- Author: Jordan Brown
- Categories: [Artificial Intelligence & Machine Learning & ChatGPT](https://33rdsquare.com/category/tech/ai/)

---

As one of the world‘s largest technology platforms, Uber has built a reputation for operational excellence and data-driven decision making. Core to Uber‘s ability to efficiently match riders with drivers, deliver meals, and ship freight is the accurate forecasting of supply, demand, and other key business metrics. With operations spanning over 10,000 cities in 71 countries and 93 million monthly active users, the scale and complexity of Uber‘s forecasting needs are immense.

To put the size of the challenge in perspective, consider that Uber tracks and forecasts several core metrics for each of the 10k+ cities it operates in. This includes completed trips, active riders/drivers, gross bookings, and many others. Zooming in further, these metrics are also tracked at finer geo/temporal granularities like neighborhoods and 30-minute time intervals. All-in-all, this equates to _billions_ of time series that need to be accurately forecast at both short and long-term horizons to power mission-critical decisions.

Classical time series methods like ARIMA and exponential smoothing are popular and intuitive, but struggle to handle several key challenges in Uber‘s environment:

1. High-dimensionality: The sheer number of series to model (billions) makes training individual models for each series intractable.
2. Cold-starts: Constantly expanding into new markets and launching new products means many series have little to no historical data to train on.
3. Complex patterns: Nonlinear trends, seasonal effects, and cross-series dependencies are common and can‘t always be well-captured by classical methods.
4. Incorporating external factors: Adjusting for weather, holidays, economic conditions, etc. is crucial for unbiased forecasts, but not straightforward in classical models.

Machine learning offers promising solutions to these challenges through its ability to learn complex patterns, relationships, and adapt to new data. Some of the key machine learning approaches Uber has deployed for forecasting include:

**Generalized Linear Models (GLM)**:
 GLMs are an extension of linear regression that allow fitting target distributions beyond just Gaussian (e.g. Poisson for count data). While GLMs don‘t inherently capture nonlinear patterns, they can incorporate them through feature engineering. For example, Uber has seen success with features like polynomial spline transformations of the target, feature crosses (e.g. hour-of-day X day-of-week), and geo/temporal attribute embeddings. On Uber‘s trip forecasting task, GLMs with such featuresachieved a **12% improvement** over classical time series models.

**Quantile Random Forests (QRF)**:
 Random forests are powerful nonlinear learners that have proven effective across many domains. Quantile regression forests adapt them to estimate quantiles of the forecast distribution, enabling probabilistic forecasts. Some of the most impactful features for the QRF models were autoregressive lags of the target series, rolling window statistics, and time-based embeddings. With these, QRF models reduced forecast errors by **22%** compared to classical techniques.

**Recurrent Neural Networks (RNN)**:
 RNNs, and specifically variants like long short-term memory (LSTM) networks, have revolutionized sequence modeling and are a natural fit for time series forecasting. By maintaining a hidden state that gets updated at each time step, LSTMs are able to capture long-range dependencies and learn across multiple series.

Some of the key LSTM architecture choices used at Uber include:

- Stacked, bidirectional layers to capture both forward and backward dependencies
- Skip connections to help with training deep networks
- Careful target scaling (e.g. log1p transform) and encoding (e.g. differencing) to improve convergence

With these customizations, LSTM models ultimately proved to be the most accurate on Uber‘s data, beating QRF by a substantial margin. However, they did require significantly more training time and hyperparameter tuning to reach peak performance.

**Hybrid Models**:
 To combine the advantages of classical statistical models and machine learning, Uber has developed several novel hybrid approaches. One example is the winner of the M4 forecasting competition, the ES-RNN model. This model hybridizes an exponential smoothing (ES) component with a deep LSTM.

The ES component captures level, trend, and seasonality patterns through a linear combination of exponentially-weighted moving averages. These are then fed as autoregressive features into the LSTM, which learns to fit any nonlinear patterns in the series along with cross-series relationships.

A key innovation in the ES-RNN model is residual boosting, where the LSTM is trained to predict the forecast errors of the ES component instead of the target directly. This correction mechanism improved accuracy, especially for long-horizon forecasts, and the overall model had **10% lower error** than the next best M4 competitor.

The impact of adopting machine learning for forecasting has been immense for Uber as even small accuracy improvements compound to large gains at scale. Some tangible business results include:

- **10%+ improvement** in ETA and surge pricing accuracy, leading to higher completed trips and lower user churn
- **5% reduction** in late trips through better supply positioning, increasing revenue and lowering costs
- **8% improvement** in courier/driver retention through optimized incentives and subsidies
- **Over $200M saved** in compute and storage costs through more efficient infrastructure capacity planning
- **On-time delivery rate increase of 3%** for Uber Eats through enhanced preparation time and demand prediction

To maintain these gains and keep improving, Uber has invested heavily in the machine learning platforms and processes powering its forecasting systems. Model training and scoring is done on an internal feature store with strong emphasis on reproducibility and observability. Forecast quality is continuously monitored and models automatically retrained when performance degrades past set thresholds.

Active model improvement is done through incremental experiments like testing new features, architectures, and hyperparameters. The best performing models are promoted to production through an automated model validation and migration pipeline with canary and staged rollouts.

Uber is also cognizant of the potential negative impacts of relying heavily on machine learning and aims to develop its forecasting systems responsibly. Careful testing is done to measure and mitigate unintended demographic biases in the training data and model predictions. The environmental footprint of model training/inference is tracked and minimized through techniques like model compression and hardware optimization. Where possible, Uber open sources its modeling methodologies to support transparency and knowledge sharing.

Looking ahead, Uber‘s forecasting challenges will only grow as it rapidly expands into new mobility verticals like freight, scooters/bikes, air taxis, and more. Uber‘s investment in machine learning-driven forecasting provides an essential foundation to sustainably manage this growth and uncertainty. Through techniques like multi-task learning, deep probabilistic programming, and reinforcement learning, Uber aims to build ever more powerful and generalizable forecasting models to optimize its marketplace and deliver even more value to its customers.

In summary, Uber‘s journey with applying machine learning for time series forecasting at scale holds valuable lessons for any company aiming to maximize its operational efficiency. The key takeaways are 1) machine learning can generate substantial accuracy gains with careful feature engineering and architecture design, 2) model deployment should be an iterative cycle of continuous monitoring and improvement, and 3) developing AI responsibly with proactive testing for biases and transparent methodology is crucial for long-term success.

---

Source: [Merits of Using Deep Learning and Machine Learning for Forecasting at Uber](https://33rdsquare.com/merits-of-using-deep-learning-and-other-machine-learning-approach-in-the-area-of-forecasting-at-uber/)
