Stochastic Optimization Forests

Nathan Kallus, Xiaojie Mao

Abstract

Contextual Stochastic Optimization (CSO) requires making decisions under uncertainty based on observed features. Traditional "predict-then-optimize" methods often fail to account for how prediction errors impact final decision costs. This paper introduces Stochastic Optimization Forests (StochOptForest), which directly optimize decision quality during tree construction. By employing second-order perturbation analysis, StochOptForest provides a computationally efficient way to grow optimization-aware trees, outperforming standard random forests in risk-sensitive tasks like portfolio management and logistics.

The Challenge of Contextual Optimization

In many industries, from finance to supply chain management, practitioners face the problem of making a decision $z$ to minimize an expected cost $c(z; Y)$ given a set of features $X$. The traditional approach is to first train a model (like a Random Forest) to predict the uncertain variable $Y$ from $X$ by minimizing Mean Squared Error (MSE), and then solve the optimization problem using that prediction.

However, this "predict-then-optimize" workflow has a major flaw: it treats all prediction errors equally. In reality, errors in certain parts of the distribution—such as the tails in risk management—can lead to significantly worse decisions than errors elsewhere. To address this, a model should ideally be "optimization-aware," splitting its data based on the impact on the final decision cost rather than just predictive accuracy.

Optimization-Aware Tree Splitting

StochOptForest grows trees by evaluating potential splits based on how much they reduce the expected decision risk. While evaluating every possible split by re-solving the full optimization problem is computationally prohibitive, the authors propose two approximate splitting criteria: Approximate Risk (apx-risk) and Approximate Solution (apx-soln).

Partitioning of the feature space into decision regions based on optimal policies.
The decision tree structure representing the hierarchical splits for the decision regions.

These approximations are made possible through second-order perturbation analysis. By calculating the gradient and Hessian of the cost function at the parent node, the algorithm uses Taylor expansions to estimate the change in the optimal decision and cost for any given partition. This approach transforms a heavy optimization task into a series of fast linear algebra operations, allowing the forest to scale to large datasets.

Empirical Performance and Insights

The researchers validated StochOptForest using synthetic and real-world datasets, including portfolio optimization and travel time estimation using Uber Movement data.

  • Decision Quality: In portfolio tasks focused on minimizing Conditional Value-at-Risk (CVaR), StochOptForest significantly outperformed standard Random Forests and Generalized Random Forests (GRF). It successfully identified features that governed the variance and skewness of returns, which are critical for risk-sensitive decisions but often ignored by MSE-based models.
  • Computational Speed: The approximate splitting criteria achieved a 100x to 400x speedup compared to an "oracle" method that re-optimizes at every split, while maintaining nearly identical decision quality.
  • Handling Constraints: The method naturally incorporates both deterministic and stochastic constraints (e.g., budget limits), ensuring that the tree splits focus on regions where the constraints are most impactful.

Conclusion

StochOptForest represents a significant step toward integrating machine learning with decision-making. By making the learning process aware of the downstream optimization task, it produces more robust policies for complex, real-world environments. Future research may explore extending these techniques to non-smooth cost functions and distributionally robust optimization frameworks.

Summary updated

BibTeX
@inproceedings{kallus2023stochastic,
  author = {Nathan Kallus and Xiaojie Mao},
  title = {{Stochastic Optimization Forests}},
  booktitle = {Manag. Sci},
  year = {2023},
  url = {https://openreview.net/forum?id=7GlJHd0zfF},
}
Figure