b

DiscoverSearch
About
My stuff
Decomposition of Uncertainty in Bayesian Deep Learning for Efficient and Risk-sensitive Learning
2017·arXiv
Abstract
Abstract

Bayesian neural networks with latent variables are scalable and flexible probabilistic models: They account for uncertainty in the estimation of the network weights and, by making use of latent variables, can capture complex noise patterns in the data. We show how to extract and decompose uncertainty into epistemic and aleatoric components for decision-making purposes. This allows us to successfully identify informative points for active learning of functions with heteroscedastic and bimodal noise. Using the decomposition we further define a novel risk-sensitive criterion for reinforcement learning to identify policies that balance expected cost, model-bias and noise aversion.

Many important problems in machine learning require learning functions in the presence of noise. For example, in reinforcement learning (RL), the transition dynamics of a system is often stochastic. Ideally, a model for these systems should be able to both express such randomness but also to account for the uncertainty in its parameters.

Bayesian neural networks (BNN) are probabilistic models that place the flexibility of neural networks in a Bayesian framework (Blundell et al., 2015; Gal, 2016). In particular, recent work has extended BNNs with latent input variables (BNN+LV) to estimate functions with complex stochasticity such as bimodality or heteroscedasticity (Depeweg et al., 2016). This model class can describe complex stochastic patterns via a distribution over the latent input variables (aleatoric uncertainty), while, at the same time, account for model uncertainty via a distribution over weights (epistemic uncertainty).

In this work we show how to perform and utilize a decomposition of uncertainty in aleatoric and epistemic components for decision making purposes. Our contributions are:

We derive two decompositions that extract epistemic and aleatoric uncertainties from the predictive distribution of BNN+LV (Section 3).

We demonstrate that with this uncertainty decomposition, the BNN+LV identifies informative regions even in bimodal and heteroscedastic cases, enabling effi-cient active learning in the presence of complex noise (Section 4).

We derive a novel risk-sensitive criterion for model-based RL based on the uncertainty decomposition, enabling a domain expert to trade-off the risks of reliability, which originates from model bias and the risk induced by stochasticity (Section 5).

