## 2 Methodology  
Consider a stochastic optimization problem with a given profit function \(c(\mathbf{y},\mathbf{z})\), where \(\mathbf{y}\in\mathcal{Y}\subset\mathbb{R}^{d_{y}}\) are the random variables that affect the value of the profit function, and \(\mathbf{z}\in\mathcal{Z}\subset\mathbb{R}^{d_{z}}\) are the decision variables that are subject to a set of constraints which define the feasible region within which solutions can exist. Let \(\mathbf{x}\in\mathcal{X}\subset\mathbb{R}^{d_{x}}\) denote the contextual features that are related to the distribution of \(\mathbf{y}\). Suppose we have a new observation of the contextual data, denoted as \(\mathbf{x}_{0}\in\mathcal{X}\subset\mathbb{R}^{d_{x}}\). The CSO problem can be mathematically formulated as:  
\[\mathbf{z}^{*}(\mathbf{x}_{0})\in\arg\max_{\mathbf{z}\in\mathcal{Z}}\mathbb{E}_{\mathbf{y}} \big{[}c(\mathbf{y},\mathbf{z})\big{|}\mathbf{x}=\mathbf{x}_{0}\big{]}, \tag{1}\]  
where \(\mathbf{z}^{*}(\mathbf{x}_{0})\) denotes the expected optimal decision (oracle) under the given context \(\mathbf{x}_{0}\). A historical dataset \(\{(\mathbf{x}_{i},\mathbf{y}_{i})\}_{i=1}^{N}\) is available to solve the optimization problem (1), where \(\mathbf{x}_{i}\) and \(\mathbf{y}_{i}\) represent the historical auxiliary data of \(\mathbf{x}\) and the historical realization of \(\mathbf{y}\) for the \(i\)th sample, respectively. To solve (1), we can adopt various ML techniques, that is, we leverage the data on \(\mathbf{x}\) to predict the value of \(\mathbf{y}\) given \(\mathbf{x}=\mathbf{x}_{0}\). Under mild conditions, and with infinite data, we can obtain the point prediction \(\hat{\mathbf{y}}=\mathbb{E}[\mathbf{y}|\mathbf{x}=\mathbf{x}_{0}]\). If \(c(\mathbf{y},\mathbf{z})\) is linear in \(\mathbf{y}\), we can see from  
\[\mathbb{E}\big{[}c(\mathbf{y},\mathbf{z})|\mathbf{x}=\mathbf{x}_{0}\big{]}=c\big{(}\mathbb{E} [\mathbf{y}|\mathbf{x}=\mathbf{x}_{0}],\mathbf{z}\big{)}, \tag{2}\]  
that the point prediction \(\hat{\mathbf{y}}\) is appropriate to be incorporated into the linear objective function to derive decisions. However, (2) does not hold when \(c(\mathbf{y},\mathbf{z})\) is not linear in \(\mathbf{y}\). In this case, we thus need to estimate the conditional distribution of \(\mathbf{y}\) given \(\mathbf{x}=\mathbf{x}_{0}\). Several ways can be used to estimate this conditional distribution using \(\{(\mathbf{x}_{i},\mathbf{y}_{i})\}_{i=1}^{N}\) and approximate (1). This paper focuses on one possible approach termed the wSAA framework, motivated by a string of non-parametric ML models [10; 14], such as \(k\)NN and decision trees [10]. The wSAA framework approximate (1) as follows:  
\[\mathbf{z}_{N}^{\text{wSAA}}(\mathbf{x}_{0})\in\arg\max_{\mathbf{z}\in\mathcal{Z}}\sum_{i =1}^{N}w_{i}(\mathbf{x}_{0})c(\mathbf{y}_{i},\mathbf{z}), \tag{3}\]  
where \(\mathbf{z}_{N}^{\text{wSAA}}(\mathbf{x}_{0})\) denotes the predictive prescriptions and \(w_{i}(\mathbf{x}_{0})\) are known as weight functions [10] that measure the distances between the new observation \(\mathbf{x}_{0}\) and historical covariates \(\mathbf{x}_{i}\)\((i\in\{1,\dots,N\})\); there are various ways to determine \(w_{i}(\mathbf{x}_{0})\). As long as the weights are nonnegative and sum to one, they can be seen as the estimated conditional distribution of \(\mathbf{y}\) given \(\mathbf{x}=\mathbf{x}_{0}\)[10]. Notably, point prediction can be seen as a specific case of the distributional prediction, where the predicted distribution has all its mass at a single point.