While using uncertainties over transition probabilities to avoid worst-case behavior has been well-studied in discrete MDPs (e.g. (Shapiro & Kleywegt, 2002; Nilim & El Ghaoui, 2005; Bagnell et al., 2001), to our knowledge, our work is the first to consider continuous non-linear functions with complex noise.

We review a recent family of probabilistic models for multioutput regression. These models were previously introduced by Depeweg et al. (2016), we refer to them as Bayesian Neural Networks with latent variables (BNN+LV).

Given a dataset  D = {xn, yn}Nn=1, formed by feature vectors  xn ∈ RDand targets  yn ∈ RK, we assume that  yn = f(xn, zn; W) + ϵn, where  f(·, ·; W)is the output of a neural network with weights W and K output units. The network receives as input the feature vector xnand the latent variable  zn ∼ N(0, γ). We choose rec-tifiers,  ϕ(x) = max(x, 0), as activation functions for the hidden layers and the identity function,  ϕ(x) = x, for the output layer. The network output is corrupted by the additive noise variable  ϵn ∼ N(0, Σ)with diagonal covariance matrix  Σ. The role of the latent variable  znis to capture unobserved stochastic features that can affect the network’s output in complex ways. Without  zn, randomness would only be given by the additive Gaussian observation noise  ϵn, which can only describe limited stochastic patterns. The network has L layers, with  Vlhidden units in layer l, and  W = {Wl}Ll=1is the collection of  Vl × (Vl−1 + 1)weight matrices. The +1 is introduced here to account for the additional per-layer biases. We approximate the exact posterior p(W, z | D) with:

image

The parameters  mwij,l, vwij,land  mzn, vznare determined by minimizing a divergence between p(W, z | D) and the approximation q. The reader is referred to the work of Hern´andez-Lobato et al. (2016); Depeweg et al. (2016) for more details on this. In our experiments, we tune q using black-box  α-divergence minimization with  α = 1.0. Whileother values of  αare possible, this specific value produced better uncertainty decompositions in practice: see Section 4 and the supplementary material for results with  α = 0.5and  α = 0(variational Bayes).

BNN+LV can capture complex stochastic patterns, while at the same time account for model uncertainty. They achieve this by jointly learning q(z), which describes the values of the latent variables that were used to generate the training data, and q(W), which represents uncertainty about model parameters. The result is a flexible Bayesian approach for learning conditional distributions with complex stochasticity, e.g. bimodal or heteroscedastic noise.

Let us assume that the targets are one-dimensional, that is, K = 1. The predictive distribution of a BNN+LV for the target variable  y⋆associated with the test data point  x⋆ is

image

where  p(y⋆|W, x⋆, z⋆) = N(y⋆|f(x⋆, z⋆; W), Σ)is the likelihood function,  p(z⋆) = N(z⋆|0, γ)is the prior on the latent variables and q(W) is the approximate posterior for W given D. In this expression q(z) is not used since the integration with respect to  z⋆must be done using the prior p(z⋆). The reason for this is that the  y⋆associated with  x⋆is unknown and consequently, there is no other evidence on z⋆than the one coming from  p(z⋆).

In Eq. (2), the randomness or uncertainty on  y⋆has its origin in  W ∼ q(W), z⋆ ∼ p(z⋆)and  ϵ ∼ N(0, σ2). This means that there are two types of uncertainties entangled in our predictons for  y⋆: aleatoric and epistemic (Der Kiureghian & Ditlevsen, 2009; Kendall & Gal, 2017). The aleatoric uncertainty originates from the randomness of  z⋆ and ϵ andcannot be reduced by collecting more data. By contrast, the epistemic uncertainty originates from the randomness of W and can be reduced by collecting more data, which will typically shrink the approximate posterior q(W).

Eq. (2) is the tool to use when making predictions for  y⋆. However, there are many settings in which, for decision making purposes, we may be interested in separating the two forms of uncertainty present in this distribution. We now describe two decompositions , each one differing in the metric used to quantify uncertainty: the first one is based on the entropy, whereas the second one uses the variance.

Let H(·)compute the differential entropy of a probability distribution. The total uncertainty present in Eq. (2) can then be quantified as H(y⋆|x⋆). Furthermore, assume that we do not integrate W out in Eq. (2) and, instead, we just condition on a specific value of this variable. The result is then  p(y⋆|W, x⋆) = �p(y⋆|W, x⋆, z⋆)p(z⋆) dz⋆with corresponding uncertainty H(y⋆|W, x⋆). The expectation of this quantity under q(W), that is,  Eq(W)[H(y⋆|W, x⋆)], can then be used to quantify the overall uncertainty in Eq. (2) coming from  z⋆and  ϵ. Therefore,  Eq(W)[H(y⋆|W, x⋆)], measures the aleatoric uncertainty. We can then quantify the epistemic part of the uncertainty in Eq. (2) by computing the difference between total and aleatoric uncertainties:

image

which is the mutual information between  y⋆ and W.

Instead of the entropy, we can use the variance as a measure of uncertainty. Let  σ2(·)compute the variance of a probability distribution. The total uncertainty present in Eq. (2) is then  σ2(y⋆|x⋆). This quantity can then be decomposed using the law of total variance:

image

where  E[y⋆|W, x⋆] and σ2[y⋆|W, x⋆]are, respectively, the mean and variance of  y⋆according to  p(y⋆|W, x⋆). In the expression above,  σ2q(W)(E[y⋆|W, x⋆])is the variance of  E[y⋆|W, x⋆]when  W ∼ q(W). This term ignores any contribution to the variance of  y⋆from  z⋆and  ϵand only considers the effect of W. Therefore, it corresponds to the epistemic uncertainty in Eq. (2). By contrast, the term  Eq(W)[σ2(y⋆|W, x⋆)]represents the average value of σ2(y⋆|W, x⋆)when  W ∼ q(W). This term ignores any contribution to the variance of  y⋆ from Wand, therefore, it represents the aleatoric uncertainty in Eq. (2).

In some cases, working with variances can be undesirable because they have square units. To avoid this problem, we can work with the square root of the previous terms. For example, we can represent the total uncertainty using

image

Active learning is the problem of iteratively collecting data so that the final gains in predictive performance are as high as possible (Settles, 2012). We consider the case of actively learning arbitrary non-linear functions with complex noise. To do so, we apply the information-theoretic framework for active learning described by MacKay (1992), which is based on the reduction of entropy in the model’s posterior distribution. Below, we show that this framework naturally results in the entropy-based uncertainty decomposition from Section 3. Next, we demonstrate how this framework, applied to BNN+LV enables data-efficient learning in the presence of heteroscedastic and bimodal noise.

Assume a BNN+LV is used to describe a batch of training data  D = {(x1, y1), · · · , (xN, yN)}. The expected reduction in posterior entropy for W that would be obtained when collecting the unknown target  y⋆for the input  x⋆ is

image

Note that this is the epistemic uncertainty that we introduced in Section 3, which has arisen naturally in this setting: the most informative  x⋆for which to collect  y⋆next is the one for which the epistemic uncertainty in the BNN+LV predictive distribution is the highest.

The epistemic uncertainty in Eq. (5) can be approximated using standard entropy estimators, e.g. nearest-neighbor methods (Kozachenko & Leonenko, 1987; Kraskov et al., 2004; Gao et al., 2016). For that, we repeatedly sample W and  z⋆and do forward passes through the BNN+LV to sample  y⋆. The resulting samples of  y⋆can then be used to approximate the respective entropies for each  x⋆using the nearest-neighbor approach:

image

where ˆH(·)is a nearest-neighbor entropy estimate given an empirical sample of points,  y1⋆, . . . , yL⋆are sampled from p(y⋆|x⋆)according to Eq. (2),  W1, . . . , WM ∼ q(W)and y1,Wi⋆ , . . . , yL,Wi⋆ ∼ p(y⋆|Wi, x⋆) for i = 1, . . . , M.

There are alternative ways to estimate the entropy, e.g. with histograms or using kernel density estimation (KDE) (Beir- lant et al., 1997). We choose nearest neighbor methods because they tend to work well in low dimensions, are fast to compute (compared to KDE) and do not require much hyperparameter tuning (compared to histograms). However, we note that for high-dimensional problems, estimating entropy is a difficult problem.

4.1. Experiments

We evaluate the active learning procedure on three problems. In each of them, we first train a BNN+LV with 2 hidden layers and 20 units per layer. Afterwards, we approximate the epistemic uncertainty as outlined in the previous section. Hyper-parameter settings and details for replication can be found in the supplementary material, which includes results for three other inference methods: Hamiltonian Monte Carlo (HMC), black-box  α- divergence minimization with  α =0.5 and α = 0(variational Bayes). These results show that the decomposition of uncertainty produced by  α = 1and the gold standard HMC are similar, but for lower values of αthis is not the case. Our main findings are:

The decomposition of uncertainty allows us to identify informative inputs when the noise is heteroscedastic. We consider a regression problem with heteroscedastic noise where  y = 7 sin(x) + 3| cos(x/2)|ϵwith  ϵ ∼ N(0, 1). We sample 750 values of the input x from a mixture of three Gaussians with mean parameters  {µ1 = −4, µ2 = 0, µ3 =4}, variance parameters  {σ1 = 25, σ2 = 0.9, σ3 = 25}and with each Gaussian component having weight equal to 1/3 in the mixture. Figure 1a shows the data. We have many points at the borders and in the center, but few in between.

Figure 1 shows the results obtained (see caption for details). The resulting decomposition of predictive uncertainty is very accurate: the epistemic uncertainty (Figure 1f), is inversely proportional to the density used to sample the data (Figure 1b). This makes sense, since in this toy problem the most informative inputs are located in regions where data is scarce. However, this may not be the case in more complicated settings. Finally, we note that the total predictive uncertainty (Figure 1d) fails to identify informative regions.

The decomposition of uncertainty allows us to identify informative inputs when the noise is bimodal. Next we consider a toy problem given by a regression task with bimodal data. We define  x ∈ [−0.5, 2] and y = 10 sin(x) +ϵwith probability 0.5 and  y = 10 cos(x) + ϵ, otherwise, where  ϵ ∼ N(0, 1)and  ϵis independent of x. We sample 750 values of x from an exponential distribution with  λ = 2.Figure 2a shows the data. We have many points on the left, but few on the right.

Figure 2 shows the results obtained (see caption for details). Figure 2c shows that the BNN+LV has learned the bimodal structure in the data and Figure 2d shows how the total predictive uncertainty increases on the right, where data is scarce. The aleatoric uncertainty (Figure 2e), by contrast,

image

Figure 1. Uncertainty decomposition on heteroscedastic data. (a): Raw data. (b): Density of x in data. (c): Predictive distribution  p(y⋆|x⋆).(d): Estimate of H(y⋆|x⋆). (e): Estimate of  Eq(W) [H(y⋆|x⋆, W)]. (f): Estimate of entropy reduction H(y⋆|x⋆) − Eq(W) [H(y⋆|x⋆, W)].

image

Figure 2. Uncertainty decomposition on bimodal data. (a): Raw data. (b): Density of x in data. (c): Predictive distribution:  p(y⋆|x⋆). (d):Estimate of H(y⋆|x⋆). (e): Estimate of  Eq(W) [H(y⋆|x⋆, W)]. (f): Estimate of entropy reduction H(y⋆|x⋆) − Eq(W) [H(y⋆|x⋆, W)].

has an almost symmetric form around x = 0.75, taking lower values at this location. This makes sense since the data generating process is symmetric around x = 0.75 and the noise changes from bimodal to unimodal when one gets closer to x = 0.75. Figure 2f shows an estimate of the epistemic uncertainty, which as expected increases with x.

The decomposition of uncertainty identifies informative inputs when noise is both heteroscedastic and bimodal. We consider data sampled from a 2D stochastic system called the wet-chicken (Hans & Udluft, 2009; Depeweg et al., 2016), see the supplementary material for details. The wet-chicken transition dynamics exhibit complex stochastic patterns: bimodality, heteroscedasticity and truncation (the agent cannot move beyond the boundaries of state space: [0, 5]2). The data are 7, 500 state transitions collected by random exploration. Figure 3a shows the states visited. For each transition, the BNN+LV predicts the next state given the current one and the action applied. Figure 3d shows that the epistemic uncertainty is highest in the top right corner,

image

Table 1. Test log-likelihood in active learning experiments after 150 iterations.

while data is most scarce in the bottom right corner. The reason for this result is that the wet-chicken dynamics bring the agent back to y = 0 whenever the agent goes beyond y = 5, but this does not happen for y = 0 where the agent just bounces back. Therefore, learning the dynamics is more difficult and requires more data at y = 5 than at y = 0. The epistemic uncertainty captures this property, but the total predictive uncertainty (Figure 3b) does not.

Active learning with BBN+LV is improved by using the uncertainty decomposition. We evaluate the gains obtained by using Eq. (5) with BNN+LV, when collecting

image

Figure 3. Uncertainty decomposition on wet-chicken dynamics. (a): Raw data. (b): Entropy estimate H(st+1|st)of predictive distribution for each  st (using at = {0, 0}). (e): Conditional entropy estimate  Eq(W) [H(st+1|st, W)]. (f): Estimated entropy reduction.

data in three toy active learning problems. We refer to this method as  Ibb-α(W, y⋆)and compare it with two baselines. The first one also uses a BNN+LV to describe data, but does not perform a decomposition of predictive uncertainty, that is, this method uses H(y⋆|x⋆)instead of Eq. (5) for active learning. We call this method Hbb-α(y⋆|x⋆). The second baseline is given by a Gaussian process (GP) model which collects data according to H(y⋆|x⋆)since in this case the uncertainty decomposition is not necessary because the GP model does not include latent variables. The GP model assumes Gaussian noise and is not able to capture complex stochastic patterns.

The three problems considered correspond to the datasets from Figures 1, 2 and 3. The general set-up is as follows. We start with the available data shown in the previous figures. At each iteration, we select a batch of data points to label from a pool set which is sampled uniformly at random in input space. The selected data is then included in the training set and the log-likelihood is evaluated on a separate test set. This process is performed for 150 iterations and we repeat all experiments 5 times.

Table 1 shows the results obtained. Overall, BNN+LV outperform GPs in terms of predictive performance. We also see significant gains of  Ibb-α(W, y⋆) over H(y⋆|x⋆) on theheteroscedastic and wet-chicken tasks, whereas their results are similar on the bimodal task. The reason for this is that, in the latter task, the epistemic and the total uncertainty have a similar behaviour as shown in Figures 2d and 2f. Finally, we note that heteroscedastic GPs (Le et al., 2005) will likely perform similar to BNN+LV in the heteroscedastic task from Figure 2, but they will fail in the other two settings considered (Figures 2 and 3).

We propose an extension of the “risk-sensitive criterion” for safe model-based RL (Garc´ıa & Fern´andez, 2015) to balance the risks produced by epistemic and aleatoric uncertainties.

We focus on batch RL with continuous state and action spaces (Lange et al., 2012): we are given a batch of state transitions  D = {(st, at, st+1)}formed by triples contain- ing the current state  st, the action applied  atand the next state  st+1. In addition to D, we are also given a cost function c. The goal is to obtain from D a policy in parametric form that minimizes c on average under the system dynamics.

In model-based RL, the first step consists in learning a dynamics model from D. We assume that the true dynamical system can be expressed by an unknown neural network with latent variables:

image

where  Wtruedenotes the weights of the network and  st−1, at−1 and ztare the inputs to the network. We use BNN+LV from Section 2 to approximate a posterior q(W, z) using the batch D (Depeweg et al., 2016).

In model-based policy search we optimize a policy given by a deterministic neural network with weights  Wπ. This parametric policy returns an action  atas a function of  st, that is,  at = π(st; Wπ). The policy parameters  Wπcan be tuned by minimizing the expectation of the cost C = �Tt=1 ctover a finite horizon T with respect to the belief q(W), where ct = c(st). This expected cost is obtained by averaging across multiple virtual roll-outs as described next.

Given  s0, we sample  W ∼ qand simulate state trajectories for T steps using the model  st+1 = f(st, at, zt; W) + ϵt+1with policy  at = π(st; Wπ), input noise  zt ∼ N(0, γ)and additive noise  ϵt+1 ∼ N(0, Σ). By averaging across these roll-outs, we obtain a Monte Carlo approximation of the expected cost given the initial state  s0:

image

where,  E[·]denotes here an average across virtual roll-outs starting from  s0and, to simplify our notation, we have made the dependence on  s0implicit. The policy search algorithm optimizes the expectation of Eq. (8) when  s0is sampled uniformly from D, that is,  Es0∼D[J(Wπ)]. This quantity can be easily approximated by Monte Carlo and if model, policy, and cost function are differentiable, we are able to tune  Wπby stochastic gradient descent.

The “risk-sensitive criterion” (Garc´ıa & Fern´andez, 2015) changes Eq. (8) to atain a balance between expected cost and risk, where the risk typically penalizes the deviations of C from E[C] during the virtual roll-outs with initial state s0. For example, the risk-sensitive objective could be

image

where  σ(C)is the standard deviation of C across virtual roll-outs starting from  s0and the risk-sensitive parameter βdetermines the amount of risk-avoidance (β ≥ 0) or risk-seeking behavior (β < 0) when optimizing  Wπ.

Instead of working directly with the risk on the final cost C, we consider the sum of risks on the individual costs c1, . . . , cT. The reason for this is that the latter is a more restrictive criterion since low risk on the  ctwill imply low risk on C, but not the other way around. Let  σ(ct)denote the standard deviation of  ctover virtual roll-outs starting from  s0. We can then explicitly write  σ(ct)in terms of its aleatoric and epistemic components by using the decomposition of uncertainty from Eq. (4). In particular,

image

where  E[ct|W] and σ2(ct|W)denote the mean and variance of  ctunder virtual roll-outs from  s0performed with policy Wπand under the dynamics of a BNN+LV with parameters W. In a similar manner as in Eq. (4), the operators  Eq(W)[·]and  σ2q(W)(·) in Eq. (10) compute the mean and variance of their arguments when  W ∼ q(W).

The two terms inside the square root in Eq. (10) have a clear interpretation. The first one,  Eq(W)[σ2(ct|W)], represents the risk originating from the sampling of z and  ϵin the virtual roll-outs. We call this term the aleatoric risk. The second term,  σ2q(W)(E[ct|W]), encodes the risk originating from the sampling of W in the virtual roll-outs. We call this term the epistemic risk.

We can now extend the objective in Eq. (8) with a new risk term that balances the epistemic and aleatoric risks. This term is obtained by first using risk-sensitive parameters  βand  γto balance the epistemic and aleatoric components in Eq. (10), and then summing the resulting expression for t = 1, . . . , T:

image

σ(γ, β) =

image

Therefore, our ‘risk-sensitive criterion” uses the function J(Wπ) = E [C] + σ(γ, β), which can be approximated via Monte Carlo and optimized using stochastic gradient descent. The Monte Carlo approximation is generated by performing  M × Nroll-outs with starting state  s0 sampleduniformly from D. For this, W is sampled from q(W) a total of M times and then, for each of these samples, N roll-outs are performed with W fixed and sampling only the latent variables and the additive Gaussian noise in the BBN+LV. Let  zm,ntand  ϵm,ntbe the samples of the latent variables and the additive Gaussian noise at step t during the n-th roll-out for the m-th sample of W, which we denote by  Wm.Then  cm,n(t) = c(sWm,{zm,n1 ,...,zm,nt },{ϵm,n1 ,...,ϵm,nt },Wπt )denotes the cost obtained at time t in that roll-out. All these cost values obtained at time t are stored in the  M × Nmatrix C(t). The Monte Carlo estimate of  J(Wπ) is then

image

where 1 denotes a vector with all of its entries equal to 1, C(t)m,·is a vector with the m-th row of C(t) and  ˆσ2[x]returns the empirical variance of the entries in vector x.

By setting  β and γto specific values in Eq. (11), the user can choose different trade-offs between cost, aleatoric and epistemic risk: for  γ = 0the term inside the square root is  β2times  ˆσ2 [C(t)1/N]which is a Monte Carlo approximation of the epistemic risk in Eq. (10). Similarly, for  β = 0, insidethe square root we obtain  γ2times 1M�Mm=1 ˆσ2 [C(t)m,·]which approximates the aleatoric risk. For  β = γthe standard risk criterion  σ(ct)is obtained, weighted by  β.

5.1. Model-bias and Noise aversion

The epistemic risk term in Eq. (10) can be connected with the concept of model-bias in model-based RL. A policy with Wπis optimized on the model but executed on the ground truth system. The more model and ground truth differ, the more the policy is ’biased’ by the model (Deisenroth & Ras- mussen, 2011). Given the initial state  s0, we can quantify this bias with respect to the policy parameters  Wπ as

image

where  Etrue[ct]is the expected cost obtained at time t across roll-outs starting at  s0, under the ground truth dynamics and with policy  π(st; Wπ). E[ct]is the same expectation but under BNN+LV dynamics sampled from q(W) on each individual roll-out.

Eq. (12) is impossible to compute in practice because we do not know the ground truth dynamics. However, as indicated in Eq. (7), we assume that the true dynamic is given by a neural network with latent variables and weights  Wtrue. Wecan then rewrite  Etrue[ct] as E[ct|Wtrue]and since we do not know  Wtrue, we can further assume that  Wtrue ∼ q(W). Theexpected model-bias is then

image

image

We see that our definition of epistemic risk also represents an estimate of model-bias in model-based RL. This risk term will guide the policy to operate in areas of state space where model-bias is expected to be low.

The aleatoric risk term in Eq. (10) can be connected with the concept of noise aversion. Let  σ2(ct|Wtrue)be the variance obtained at time t across roll-outs starting at  s0, under the ground truth dynamics and with policy  π(st; Wπ). Assuming  Wtrue ∼ q(W), the expected variance is then Eq(Wtrue)[σ2(ct|Wtrue)]. This term will guide the policy to operate in areas of state space where the stochasticity of the cost is low. Assuming a deterministic cost function this stochasticity is determined by the model’s predictions that originate from  zt and ϵt.

5.2. Experiments

We investigate the following questions: To what extent does our new risk criterion reduce model-bias? What trade-offs do we observe between average cost and model-bias? How does the decomposition compare to other simple methods?

We consider two model-based RL scenarios. The first one is given by the industrial benchmark (IB), a publicly available simulator with properties inspired by real industrial systems (Hein et al., 2017). The second RL scenario is a modified version of the HAWC2 wind turbine simulator (Larsen & Hansen, 2007), which is widely used for the study of wind turbine dynamics (Larsen et al., 2015).

We are given a batch of data formed by state transitions generated by a behavior policy  πb, for example, from an already running system. The behavioral policy has limited randomness and will keep the system dynamics constrained to a reduced manifold in state space. This means that large portions of state space will be unexplored and uncertainty will be high in those regions. The supplementary material contains full details on the experimental setup and the  πb.

We consider the risk-sensitive criterion from Section 5 for different choices of  β and γ, comparing it with 3 baselines. The first baseline is obtained by setting  β = γ = 0. In this case, the policy optimization ignores any risk. The second baseline is obtained when  β = γ. In this case, the risk criterion simplifies to  βσ(ct), which corresponds to the traditional risk-sensitive approach in Eq. (9), but applied to the individual costs  c1, . . . , cT. The last baseline uses a deterministic neural network to model the dynamics and a nearest neighbor approach to quantify risk: for each state  stgenerated in a roll-out, we calculate the Euclidean distance of that state to the nearest one in the training data. The average value of the distance metric for  stacross roll-outs is then an approximation to  σ(ct). To reduce computational cost, we summarize the training data using the centroids returned by an execution of the k-means clustering method. We denote this method as the nn-baseline.

Figure 4a shows result on the industrial benchmark. The y-axis in the plot is the average total cost at horizon T obtained by the policy in the ground truth system. The x-axis is the average model-bias in the ground truth system according to Eq. (12). Each individual curve in the plot is obtained by fixing  γto a specific value (line colour) and then changing  β(circle colour). The policy that ignores risk (β =γ = 0) results in both high model-bias and high cost when evaluated on the ground truth, which indicates overfitting. As  βincreases, the policies put more emphasis on avoiding model-bias, but at the same time the average cost increases. The best tradeoff is obtained by the dark red curve with γ = 0. The risk criterion is then  β �Tt=1 σq(W)(E[ct|W]). In this problem, adding aleatoric risk by setting  γ > 0decreases performance. The nn-baseline shows a similar pattern as the BNN+LV approach, but the trade-off between model-bias and cost is worse.

Figure 5 shows roll-outs for three different policies and a fixed initial state  s0. Figure 5a shows results for a policy learned with  γ = β = 0. This policy ignores risk, and as a consequence, the mismatch between predicted performance on the model and on the ground truth increases after t = 20. This result illustrates how model-bias can lead to policies with high costs at test time. Figure 5b shows results for policy that was trained while penalizing epistemic risk (β =4, γ = 0). In this case, the average costs under the BNN+LV model and the ground truth are similar, and the overall ground truth cost is lower than in Figure 5a. Finally, Figure 5c shows results for a noise averse policy (β = 0, γ = 4). In this case, the model bias is slightly higher than in the previous figure, but the stochasticity is lower.

The results for wind turbine simulator can be found in Figure 4b. In this case, the best trade-offs between expected cost and model-bias are obtained by the policies with  γ = 7.5. These policies are noise averse and will try to avoid noisy regions in state space. This makes sense because in wind turbines, high noise regions in state space are those where the effect of wind turbulence will have a strong impact on the average cost.

The distinction between aleatoric and epistemic uncertainty has been recognized in many fields within machine learning, often within the context of specific subfields, models, and objectives. Kendall & Gal (2017) consider a decomposition of uncertainty in the context of computer vision with heteroscedastic Gaussian output noise, while McAllister (2016) consider a decomposition in GPs for model-based RL.

image

Figure 4. RL experiments. (a): results on industrial benchmark. (b): results on wind turbine simulator. Each curve shows average cost (y-axis) against model-bias (x-axis). Circle color corresponds to different values of  β(epistemic risk weight) and curve color indicates different values of  γ(aleatoric risk weight). The purple curve is the baseline  γ = β. The black curve is nearest neighbor baseline.

image

Figure 5. 100 roll-outs on the industrial benchmark ground truth system (light green), their average cost (dark green), and the average cost of corresponding roll-outs on the BNN+LV model (blue) for a fixed value of the initial state  s0. We show results for three policies with different epistemic and aleatoric risk trade-offs. Policies are optimized using (a): no risk penalty (β, γ = 0). (b): a penalty on the epistemic risk only (γ = 0, β = 4). (c): a penalty on the aleatoric risk only (γ = 4, β = 0).

Within reinforcement learning, Bayesian notions of model uncertainty have a long history (Schmidhuber, 1991b;a; Dearden et al., 1999; Still & Precup, 2012; Sun et al., 2011; Maddison et al., 2017). The mentioned works typically consider the online case, where model uncertainty (a.k.a. curiosity) is used to guide exploration, e.g. in Houthooft et al. (2016) the uncertainty of a BNN model is used to guide exploration assuming deterministic dynamics. In contrast, we focus on the batch setting with stochastic dynamics.

Model uncertainty is used in safe or risk-sensitive RL (Mi- hatsch & Neuneier, 2002; Garc´ıa & Fern´andez, 2015). In safe RL numerous other approaches exists for safe exploration (Joseph et al., 2013; Hans et al., 2008; Garcia & Fern´andez, 2012; Berkenkamp et al., 2017). Uncertainties over transition probabilities have been studied in discrete MDPs since a long time (Shapiro & Kleywegt, 2002; Nilim & El Ghaoui, 2005; Bagnell et al., 2001) often with a focus on worst-case avoidance. Our work extends this to continuous state and action space using scalable probabilistic models. Our decomposition enables a practitioner to adjust the optimization criterion to specific decision making,.

Within active learning many approaches exist that follow an information theoretic approach (MacKay, 1992; Hern´andez- Lobato & Adams, 2015; Guo & Greiner, 2007). To our knowledge, all of these approaches however use deterministic methods (mostly GPs) as model class. Perhaps closest to our work is BALD (Houlsby et al., 2012), however because GPs are used, this approach cannot model problems with complex noise.

We have described a decomposition of predictive uncertainty into its epistemic and aleatoric components when working with Bayesian neural networks with latent variables. We have shown how this decomposition of uncertainty can be used for active learning, where it naturally arises from an information-theoretic perspective. We have also used the decomposition to propose a novel risk- sensitive criterion for model-based reinforcement learning which decomposes risk into model-bias and noise aversion components. Our experiments illustrate how the described decomposition of uncertainty is useful for efficient and risk-sensitive learning.

Bagnell, J. A., Ng, A. Y., and Schneider, J. G. Solving uncertain markov decision processes. 2001.

Beirlant, J., Dudewicz, E. J., Gy¨orfi, L., and Van der Meulen, E. C. Nonparametric entropy estimation: An overview. International Journal of Mathematical and Statistical Sciences, 6(1):17–39, 1997.

Berkenkamp, F., Turchetta, M., Schoellig, A. P., and Krause, A. Safe model-based reinforcement learning with stability guarantees. In Advances in Neural Information Processing Systems (NIPS), pp. 908–918, 2017.

Blundell, C., Cornebise, J., Kavukcuoglu, K., and Wierstra, D. Weight uncertainty in neural networks. In International Conference on Machine Learning (ICML), pp. 1613–1622, 2015.

Dearden, R., Friedman, N., and Andre, D. Model based bayesian exploration. In Proceedings of the Fifteenth conference on Uncertainty in artificial intelligence (UAI), pp. 150–159, 1999.

Deisenroth, M. and Rasmussen, C. E. Pilco: A model-based and data-efficient approach to policy search. In Proceedings of the 28th International Conference on machine learning (ICML-11), pp. 465–472, 2011.

Depeweg, S., Hern´andez-Lobato, J. M., Doshi-Velez, F., and Udluft, S. Learning and policy search in stochastic dynamical systems with bayesian neural networks. International Conference on Learning Representations (ICLR), 2016.

Der Kiureghian, A. and Ditlevsen, O. Aleatory or epistemic? does it matter? Structural Safety, 31(2):105–112, 2009.

Gal, Y. Uncertainty in deep learning. PhD thesis, University of Cambridge, 2016.

Gao, W., Oh, S., and Viswanath, P. Breaking the bandwidth barrier: Geometrical adaptive entropy estimation. In Advances in Neural Information Processing Systems (NIPS), pp. 2460–2468, 2016.

Garcia, J. and Fern´andez, F. Safe exploration of state and action spaces in reinforcement learning. Journal of Artificial Intelligence Research, 45:515–564, 2012.

Garc´ıa, J. and Fern´andez, F. A comprehensive survey on safe reinforcement learning. The Journal of Machine Learning Research, 16(1):1437–1480, 2015.

Guo, Y. and Greiner, R. Optimistic active-learning using mutual information. In International Joint Conference on Artificial Intelligence (IJCAI), pp. 823–829, 2007.

Hans, A. and Udluft, S. Efficient uncertainty propagation for rein- forcement learning with limited data. In International Conference on Artificial Neural Networks (ICANN), pp. 70–79. 2009.

Hans, A., Schneegaß, D., Sch¨afer, A. M., and Udluft, S. Safe exploration for reinforcement learning. In ESANN, pp. 143– 148, 2008.

Hein, D., Depeweg, S., Tokic, M., Udluft, S., Hentschel, A., Runk- ler, T. A., and Sterzing, V. A benchmark environment motivated by industrial control problems. IEEE Symposium on Computational Intelligence (IEEE SSCI), 2017.

Hern´andez-Lobato, J. M. and Adams, R. Probabilistic backpropagation for scalable learning of bayesian neural networks. In International Conference on Machine Learning (ICML), pp. 1861–1869, 2015.

Hern´andez-Lobato, J. M., Li, Y., Rowland, M., Hern´andez-Lobato, D., Bui, T., and Turner, R. E. Black-box  α-divergence minimization. In International Conference on Machine Learning (ICML), pp. 1861–1869, 2016.

Houlsby, N., Huszar, F., Ghahramani, Z., and Hern´andez-Lobato, J. M. Collaborative gaussian processes for preference learning. In Advances in Neural Information Processing Systems (NIPS), pp. 2096–2104, 2012.

Houthooft, R., Chen, X., Duan, Y., Schulman, J., De Turck, F., and Abbeel, P. VIME: Variational information maximizing exploration. In Advances in Neural Information Processing Systems (NIPS), pp. 1109–1117, 2016.

Joseph, J., Geramifard, A., Roberts, J. W., How, J. P., and Roy, N. Reinforcement learning with misspecified model classes. In International Conference on Robotics and Automation (ICRA), pp. 939–946, 2013.

Kendall, A. and Gal, Y. What uncertainties do we need in bayesian deep learning for computer vision? In Advances in Neural Information Processing Systems (NIPS), pp. 5580–5590, 2017.

Kozachenko, L. and Leonenko, N. N. Sample estimate of the entropy of a random vector. Problemy Peredachi Informatsii, 23(2):9–16, 1987.

Kraskov, A., St¨ogbauer, H., and Grassberger, P. Estimating mutual information. Physical review E, 69(6):066138, 2004.

Lange, S., Gabel, T., and Riedmiller, M. Batch reinforcement learning. In Reinforcement learning, pp. 45–73. Springer, 2012.

Larsen, T. J. and Hansen, A. M. How 2 hawc2, the user’s manual. Technical report, Risø National Laboratory, 2007.

Larsen, T. J., Larsen, G., Madsen, H. A., Thomsen, K., and Ped- ersen, S. M. Comparison of measured and simulated loads for the siemens swt2.3 operating in wake conditions at the lillgrund wind farm using hawc2 and the dynamic wake meander model. EWEA offshore 2015, 2015.

Le, Q. V., Smola, A. J., and Canu, S. Heteroscedastic gaussian process regression. In International Conference on Machine Learning (ICML), pp. 489–496, 2005.

MacKay, D. J. Information-based objective functions for active data selection. Neural computation, 4(4):590–604, 1992.

Maddison, C. J., Lawson, D., Tucker, G., Heess, N., Doucet, A., Mnih, A., and Teh, Y. W. Particle value functions. arXiv preprint arXiv:1703.05820, 2017.

McAllister, R. Bayesian Learning for Data-Efficient Control. PhD thesis, Kings College, 2016.

Mihatsch, O. and Neuneier, R. Risk-sensitive reinforcement learn- ing. Machine learning, 49(2-3):267–290, 2002.

Nilim, A. and El Ghaoui, L. Robust control of markov decision pro- cesses with uncertain transition matrices. Operations Research, 53(5):780–798, 2005.

Schmidhuber, J. Curious model-building control systems. In IEEE International Joint Conference on Neural Networks, pp. 1458–1463, 1991a.

Schmidhuber, J. A possibility for implementing curiosity and boredom in model-building neural controllers. In From animals to animats: Proceedings of the first international conference on simulation of adaptive behavior, pp. 15–21. Citeseer, 1991b.

Settles, B. Active learning. Synthesis Lectures on Artificial Intelligence and Machine Learning, 6(1):1–114, 2012.

Shapiro, A. and Kleywegt, A. Minimax analysis of stochastic problems. Optimization Methods and Software, 17(3):523–542, 2002.

Still, S. and Precup, D. An information-theoretic approach to curiosity-driven reinforcement learning. Theory in Biosciences, pp. 139–148, 2012.

Sun, Y., Gomez, F., and Schmidhuber, J. Planning to be surprised: Optimal bayesian exploration in dynamic environments. In International Conference on Artificial General Intelligence, pp. 41–51, 2011.

The goal here is to show that the decomposition we obtained in the active learning examples is not a result of our approximation using black-box  α-divergence minimization but a property of BNN+LV themselves. To that end we will approximate using HMC. After a burn-in of 500, 000 samples we sample from the posterior 200, 000 samples. We thin out 90% by only keeping every tenth sample.

A.1. Heteroscedastic Problem

We define the stochastic function  y = 7 sin(x) + 3| cos(x/2)|ϵwith  ϵ ∼ N(0, 1). The data availability is limited to specific regions of x. In particular, we sample 750 values of x from a mixture of three Gaussians with mean parameters {µ1 = −4, µ2 = 0, µ3 = 4}, variance parameters  {σ1 = 25, σ2 = 0.9, σ3 = 25}and with each Gaussian component having weight equal to 1/3 in the mixture. Figure 6a shows the raw data. We have lots of points at both borders of the x axis and in the center, but little data available in between.

image

Figure 6. HMC results of active learning example using heteroscedastic data. (a): Raw data. (b): Density of x in raw data. (c): Predictive distribution: p(y|x) of BNN using HMC. (d): Entropy estimate H(y|x) of predictive distribution for each x. (e): Conditional Entropy estimate  EWH(y|x, W)of predictive distribution for each x. (f): Estimate of reduction in entropy for each x.

A.2. Bimodal Problem

We consider a toy problem given by a regression task with bimodal data. We define  x ∈ [−0.5, 2]and  y = 10 sin(x) + ϵwith probability  0.5 and y = 10 cos(x) + ϵ, otherwise, where  ϵ ∼ N(0, 1) and ϵis independent of x. The data availability is not uniform in x. In particular we sample 750 values of x from an exponential distribution with  λ = 2

image

Figure 7. HMC results of active learning example using bimodal data. (a): Raw data. (b): Density of x in raw data. (c): Predictive distribution: p(y|x) of BNN using Hamilton monte carlo. (d): Entropy estimate H(y|x) of predictive distribution for each x. (e): Conditional Entropy estimate  EWH(y|x, W)of predictive distribution for each x. (f): Estimate of reduction in entropy for each x.

In the main document we pointed out that the decomposition of uncertainty does not work as good with other values of  α. We will see in the following, that lower values of  αwill put more and more emphasis on the latent variable z. We observe that the epistemic uncertainty will vanish as the  α-divergence minimization approaches variational Bayes.

image

Figure 8. Active learning example using heteroscedastic data using a BNN optimized with bb-α with α = 0.5. (a): Raw data. (b): Density of x in raw data. (c): Predictive distribution: p(y|x) of BNN. (d): Entropy estimate H(y|x) of predictive distribution for each x. (e): Conditional Entropy estimate  EWH(y|x, W)of predictive distribution for each x. (f): Estimate of reduction in entropy for each x.

image

Figure 9. Active learning example using bimodal data using a BNN optimized with bb-α with α = 0.5. (a): Raw data. (b): Density of x in raw data. (c): Predictive distribution: p(y|x) of BNN. (d): Entropy estimate H(y|x) of predictive distribution for each x. (e): Conditional Entropy estimate  EWH(y|x, W)of predictive distribution for each x. (f): Estimate of reduction in entropy for each x.

B.2. V B solutions to Toy Problems

We approximate the method variational Bayes by setting  α to 10−6.

image

Figure 10. Active learning example using heteroscedastic data using a BNN optimized by variational Bayes. (a): Raw data. (b): Density of x in raw data. (c): Predictive distribution: p(y|x) of BNN. (d): Entropy estimate H(y|x) of predictive distribution for each x. (e): Conditional Entropy estimate  EWH(y|x, W)of predictive distribution for each x. (f): Estimate of reduction in entropy for each x.

C.1. Active Learning

All models start with the available described in the respective paragraphs. We train for 5000 epochs a BNN+LV with two-hidden layer and 20 hidden units per layer. We use Adam as optimizer with a learning rate of 0.001. For Gaussian

image

Figure 11. Active learning example using bimodal data using a BNN optimized by variational Bayes. (a): Raw data. (b): Density of x in raw data. (c): Predictive distribution: p(y|x) of BNN. (d): Entropy estimate H(y|x) of predictive distribution for each x. (e): Conditional Entropy estimate  EWH(y|x, W)of predictive distribution for each x. (f): Estimate of reduction in entropy for each x.

processes(GPs) we use the standard RBF kernel using the python GPy implementation. For the entropy estimation we use a nearest-neighbor approach as explained in the main document with k = 25 and 500 samples of q(W) and 500 samples of p(z).

For active learning we evaluate performance using a held-out test set of size 500 for the bimodal and heteroscedastic problem and 2500 for the wet-chicken problem. The test data is sampled uniformly in state (and action) space. In each of the n = 150 iterations we sample a pool set of size 50 uniformly in input space. In each iteration a method can decide to include 5 data points into the training set. After that, the models are re-trained (from scratch) and the performance is evaluated on the test set.

C.2. Wet-chicken

We use the continuous two-dimensional version of the problem. A canoeist is paddling on a two-dimensional river. The canoeist’s position at time t is  (xt, yt). The river has width w = 5 and length l = 5 with a waterfall at the end, that is, at yt = l. The canoeist wants to move as close to the waterfall as possible because at time t he gets reward  rt = −(l − yt). However, going beyond the waterfall boundary makes the canoeist fall down, having to start back again at the origin (0, 0). At time t the canoeist can choose an action  (at,x, at,y) ∈ [−1, 1]2 that represents the direction and magnitude of his paddling. The river dynamics have stochastic turbulences  stand drift  vtthat depend on the canoeist’s position on the x axis. The larger  xt, the larger the drift and the smaller  xt, the larger the turbulences.

The underlying dynamics are given by the following system of equations. The drift and the turbulence magnitude are given by  vt = 3xtw−1and  st = 3.5 − vt, respectively. The new location  (xt+1, yt+1)is given by the current location  (xt, yt)and current action  (at,x, at,y) using

image

where  ˆyt+1 = yt + (at,y − 1) + vt + stτt and τt ∼ Unif([−1, 1])is a random variable that represents the current turbulence. As the canoeist moves closer to the waterfall, the distribution for the next state becomes increasingly bi-modal because when he is close to the waterfall, the change in the current location can be large if the canoeist falls down the waterfall and starts again at (0, 0). The distribution may also be truncated uniform for states close to the borders. Furthermore the system

has heteroscedastic noise, the smaller the value of  xtthe higher the noise variance.

C.3. Reinforcement Learning

Policies in the industrial benchmark specify changes  ∆v, ∆g and ∆sin three steering variables v (velocity), g (gain) and s (shift) as a function of  st. In the behavior policy these changes are stochastic and sampled according to

image

where  zv, zg ∼ N(0.5, 1√3)and  uv, ug, us ∼ U(−1, 1). The velocity v(t) and gain g(t) can take values in [0, 100]. Therefore, the data collection policy will try to keep these values only in the medium range given by the interval [40, 60]. Because of this, large parts of the state space will be unobserved. After collecting the data, the 30, 000 state transitions are used to train a BNN with latent variables with the same hyperparameters as in (Depeweg et al., 2016). Finally, we train different policies using the Monte Carlo approximation and we set the horizon of T = 100 steps, with M = 50 and N = 25 and a minibatch size of 1 for 750 epochs. The total training time on a single CPU is around 18 hours.

image

In this problem we observe the turbine state s(t), with features such as current wind speed and currently produced power. Our actions a(t) adjust the turbine’s behavior, with known upper and lower bounds. The goal is to maximize energy output over a T-step horizon.

We are given a batch of around 5,000 state transitions generated by a behavior policy  πb. The policy does limited exploration around the neutral action a(t) = 0.

The system is expected to be highly stochastic due to the unpredictability of future wind dynamics. Furthermore the dimensionality of state observation is much higher than the action dimensionality, so, with the limited dataset that we have, we expect it to be very challenging to accurately learn the influence of the action on the reward.

First we train a BNN with two hidden layer and 50 hidden units per layer on the available batch using  α-divergence minimization with  α = 1.0. In the second step, using the model, we train a policy with 20 hidden units on each of the two layers in the usual way, using the Monte Carlo estimate. The total training time on a single CPU is around 8 hours.


Designed for Accessibility and to further Open Science